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