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<>();
 
  61   public FeatureGroupEntity() {
 
  65    * Instantiates a new Feature group entity.
 
  67    * @param vendorLicenseModelId the vendor license model id
 
  68    * @param version              the version
 
  71   public FeatureGroupEntity(String vendorLicenseModelId, Version version, String id) {
 
  72     this.vendorLicenseModelId = vendorLicenseModelId;
 
  73     this.version = version;
 
  78   public String getEntityType() {
 
  83   public String getFirstClassCitizenId() {
 
  84     return getVendorLicenseModelId();
 
  88   public String getId() {
 
  93   public void setId(String id) {
 
  98   public Version getVersion() {
 
 103   public void setVersion(Version version) {
 
 104     this.version = version;
 
 107   public String getVendorLicenseModelId() {
 
 108     return vendorLicenseModelId;
 
 111   public void setVendorLicenseModelId(String vendorLicenseModelId) {
 
 112     this.vendorLicenseModelId = vendorLicenseModelId;
 
 115   public String getName() {
 
 119   public void setName(String name) {
 
 123   public String getDescription() {
 
 127   public void setDescription(String description) {
 
 128     this.description = description;
 
 131   public String getPartNumber() {
 
 135   public void setPartNumber(String partNumber) {
 
 136     this.partNumber = partNumber;
 
 139   public String getManufacturerReferenceNumber() {
 
 140     return manufacturerReferenceNumber;
 
 143   public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
 
 144     this.manufacturerReferenceNumber = manufacturerReferenceNumber;
 
 147   public Set<String> getLicenseKeyGroupIds() {
 
 148     return licenseKeyGroupIds;
 
 151   public void setLicenseKeyGroupIds(Set<String> licenseKeyGroupIds) {
 
 152     this.licenseKeyGroupIds = licenseKeyGroupIds;
 
 155   public Set<String> getEntitlementPoolIds() {
 
 156     return entitlementPoolIds;
 
 159   public void setEntitlementPoolIds(Set<String> entitlementPoolIds) {
 
 160     this.entitlementPoolIds = entitlementPoolIds;
 
 163   public Set<String> getReferencingLicenseAgreements() {
 
 164     return referencingLicenseAgreements;
 
 167   public void setReferencingLicenseAgreements(Set<String> referencingLicenseAgreements) {
 
 168     this.referencingLicenseAgreements = referencingLicenseAgreements;
 
 172   public int hashCode() {
 
 174         .hash(vendorLicenseModelId, version, id, name, description, partNumber,
 
 175         manufacturerReferenceNumber, licenseKeyGroupIds, entitlementPoolIds,
 
 176             referencingLicenseAgreements);
 
 180   public boolean equals(Object obj) {
 
 184     if (obj == null || getClass() != obj.getClass()) {
 
 187     FeatureGroupEntity that = (FeatureGroupEntity) obj;
 
 188     return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
 
 189         && Objects.equals(version, that.version)
 
 190         && Objects.equals(id, that.id)
 
 191         && Objects.equals(name, that.name)
 
 192         && Objects.equals(description, that.description)
 
 193         && Objects.equals(partNumber, that.partNumber)
 
 194         && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber)
 
 195         && Objects.equals(licenseKeyGroupIds, that.licenseKeyGroupIds)
 
 196         && Objects.equals(entitlementPoolIds, that.entitlementPoolIds)
 
 197         && Objects.equals(referencingLicenseAgreements, that.referencingLicenseAgreements);
 
 201   public String toString() {
 
 202     return "FeatureGroupEntity{"
 
 203         + "vendorLicenseModelId='" + vendorLicenseModelId + '\''
 
 204         + ", version=" + version
 
 205         + ", id='" + id + '\''
 
 206         + ", name='" + name + '\''
 
 207         + ", description='" + description + '\''
 
 208         + ", partNumber='" + partNumber + '\''
 
 209         + ", manufacturerReferenceNumber='" + manufacturerReferenceNumber + '\''
 
 210         + ", licenseKeyGroupIds=" + licenseKeyGroupIds
 
 211         + ", entitlementPoolIds=" + entitlementPoolIds
 
 212         + ", referencingLicenseAgreements=" + referencingLicenseAgreements