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;
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 = "lkg_ids")
54 private Set<String> licenseKeyGroupIds = new HashSet<>();
55 @Column(name = "ep_ids")
56 private Set<String> entitlementPoolIds = new HashSet<>();
57 @Column(name = "ref_la_ids")
58 private Set<String> referencingLicenseAgreements = new HashSet<>();
60 public FeatureGroupEntity() {
64 * Instantiates a new Feature group entity.
66 * @param vendorLicenseModelId the vendor license model id
67 * @param version the version
70 public FeatureGroupEntity(String vendorLicenseModelId, Version version, String id) {
71 this.vendorLicenseModelId = vendorLicenseModelId;
72 this.version = version;
77 public String getEntityType() {
82 public String getFirstClassCitizenId() {
83 return getVendorLicenseModelId();
86 public String getVendorLicenseModelId() {
87 return vendorLicenseModelId;
90 public void setVendorLicenseModelId(String vendorLicenseModelId) {
91 this.vendorLicenseModelId = vendorLicenseModelId;
95 public Version getVersion() {
100 public void setVersion(Version version) {
101 this.version = version;
105 public String getId() {
110 public void setId(String id) {
114 public String getName() {
118 public void setName(String name) {
122 public String getDescription() {
126 public void setDescription(String description) {
127 this.description = description;
130 public String getPartNumber() {
134 public void setPartNumber(String partNumber) {
135 this.partNumber = partNumber;
138 public Set<String> getLicenseKeyGroupIds() {
139 return licenseKeyGroupIds;
142 public void setLicenseKeyGroupIds(Set<String> licenseKeyGroupIds) {
143 this.licenseKeyGroupIds = licenseKeyGroupIds;
146 public Set<String> getEntitlementPoolIds() {
147 return entitlementPoolIds;
150 public void setEntitlementPoolIds(Set<String> entitlementPoolIds) {
151 this.entitlementPoolIds = entitlementPoolIds;
154 public Set<String> getReferencingLicenseAgreements() {
155 return referencingLicenseAgreements;
158 public void setReferencingLicenseAgreements(Set<String> referencingLicenseAgreements) {
159 this.referencingLicenseAgreements = referencingLicenseAgreements;
163 public String toString() {
164 return "FeatureGroupEntity{"
165 + "vendorLicenseModelId='" + vendorLicenseModelId + '\''
166 + ", version=" + version
167 + ", id='" + id + '\''
168 + ", name='" + name + '\''
169 + ", description='" + description + '\''
170 + ", partNumber='" + partNumber + '\''
171 + ", licenseKeyGroupIds=" + licenseKeyGroupIds
172 + ", entitlementPoolIds=" + entitlementPoolIds
173 + ", referencingLicenseAgreements=" + referencingLicenseAgreements
178 public boolean equals(Object obj) {
182 if (obj == null || getClass() != obj.getClass()) {
185 FeatureGroupEntity that = (FeatureGroupEntity) obj;
186 return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
187 && Objects.equals(version, that.version)
188 && Objects.equals(id, that.id)
189 && Objects.equals(name, that.name)
190 && Objects.equals(description, that.description)
191 && Objects.equals(partNumber, that.partNumber)
192 && Objects.equals(licenseKeyGroupIds, that.licenseKeyGroupIds)
193 && Objects.equals(entitlementPoolIds, that.entitlementPoolIds)
194 && Objects.equals(referencingLicenseAgreements, that.referencingLicenseAgreements);
198 public int hashCode() {
200 .hash(vendorLicenseModelId, version, id, name, description, partNumber, licenseKeyGroupIds,
201 entitlementPoolIds, referencingLicenseAgreements);