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(keyspace = "dox", name = "license_agreement")
 
  36 public class LicenseAgreementEntity implements VersionableEntity {
 
  37   public static final String ENTITY_TYPE = "License Agreement";
 
  39   @PartitionKey(value = 0)
 
  40   @Column(name = "vlm_id")
 
  41   private String vendorLicenseModelId;
 
  43   @PartitionKey(value = 1)
 
  45   private Version version;
 
  48   @Column(name = "la_id")
 
  51   private String description;
 
  53   @Column(name = "lic_term")
 
  55   private ChoiceOrOther<LicenseTerm> licenseTerm;
 
  57   @Column(name = "req_const")
 
  58   private String requirementsAndConstrains;
 
  60   @Column(name = "fg_ids")
 
  61   private Set<String> featureGroupIds = new HashSet<>();
 
  63   public LicenseAgreementEntity() {
 
  67    * Instantiates a new License agreement entity.
 
  69    * @param vlmId   the vlm id
 
  70    * @param version the version
 
  73   public LicenseAgreementEntity(String vlmId, Version version, String id) {
 
  74     this.vendorLicenseModelId = vlmId;
 
  76     this.version = version;
 
  80   public String getEntityType() {
 
  85   public String getFirstClassCitizenId() {
 
  86     return getVendorLicenseModelId();
 
  90   public String getId() {
 
  95   public void setId(String id) {
 
 100   public Version getVersion() {
 
 105   public void setVersion(Version version) {
 
 106     this.version = version;
 
 109   public String getVendorLicenseModelId() {
 
 110     return vendorLicenseModelId;
 
 113   public void setVendorLicenseModelId(String vendorLicenseModelId) {
 
 114     this.vendorLicenseModelId = vendorLicenseModelId;
 
 117   public String getName() {
 
 121   public void setName(String name) {
 
 125   public String getDescription() {
 
 129   public void setDescription(String description) {
 
 130     this.description = description;
 
 133   public ChoiceOrOther<LicenseTerm> getLicenseTerm() {
 
 137   public void setLicenseTerm(ChoiceOrOther<LicenseTerm> licenseTerm) {
 
 138     licenseTerm.resolveEnum(LicenseTerm.class);
 
 139     this.licenseTerm = licenseTerm;
 
 142   public String getRequirementsAndConstrains() {
 
 143     return requirementsAndConstrains;
 
 146   public void setRequirementsAndConstrains(String requirementsAndConstrains) {
 
 147     this.requirementsAndConstrains = requirementsAndConstrains;
 
 150   public Set<String> getFeatureGroupIds() {
 
 151     return featureGroupIds;
 
 154   public void setFeatureGroupIds(Set<String> featureGroupIds) {
 
 155     this.featureGroupIds = featureGroupIds;
 
 159   public int hashCode() {
 
 160     return Objects.hash(vendorLicenseModelId, version, id, name, description, licenseTerm,
 
 161         requirementsAndConstrains, featureGroupIds);
 
 165   public boolean equals(Object obj) {
 
 169     if (obj == null || getClass() != obj.getClass()) {
 
 172     LicenseAgreementEntity that = (LicenseAgreementEntity) obj;
 
 173     return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
 
 174         && Objects.equals(version, that.version)
 
 175         && Objects.equals(id, that.id)
 
 176         && Objects.equals(name, that.name)
 
 177         && Objects.equals(description, that.description)
 
 178         && Objects.equals(licenseTerm, that.licenseTerm)
 
 179         && Objects.equals(requirementsAndConstrains, that.requirementsAndConstrains)
 
 180         && Objects.equals(featureGroupIds, that.featureGroupIds);