2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.vendorlicense.dao.types;
23 import com.datastax.driver.mapping.annotations.ClusteringColumn;
24 import com.datastax.driver.mapping.annotations.Column;
25 import com.datastax.driver.mapping.annotations.Frozen;
26 import com.datastax.driver.mapping.annotations.PartitionKey;
27 import com.datastax.driver.mapping.annotations.Table;
29 import org.openecomp.sdc.versioning.dao.types.Version;
30 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
32 import java.util.HashSet;
33 import java.util.Objects;
36 @Table(name = "feature_group", keyspace = "dox")
37 public class FeatureGroupEntity implements VersionableEntity {
38 private static final String ENTITY_TYPE = "Feature Group";
41 @Column(name = "vlm_id")
42 private String vendorLicenseModelId;
43 @PartitionKey(value = 1)
45 private Version version;
47 @Column(name = "fg_id")
50 private String description;
51 @Column(name = "part_num")
52 private String partNumber;
53 @Column(name = "manufacturer_ref_num")
54 private String manufacturerReferenceNumber;
55 @Column(name = "lkg_ids")
56 private Set<String> licenseKeyGroupIds = new HashSet<>();
57 @Column(name = "ep_ids")
58 private Set<String> entitlementPoolIds = new HashSet<>();
59 @Column(name = "ref_la_ids")
60 private Set<String> referencingLicenseAgreements = new HashSet<>();
63 * Every entity class must have a default constructor according to
64 * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
65 * Definition of mapped classes</a>.
67 public FeatureGroupEntity() {
68 // Don't delete! Default constructor is required by DataStax driver
72 * Instantiates a new Feature group entity.
74 * @param vendorLicenseModelId the vendor license model id
75 * @param version the version
78 public FeatureGroupEntity(String vendorLicenseModelId, Version version, String id) {
79 this.vendorLicenseModelId = vendorLicenseModelId;
80 this.version = version;
85 public String getEntityType() {
90 public String getFirstClassCitizenId() {
91 return getVendorLicenseModelId();
95 public String getId() {
100 public void setId(String id) {
105 public Version getVersion() {
110 public void setVersion(Version version) {
111 this.version = version;
114 public String getVendorLicenseModelId() {
115 return vendorLicenseModelId;
118 public void setVendorLicenseModelId(String vendorLicenseModelId) {
119 this.vendorLicenseModelId = vendorLicenseModelId;
122 public String getName() {
126 public void setName(String name) {
130 public String getDescription() {
134 public void setDescription(String description) {
135 this.description = description;
138 public String getPartNumber() {
142 public void setPartNumber(String partNumber) {
143 this.partNumber = partNumber;
146 public String getManufacturerReferenceNumber() {
147 return manufacturerReferenceNumber;
150 public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
151 this.manufacturerReferenceNumber = manufacturerReferenceNumber;
154 public Set<String> getLicenseKeyGroupIds() {
155 return licenseKeyGroupIds;
158 public void setLicenseKeyGroupIds(Set<String> licenseKeyGroupIds) {
159 this.licenseKeyGroupIds = licenseKeyGroupIds;
162 public Set<String> getEntitlementPoolIds() {
163 return entitlementPoolIds;
166 public void setEntitlementPoolIds(Set<String> entitlementPoolIds) {
167 this.entitlementPoolIds = entitlementPoolIds;
170 public Set<String> getReferencingLicenseAgreements() {
171 return referencingLicenseAgreements;
174 public void setReferencingLicenseAgreements(Set<String> referencingLicenseAgreements) {
175 this.referencingLicenseAgreements = referencingLicenseAgreements;
179 public int hashCode() {
181 .hash(vendorLicenseModelId, version, id, name, description, partNumber,
182 manufacturerReferenceNumber, licenseKeyGroupIds, entitlementPoolIds,
183 referencingLicenseAgreements);
187 public boolean equals(Object obj) {
191 if (obj == null || getClass() != obj.getClass()) {
194 FeatureGroupEntity that = (FeatureGroupEntity) obj;
195 return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
196 && Objects.equals(version, that.version)
197 && Objects.equals(id, that.id)
198 && Objects.equals(name, that.name)
199 && Objects.equals(description, that.description)
200 && Objects.equals(partNumber, that.partNumber)
201 && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber)
202 && Objects.equals(licenseKeyGroupIds, that.licenseKeyGroupIds)
203 && Objects.equals(entitlementPoolIds, that.entitlementPoolIds)
204 && Objects.equals(referencingLicenseAgreements, that.referencingLicenseAgreements);
208 public String toString() {
209 return "FeatureGroupEntity{"
210 + "vendorLicenseModelId='" + vendorLicenseModelId + '\''
211 + ", version=" + version
212 + ", id='" + id + '\''
213 + ", name='" + name + '\''
214 + ", description='" + description + '\''
215 + ", partNumber='" + partNumber + '\''
216 + ", manufacturerReferenceNumber='" + manufacturerReferenceNumber + '\''
217 + ", licenseKeyGroupIds=" + licenseKeyGroupIds
218 + ", entitlementPoolIds=" + entitlementPoolIds
219 + ", referencingLicenseAgreements=" + referencingLicenseAgreements