2085e66dde1da1d4979e7714b57e2ec5866cc497
[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         @JsonProperty("usePreload")
48         private Boolean usePreload; // usePreload would always be true for Update
49         
50         @JsonProperty("autoBuildVfModules")
51         private Boolean autoBuildVfModules;
52         @JsonProperty("cascadeDelete")
53         private Boolean cascadeDelete;
54         @JsonProperty("testApi")
55         private String testApi; // usePreload would always be true for Update
56         @JsonProperty("rebuildVolumeGroups")
57         private Boolean rebuildVolumeGroups;    
58
59         public String getSubscriptionServiceType() {
60                 return subscriptionServiceType;
61         }
62
63         public void setSubscriptionServiceType(String subscriptionServiceType) {
64                 this.subscriptionServiceType = subscriptionServiceType;
65         }
66         @JsonProperty("aLaCarte")
67         public Boolean getALaCarte() {
68                 return aLaCarte;
69         }
70         @JsonProperty("aLaCarte")
71         public void setaLaCarte(Boolean aLaCarte) {
72                 this.aLaCarte = aLaCarte;
73         }
74         
75         public Boolean isaLaCarte() {
76                 return aLaCarte;
77         }
78         
79         public String getPayload(){
80                 return payload;
81         }
82         public void setPayload(String value){
83                 this.payload = value;
84         }
85         
86         public Boolean isUsePreload() {
87                 return usePreload;
88         }
89         
90         @JsonProperty("usePreload")
91         public Boolean getUsePreload() {
92                 return usePreload;
93         }
94         
95         @JsonProperty("usePreload")
96         public void setUsePreload(Boolean usePreload) {
97                 this.usePreload = usePreload;
98         }       
99
100         public String getTestApi() {
101                 return testApi;
102         }
103
104         public void setTestApi(String testApi) {
105                 this.testApi = testApi;
106         }
107         
108         public List<Map<String, Object>> getUserParams() {
109                 return userParams;
110         }
111
112         public void setUserParams(List<Map<String, Object>> userParams) {
113                 this.userParams = userParams;
114         }
115
116         public String getUserParamValue(String name){
117                 if(userParams!=null){
118                         for(Map<String, Object> param:userParams){
119                                 if(param.containsKey("name") && param.get("name").equals(name) && param.containsKey("value")){
120                                         return param.get("value").toString();
121                                 }
122                         }
123                 }
124                 return null;
125         }
126         
127         public Boolean getAutoBuildVfModules() {
128                 return autoBuildVfModules;
129         }
130         
131         public void setAutoBuildVfModules(Boolean autoBuildVfModules) {
132                 this.autoBuildVfModules = autoBuildVfModules;
133         }
134
135         public Boolean getCascadeDelete() {
136                 return cascadeDelete;
137         }
138
139         public void setCascadeDelete(Boolean cascadeDelete) {
140                 this.cascadeDelete = cascadeDelete;
141         }       
142         
143         public Boolean getRebuildVolumeGroups() {
144                 return rebuildVolumeGroups;
145         }
146
147         public void setRebuildVolumeGroups(Boolean rebuildVolumeGroups) {
148                 this.rebuildVolumeGroups = rebuildVolumeGroups;
149         }       
150         
151         @Override
152         public String toString() {
153                 return "RequestParameters [subscriptionServiceType="
154                                 + subscriptionServiceType + ", userParams=" + userParams
155                                 + ", aLaCarte=" + aLaCarte + ", testApi= " + testApi + ", autoBuildVfModules="
156                                 + autoBuildVfModules + ", usePreload="
157                                 + usePreload + ", rebuildVolumeGroups="
158                                 + rebuildVolumeGroups + ", payload=" + payload + "]";
159         }
160 }