[SDC] Onboarding 1710 rebase.
[sdc.git] / openecomp-be / lib / openecomp-sdc-vendor-license-lib / openecomp-sdc-vendor-license-core / src / main / java / org / openecomp / sdc / vendorlicense / licenseartifacts / impl / types / VendorLicenseArtifact.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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.sdc.vendorlicense.licenseartifacts.impl.types;
22
23 import com.fasterxml.jackson.annotation.JsonProperty;
24 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
25 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
26 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
27 import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
28 import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
29 import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml;
30 import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinEntitlementPoolEntityForVendorLicenseArtifact;
31 import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinLicenseKeyGroupEntityForVendorLicenseArtifact;
32 import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinLimitArtifact;
33
34 import java.util.Collection;
35
36 @JacksonXmlRootElement(localName = "vendor-license-model",
37     namespace = "http://xmlns.openecomp.org/asdc/license-model/1.0")
38 public class VendorLicenseArtifact extends XmlArtifact {
39   @JsonProperty(value = "vendor-name")
40   String vendorName;
41
42   Collection<EntitlementPoolEntity> entitlementPoolEntities;
43   Collection<LicenseKeyGroupEntity> licenseKeyGroupEntities;
44
45   public String getVendorName() {
46     return vendorName;
47   }
48
49   public void setVendorName(String vendorName) {
50     this.vendorName = vendorName;
51   }
52
53   @JacksonXmlProperty(isAttribute = false, localName = "entitlement-pool")
54   @JacksonXmlElementWrapper(localName = "entitlement-pool-list")
55   public Collection<EntitlementPoolEntity> getEntitlementPoolEntities() {
56     return entitlementPoolEntities;
57   }
58
59   public void setEntitlementPoolEntities(
60       Collection<EntitlementPoolEntity> entitlementPoolEntities) {
61     this.entitlementPoolEntities = entitlementPoolEntities;
62   }
63
64   @JacksonXmlProperty(isAttribute = false, localName = "license-key-group")
65   @JacksonXmlElementWrapper(localName = "license-key-group-list")
66   public Collection<LicenseKeyGroupEntity> getLicenseKeyGroupEntities() {
67     return licenseKeyGroupEntities;
68   }
69
70   public void setLicenseKeyGroupEntities(
71       Collection<LicenseKeyGroupEntity> licenseKeyGroupEntities) {
72     this.licenseKeyGroupEntities = licenseKeyGroupEntities;
73   }
74
75   @Override
76   void initMapper() {
77     xmlMapper.addMixIn(EntitlementPoolEntity.class,
78         MixinEntitlementPoolEntityForVendorLicenseArtifact.class);
79     xmlMapper.addMixIn(LicenseKeyGroupEntity.class,
80         MixinLicenseKeyGroupEntityForVendorLicenseArtifact.class);
81     xmlMapper.addMixIn(LimitXml.class, MixinLimitArtifact.class);
82   }
83 }