87cb481dec9c4321782539dd4bf565e8deae875e
[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         @JsonProperty("payload")
47         private String payload;
48         
49         // DONOT USE. It is intended to handle older VID requests(prior to 1802)
50         @Deprecated
51         @JsonProperty("alaCarte")
52         private Boolean alaCarte;
53         @JsonProperty("autoBuildVfModules")
54         private Boolean autoBuildVfModules;
55         @JsonProperty("cascadeDelete")
56         private Boolean cascadeDelete;
57         @JsonProperty("testApi")
58         private String testApi; // usePreload would always be true for Update
59         @JsonProperty("usePreload")
60         private Boolean usePreload; // usePreload would always be true for Update
61         @JsonProperty("rebuildVolumeGroups")
62         private Boolean rebuildVolumeGroups;    
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         public String getPayload(){
85                 return payload;
86         }
87         public void setPayload(String value){
88                 this.payload = value;
89         }
90
91         @Deprecated
92         @Transient
93         @JsonProperty("alaCarte")
94         public Boolean getAlaCarte() {
95                 return alaCarte;
96         }
97
98         @Deprecated
99         @JsonProperty("alaCarte")
100         public void setAlaCarte(Boolean alaCarte) {
101                 this.alaCarte = alaCarte;
102         }
103
104         public String getTestApi() {
105                 return testApi;
106         }
107
108         public void setTestApi(String testApi) {
109                 this.testApi = testApi;
110         }
111         
112         public List<Map<String, Object>> getUserParams() {
113                 return userParams;
114         }
115
116         public void setUserParams(List<Map<String, Object>> userParams) {
117                 this.userParams = userParams;
118         }
119
120         public String getUserParamValue(String name){
121                 if(userParams!=null){
122                         for(Map<String, Object> param:userParams){
123                                 if(param.containsKey("name") && param.get("name").equals(name) && param.containsKey("value")){
124                                         return param.get("value").toString();
125                                 }
126                         }
127                 }
128                 return null;
129         }
130         
131         public Boolean getAutoBuildVfModules() {
132                 return autoBuildVfModules;
133         }
134         
135         public void setAutoBuildVfModules(Boolean autoBuildVfModules) {
136                 this.autoBuildVfModules = autoBuildVfModules;
137         }
138
139         public Boolean getCascadeDelete() {
140                 return cascadeDelete;
141         }
142
143         public void setCascadeDelete(Boolean cascadeDelete) {
144                 this.cascadeDelete = cascadeDelete;
145         }
146
147         public Boolean isUsePreload() {
148                 return usePreload;
149         }
150
151         public void setUsePreload(Boolean usePreload) {
152                 this.usePreload = usePreload;
153         }
154         
155         public Boolean getRebuildVolumeGroups() {
156                 return rebuildVolumeGroups;
157         }
158
159         public void setRebuildVolumeGroups(Boolean rebuildVolumeGroups) {
160                 this.rebuildVolumeGroups = rebuildVolumeGroups;
161         }       
162         
163         @Override
164         public String toString() {
165                 return "RequestParameters [subscriptionServiceType="
166                                 + subscriptionServiceType + ", userParams=" + userParams
167                                 + ", aLaCarte=" + aLaCarte + ", testApi= " + testApi + ", autoBuildVfModules="
168                                 + autoBuildVfModules + ", usePreload="
169                                 + usePreload + ", rebuildVolumeGroups="
170                                 + rebuildVolumeGroups + ", payload=" + payload + "]";
171         }
172 }