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 = "lkg_ids")
53 private Set<String> licenseKeyGroupIds = new HashSet<>();
54 @Column(name = "ep_ids")
55 private Set<String> entitlementPoolIds = new HashSet<>();
56 @Column(name = "ref_la_ids")
57 private Set<String> referencingLicenseAgreements = new HashSet<>();
59 public FeatureGroupEntity() {
63 * Instantiates a new Feature group entity.
65 * @param vendorLicenseModelId the vendor license model id
66 * @param version the version
69 public FeatureGroupEntity(String vendorLicenseModelId, Version version, String id) {
70 this.vendorLicenseModelId = vendorLicenseModelId;
71 this.version = version;
76 public String getEntityType() {
81 public String getFirstClassCitizenId() {
82 return getVendorLicenseModelId();
86 public String getId() {
91 public void setId(String id) {
96 public Version getVersion() {
101 public void setVersion(Version version) {
102 this.version = version;
105 public String getVendorLicenseModelId() {
106 return vendorLicenseModelId;
109 public void setVendorLicenseModelId(String vendorLicenseModelId) {
110 this.vendorLicenseModelId = vendorLicenseModelId;
113 public String getName() {
117 public void setName(String name) {
121 public String getDescription() {
125 public void setDescription(String description) {
126 this.description = description;
129 public String getPartNumber() {
133 public void setPartNumber(String partNumber) {
134 this.partNumber = partNumber;
137 public Set<String> getLicenseKeyGroupIds() {
138 return licenseKeyGroupIds;
141 public void setLicenseKeyGroupIds(Set<String> licenseKeyGroupIds) {
142 this.licenseKeyGroupIds = licenseKeyGroupIds;
145 public Set<String> getEntitlementPoolIds() {
146 return entitlementPoolIds;
149 public void setEntitlementPoolIds(Set<String> entitlementPoolIds) {
150 this.entitlementPoolIds = entitlementPoolIds;
153 public Set<String> getReferencingLicenseAgreements() {
154 return referencingLicenseAgreements;
157 public void setReferencingLicenseAgreements(Set<String> referencingLicenseAgreements) {
158 this.referencingLicenseAgreements = referencingLicenseAgreements;
162 public int hashCode() {
164 .hash(vendorLicenseModelId, version, id, name, description, partNumber, licenseKeyGroupIds,
165 entitlementPoolIds, referencingLicenseAgreements);
169 public boolean equals(Object obj) {
173 if (obj == null || getClass() != obj.getClass()) {
176 FeatureGroupEntity that = (FeatureGroupEntity) obj;
177 return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
178 && Objects.equals(version, that.version)
179 && Objects.equals(id, that.id)
180 && Objects.equals(name, that.name)
181 && Objects.equals(description, that.description)
182 && Objects.equals(partNumber, that.partNumber)
183 && Objects.equals(licenseKeyGroupIds, that.licenseKeyGroupIds)
184 && Objects.equals(entitlementPoolIds, that.entitlementPoolIds)
185 && Objects.equals(referencingLicenseAgreements, that.referencingLicenseAgreements);
189 public String toString() {
190 return "FeatureGroupEntity{"
191 + "vendorLicenseModelId='" + vendorLicenseModelId + '\''
192 + ", version=" + version
193 + ", id='" + id + '\''
194 + ", name='" + name + '\''
195 + ", description='" + description + '\''
196 + ", partNumber='" + partNumber + '\''
197 + ", licenseKeyGroupIds=" + licenseKeyGroupIds
198 + ", entitlementPoolIds=" + entitlementPoolIds
199 + ", referencingLicenseAgreements=" + referencingLicenseAgreements