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;
28 import org.openecomp.sdc.versioning.dao.types.Version;
29 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
31 import java.util.HashSet;
32 import java.util.Objects;
35 @Table(name = "feature_group", keyspace = "dox")
36 public class FeatureGroupEntity implements VersionableEntity {
37 private static final String ENTITY_TYPE = "Feature Group";
40 @Column(name = "vlm_id")
41 private String vendorLicenseModelId;
42 @PartitionKey(value = 1)
44 private Version version;
46 @Column(name = "fg_id")
49 private String description;
50 @Column(name = "part_num")
51 private String partNumber;
52 @Column(name = "manufacturer_ref_num")
53 private String manufacturerReferenceNumber;
54 @Column(name = "lkg_ids")
55 private Set<String> licenseKeyGroupIds = new HashSet<>();
56 @Column(name = "ep_ids")
57 private Set<String> entitlementPoolIds = new HashSet<>();
58 @Column(name = "ref_la_ids")
59 private Set<String> referencingLicenseAgreements = new HashSet<>();
62 * Every entity class must have a default constructor according to
63 * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
64 * Definition of mapped classes</a>.
66 public FeatureGroupEntity() {
67 // Don't delete! Default constructor is required by DataStax driver
71 * Instantiates a new Feature group entity.
73 * @param vendorLicenseModelId the vendor license model id
74 * @param version the version
77 public FeatureGroupEntity(String vendorLicenseModelId, Version version, String id) {
78 this.vendorLicenseModelId = vendorLicenseModelId;
79 this.version = version;
84 public String getEntityType() {
89 public String getFirstClassCitizenId() {
90 return getVendorLicenseModelId();
94 public String getId() {
99 public void setId(String id) {
104 public Version getVersion() {
109 public void setVersion(Version version) {
110 this.version = version;
113 public String getVendorLicenseModelId() {
114 return vendorLicenseModelId;
117 public void setVendorLicenseModelId(String vendorLicenseModelId) {
118 this.vendorLicenseModelId = vendorLicenseModelId;
121 public String getName() {
125 public void setName(String name) {
129 public String getDescription() {
133 public void setDescription(String description) {
134 this.description = description;
137 public String getPartNumber() {
141 public void setPartNumber(String partNumber) {
142 this.partNumber = partNumber;
145 public String getManufacturerReferenceNumber() {
146 return manufacturerReferenceNumber;
149 public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
150 this.manufacturerReferenceNumber = manufacturerReferenceNumber;
153 public Set<String> getLicenseKeyGroupIds() {
154 return licenseKeyGroupIds;
157 public void setLicenseKeyGroupIds(Set<String> licenseKeyGroupIds) {
158 this.licenseKeyGroupIds = licenseKeyGroupIds;
161 public Set<String> getEntitlementPoolIds() {
162 return entitlementPoolIds;
165 public void setEntitlementPoolIds(Set<String> entitlementPoolIds) {
166 this.entitlementPoolIds = entitlementPoolIds;
169 public Set<String> getReferencingLicenseAgreements() {
170 return referencingLicenseAgreements;
173 public void setReferencingLicenseAgreements(Set<String> referencingLicenseAgreements) {
174 this.referencingLicenseAgreements = referencingLicenseAgreements;
178 public int hashCode() {
180 .hash(vendorLicenseModelId, version, id, name, description, partNumber,
181 manufacturerReferenceNumber, licenseKeyGroupIds, entitlementPoolIds,
182 referencingLicenseAgreements);
186 public boolean equals(Object obj) {
190 if (obj == null || getClass() != obj.getClass()) {
193 FeatureGroupEntity that = (FeatureGroupEntity) obj;
194 return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
195 && Objects.equals(version, that.version)
196 && Objects.equals(id, that.id)
197 && Objects.equals(name, that.name)
198 && Objects.equals(description, that.description)
199 && Objects.equals(partNumber, that.partNumber)
200 && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber)
201 && Objects.equals(licenseKeyGroupIds, that.licenseKeyGroupIds)
202 && Objects.equals(entitlementPoolIds, that.entitlementPoolIds)
203 && Objects.equals(referencingLicenseAgreements, that.referencingLicenseAgreements);
207 public String toString() {
208 return "FeatureGroupEntity{"
209 + "vendorLicenseModelId='" + vendorLicenseModelId + '\''
210 + ", version=" + version
211 + ", id='" + id + '\''
212 + ", name='" + name + '\''
213 + ", description='" + description + '\''
214 + ", partNumber='" + partNumber + '\''
215 + ", manufacturerReferenceNumber='" + manufacturerReferenceNumber + '\''
216 + ", licenseKeyGroupIds=" + licenseKeyGroupIds
217 + ", entitlementPoolIds=" + entitlementPoolIds
218 + ", referencingLicenseAgreements=" + referencingLicenseAgreements