Containerization feature of SO
[so.git] / common / src / main / java / org / onap / so / serviceinstancebeans / RequestParameters.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * OPENECOMP - MSO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.serviceinstancebeans;
22
23 import java.io.Serializable;
24 import java.util.ArrayList;
25 import java.util.List;
26 import java.util.Map;
27
28 import javax.persistence.Transient;
29
30 import com.fasterxml.jackson.annotation.JsonInclude;
31 import com.fasterxml.jackson.annotation.JsonInclude.Include;
32 import com.fasterxml.jackson.annotation.JsonProperty;
33 import com.fasterxml.jackson.annotation.JsonRootName;
34
35 @JsonRootName(value = "requestParameters")
36 @JsonInclude(Include.NON_DEFAULT)
37 public class RequestParameters implements Serializable {
38
39         private static final long serialVersionUID = -5979049912538894930L;
40         @JsonProperty("subscriptionServiceType")
41         private String subscriptionServiceType;
42         @JsonProperty("userParams")
43         private List<Map<String, Object>> userParams = new ArrayList<>();
44         @JsonProperty("aLaCarte")
45         private Boolean aLaCarte;
46         
47         // DONOT USE. It is intended to handle older VID requests(prior to 1802)
48         @Deprecated
49         @JsonProperty("alaCarte")
50         private Boolean alaCarte;
51         @JsonProperty("autoBuildVfModules")
52         private Boolean autoBuildVfModules;
53         @JsonProperty("cascadeDelete")
54         private Boolean cascadeDelete;
55         @JsonProperty("testApi")
56         private String testApi; // usePreload would always be true for Update
57         @JsonProperty("usePreload")
58         private Boolean usePreload; // usePreload would always be true for Update
59         @JsonProperty("rebuildVolumeGroups")
60         private Boolean rebuildVolumeGroups;
61         @JsonProperty("payload")
62         private String payload;
63
64         public String getSubscriptionServiceType() {
65                 return subscriptionServiceType;
66         }
67
68         public void setSubscriptionServiceType(String subscriptionServiceType) {
69                 this.subscriptionServiceType = subscriptionServiceType;
70         }
71         @JsonProperty("aLaCarte")
72         public Boolean getALaCarte() {
73                 return aLaCarte;
74         }
75         @JsonProperty("aLaCarte")
76         public void setaLaCarte(Boolean aLaCarte) {
77                 this.aLaCarte = aLaCarte;
78         }
79         
80         public Boolean isaLaCarte() {
81                 return aLaCarte;
82         }
83
84         @Deprecated
85         @Transient
86         @JsonProperty("alaCarte")
87         public Boolean getAlaCarte() {
88                 return alaCarte;
89         }
90
91         @Deprecated
92         @JsonProperty("alaCarte")
93         public void setAlaCarte(Boolean alaCarte) {
94                 this.alaCarte = alaCarte;
95         }
96
97         public String getTestApi() {
98                 return testApi;
99         }
100
101         public void setTestApi(String testApi) {
102                 this.testApi = testApi;
103         }
104         
105         public List<Map<String, Object>> getUserParams() {
106                 return userParams;
107         }
108
109         public void setUserParams(List<Map<String, Object>> userParams) {
110                 this.userParams = userParams;
111         }
112
113         public String getUserParamValue(String name){
114                 if(userParams!=null){
115                         for(Map<String, Object> param:userParams){
116                                 if(param.get("name").equals(name)){
117                                         return param.get("value").toString();
118                                 }
119                         }
120                 }
121                 return null;
122         }
123         
124         public Boolean getAutoBuildVfModules() {
125                 return autoBuildVfModules;
126         }
127         
128         public void setAutoBuildVfModules(Boolean autoBuildVfModules) {
129                 this.autoBuildVfModules = autoBuildVfModules;
130         }
131
132         public Boolean getCascadeDelete() {
133                 return cascadeDelete;
134         }
135
136         public void setCascadeDelete(Boolean cascadeDelete) {
137                 this.cascadeDelete = cascadeDelete;
138         }
139
140         public Boolean isUsePreload() {
141                 return usePreload;
142         }
143
144         public void setUsePreload(Boolean usePreload) {
145                 this.usePreload = usePreload;
146         }
147         
148         public Boolean getRebuildVolumeGroups() {
149                 return rebuildVolumeGroups;
150         }
151
152         public void setRebuildVolumeGroups(Boolean rebuildVolumeGroups) {
153                 this.rebuildVolumeGroups = rebuildVolumeGroups;
154         }
155         public String getPayload(){
156                 return payload;
157         }
158         public void setPayload(String value){
159                 this.payload = value;
160         }
161         
162         @Override
163         public String toString() {
164                 return "RequestParameters [subscriptionServiceType="
165                                 + subscriptionServiceType + ", userParams=" + userParams
166                                 + ", aLaCarte=" + aLaCarte + ", testApi= " + testApi + ", autoBuildVfModules="
167                                 + autoBuildVfModules + ", usePreload="
168                                 + usePreload + ", rebuildVolumeGroups="
169                                 + rebuildVolumeGroups + ", payload=" + payload + "]";
170         }
171 }