Change the header to SO
[so.git] / mso-api-handlers / mso-api-handler-infra / src / main / java / org / openecomp / mso / apihandlerinfra / serviceinstancebeans / RequestParameters.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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.openecomp.mso.apihandlerinfra.serviceinstancebeans;
22
23 import java.util.ArrayList;
24 import java.util.List;
25 import java.util.Map;
26
27 import org.codehaus.jackson.annotate.JsonIgnore;
28 import org.codehaus.jackson.map.annotate.JsonSerialize;
29 import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
30
31 @JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
32 public class RequestParameters {
33
34         private String subscriptionServiceType;
35         private List<Map<String, String>> userParams = new ArrayList<>();
36         @JsonSerialize(include=Inclusion.ALWAYS)
37         private boolean aLaCarte = false;
38         @JsonIgnore
39         private boolean isALaCarteSet = false;
40         @JsonSerialize(include=Inclusion.ALWAYS)
41         private boolean autoBuildVfModules = false;
42         @JsonSerialize(include=Inclusion.ALWAYS)
43         private boolean cascadeDelete = false;
44         @JsonSerialize(include=Inclusion.ALWAYS)
45         private boolean usePreload=true; // usePreload would always be true for Update
46         @JsonSerialize(include=Inclusion.ALWAYS)
47         private boolean rebuildVolumeGroups = false;
48
49
50         public String getSubscriptionServiceType() {
51                 return subscriptionServiceType;
52         }
53
54         public void setSubscriptionServiceType(String subscriptionServiceType) {
55                 this.subscriptionServiceType = subscriptionServiceType;
56         }
57
58         public boolean getALaCarte() {
59                 return aLaCarte;
60         }
61
62         public void setaLaCarte(boolean aLaCarte) {
63                 this.aLaCarte = aLaCarte;
64                 this.isALaCarteSet = true;
65         }
66
67         //returns true if aLaCarte param came in on request
68         public boolean isALaCarteSet() {
69                 return isALaCarteSet;
70         }
71
72         public boolean isaLaCarte() {
73                 return aLaCarte;
74         }
75
76         public List<Map<String, String>> getUserParams() {
77                 return userParams;
78         }
79
80         public void setUserParams(List<Map<String, String>> userParams) {
81                 this.userParams = userParams;
82         }
83
84         public String getUserParamValue(String name){
85                 if(userParams!=null){
86                         for(Map<String, String> param:userParams){
87                                 if(param.get("name").equals(name)){
88                                         return param.get("value");
89                                 }
90                         }
91                 }
92                 return null;
93         }
94
95         public boolean getAutoBuildVfModules() {
96                 return autoBuildVfModules;
97         }
98
99         public void setAutoBuildVfModules(boolean autoBuildVfModules) {
100                 this.autoBuildVfModules = autoBuildVfModules;
101         }
102
103         public boolean getCascadeDelete() {
104                 return cascadeDelete;
105         }
106
107         public void setCascadeDelete(boolean cascadeDelete) {
108                 this.cascadeDelete = cascadeDelete;
109         }
110
111         public boolean isUsePreload() {
112                 return usePreload;
113         }
114
115         public void setUsePreload(boolean usePreload) {
116                 this.usePreload = usePreload;
117         }
118         
119         public boolean rebuildVolumeGroups() {
120                 return rebuildVolumeGroups;
121         }
122
123         public void setRebuildVolumeGroups(boolean rebuildVolumeGroups) {
124                 this.rebuildVolumeGroups = rebuildVolumeGroups;
125         }
126
127         @Override
128         public String toString() {
129                 return "RequestParameters [subscriptionServiceType="
130                                 + subscriptionServiceType + ", userParams=" + userParams
131                                 + ", aLaCarte=" + aLaCarte + ", autoBuildVfModules="
132                                 + autoBuildVfModules + ", usePreload="
133                                 + usePreload + ", rebuildVolumeGroups="
134                                 + rebuildVolumeGroups +"]";
135         }
136
137
138 }