Springboot 2.0 upgrade
[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.beans.Transient;
24 import java.io.Serializable;
25 import java.util.ArrayList;
26 import java.util.List;
27 import java.util.Map;
28
29 import com.fasterxml.jackson.annotation.JsonInclude;
30 import com.fasterxml.jackson.annotation.JsonInclude.Include;
31 import com.fasterxml.jackson.annotation.JsonProperty;
32 import com.fasterxml.jackson.annotation.JsonRootName;
33
34 @JsonRootName(value = "requestParameters")
35 @JsonInclude(Include.NON_DEFAULT)
36 public class RequestParameters implements Serializable {
37
38         private static final long serialVersionUID = -5979049912538894930L;
39         @JsonProperty("subscriptionServiceType")
40         private String subscriptionServiceType;
41         @JsonProperty("userParams")
42         private List<Map<String, Object>> userParams = new ArrayList<>();
43         @JsonProperty("aLaCarte")
44         private Boolean aLaCarte;
45         @JsonProperty("payload")
46         private String payload;
47         
48         // DONOT USE. It is intended to handle older VID requests(prior to 1802)
49         @Deprecated
50         @JsonProperty("alaCarte")
51         private Boolean alaCarte;
52         @JsonProperty("autoBuildVfModules")
53         private Boolean autoBuildVfModules;
54         @JsonProperty("cascadeDelete")
55         private Boolean cascadeDelete;
56         @JsonProperty("testApi")
57         private String testApi; // usePreload would always be true for Update
58         @JsonProperty("usePreload")
59         private Boolean usePreload; // usePreload would always be true for Update
60         @JsonProperty("rebuildVolumeGroups")
61         private Boolean rebuildVolumeGroups;    
62
63         public String getSubscriptionServiceType() {
64                 return subscriptionServiceType;
65         }
66
67         public void setSubscriptionServiceType(String subscriptionServiceType) {
68                 this.subscriptionServiceType = subscriptionServiceType;
69         }
70         @JsonProperty("aLaCarte")
71         public Boolean getALaCarte() {
72                 return aLaCarte;
73         }
74         @JsonProperty("aLaCarte")
75         public void setaLaCarte(Boolean aLaCarte) {
76                 this.aLaCarte = aLaCarte;
77         }
78         
79         public Boolean isaLaCarte() {
80                 return aLaCarte;
81         }
82         
83         public String getPayload(){
84                 return payload;
85         }
86         public void setPayload(String value){
87                 this.payload = value;
88         }
89
90         @Deprecated
91         @Transient
92         @JsonProperty("alaCarte")
93         public Boolean getAlaCarte() {
94                 return alaCarte;
95         }
96
97         @Deprecated
98         @JsonProperty("alaCarte")
99         public void setAlaCarte(Boolean alaCarte) {
100                 this.alaCarte = alaCarte;
101         }
102
103         public String getTestApi() {
104                 return testApi;
105         }
106
107         public void setTestApi(String testApi) {
108                 this.testApi = testApi;
109         }
110         
111         public List<Map<String, Object>> getUserParams() {
112                 return userParams;
113         }
114
115         public void setUserParams(List<Map<String, Object>> userParams) {
116                 this.userParams = userParams;
117         }
118
119         public String getUserParamValue(String name){
120                 if(userParams!=null){
121                         for(Map<String, Object> param:userParams){
122                                 if(param.containsKey("name") && param.get("name").equals(name) && param.containsKey("value")){
123                                         return param.get("value").toString();
124                                 }
125                         }
126                 }
127                 return null;
128         }
129         
130         public Boolean getAutoBuildVfModules() {
131                 return autoBuildVfModules;
132         }
133         
134         public void setAutoBuildVfModules(Boolean autoBuildVfModules) {
135                 this.autoBuildVfModules = autoBuildVfModules;
136         }
137
138         public Boolean getCascadeDelete() {
139                 return cascadeDelete;
140         }
141
142         public void setCascadeDelete(Boolean cascadeDelete) {
143                 this.cascadeDelete = cascadeDelete;
144         }
145
146         public Boolean isUsePreload() {
147                 return usePreload;
148         }
149
150         public void setUsePreload(Boolean usePreload) {
151                 this.usePreload = usePreload;
152         }
153         
154         public Boolean getRebuildVolumeGroups() {
155                 return rebuildVolumeGroups;
156         }
157
158         public void setRebuildVolumeGroups(Boolean rebuildVolumeGroups) {
159                 this.rebuildVolumeGroups = rebuildVolumeGroups;
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 }