93dfd4f1f1a4725a54b9a58a920798a6e5e89514
[so.git] / bpmn / MSOCoreBPMN / src / main / java / org / onap / so / bpmn / core / domain / License.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.onap.so.bpmn.core.domain;
22
23 import java.io.Serializable;
24 import java.util.ArrayList;
25 import java.util.Arrays;
26 import java.util.List;
27
28 import org.json.JSONArray;
29
30 import com.fasterxml.jackson.annotation.JsonIgnore;
31 import com.fasterxml.jackson.annotation.JsonInclude;
32 import com.fasterxml.jackson.annotation.JsonRootName;
33
34 /**
35  * Stores licensing information and is an attribute
36  * of a <class>HomingSolution</class>
37  *
38  */
39 @JsonRootName("license")
40 @JsonInclude(JsonInclude.Include.NON_EMPTY)
41 public class License extends JsonWrapper implements Serializable  {
42
43         private static final long serialVersionUID = 1L;
44
45         @JsonInclude(JsonInclude.Include.NON_EMPTY)
46         private List<String> entitlementPoolList = new ArrayList<String>();
47         @JsonInclude(JsonInclude.Include.NON_EMPTY)
48         private List<String> licenseKeyGroupList = new ArrayList<String>();
49
50
51         public List<String> getEntitlementPoolList() {
52                 return entitlementPoolList;
53         }
54
55         public void setEntitlementPoolList(List<String> entitlementPoolList) {
56                 this.entitlementPoolList = entitlementPoolList;
57         }
58
59         public List<String> getLicenseKeyGroupList() {
60                 return licenseKeyGroupList;
61         }
62
63         public void setLicenseKeyGroupList(List<String> licenseKeyGroupList) {
64                 this.licenseKeyGroupList = licenseKeyGroupList;
65         }
66
67         /**
68          * This method adds a Entitlement Pool Uuid
69          * to the EntitlementPoolList
70          *
71          * @param the EntitlementPoolUuid
72          */
73         public void addEntitlementPool(String entitlementPoolUuid) {
74                 entitlementPoolList.add(entitlementPoolUuid);
75         }
76
77         /**
78          * This method adds a License Key Group Uuid
79          * to the LicenseKeyGroupList
80          *
81          * @param the licenseKeyGroupUuid
82          */
83         public void addLicenseKeyGroup(String licenseKeyGroupUuid) {
84                 licenseKeyGroupList.add(licenseKeyGroupUuid);
85         }
86
87         /**
88          * This method returns the licenseKeyGroupList
89          * as a json array
90          *
91          * @return the strList
92          */
93         @JsonIgnore
94         public JSONArray getLicenseKeyGroupListAsString() {
95         JSONArray array = new JSONArray(licenseKeyGroupList);
96                 return array;
97         }
98
99         /**
100          * This method returns the entitlementPoolList
101          * as a json array
102          *
103          * @return the strList
104          */
105         @JsonIgnore
106         public JSONArray getEntitlementPoolListAsString() {
107         JSONArray array = new JSONArray(entitlementPoolList);
108                 return array;
109         }
110
111         /**
112          * @return the serialversionuid
113          */
114         public static long getSerialversionuid() {
115                 return serialVersionUID;
116         }
117
118 }