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<>();
64 * Every entity class must have a default constructor according to
65 * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
66 * Definition of mapped classes</a>.
68 public LicenseAgreementEntity() {
69 // Don't delete! Default constructor is required by DataStax driver
73 * Instantiates a new License agreement entity.
75 * @param vlmId the vlm id
76 * @param version the version
79 public LicenseAgreementEntity(String vlmId, Version version, String id) {
80 this.vendorLicenseModelId = vlmId;
82 this.version = version;
86 public String getEntityType() {
91 public String getFirstClassCitizenId() {
92 return getVendorLicenseModelId();
96 public String getId() {
101 public void setId(String id) {
106 public Version getVersion() {
111 public void setVersion(Version version) {
112 this.version = version;
115 public String getVendorLicenseModelId() {
116 return vendorLicenseModelId;
119 public void setVendorLicenseModelId(String vendorLicenseModelId) {
120 this.vendorLicenseModelId = vendorLicenseModelId;
123 public String getName() {
127 public void setName(String name) {
131 public String getDescription() {
135 public void setDescription(String description) {
136 this.description = description;
139 public ChoiceOrOther<LicenseTerm> getLicenseTerm() {
143 public void setLicenseTerm(ChoiceOrOther<LicenseTerm> licenseTerm) {
144 licenseTerm.resolveEnum(LicenseTerm.class);
145 this.licenseTerm = licenseTerm;
148 public String getRequirementsAndConstrains() {
149 return requirementsAndConstrains;
152 public void setRequirementsAndConstrains(String requirementsAndConstrains) {
153 this.requirementsAndConstrains = requirementsAndConstrains;
156 public Set<String> getFeatureGroupIds() {
157 return featureGroupIds;
160 public void setFeatureGroupIds(Set<String> featureGroupIds) {
161 this.featureGroupIds = featureGroupIds;
165 public int hashCode() {
166 return Objects.hash(vendorLicenseModelId, version, id, name, description, licenseTerm,
167 requirementsAndConstrains, featureGroupIds);
171 public boolean equals(Object obj) {
175 if (obj == null || getClass() != obj.getClass()) {
178 LicenseAgreementEntity that = (LicenseAgreementEntity) obj;
179 return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
180 && Objects.equals(version, that.version)
181 && Objects.equals(id, that.id)
182 && Objects.equals(name, that.name)
183 && Objects.equals(description, that.description)
184 && Objects.equals(licenseTerm, that.licenseTerm)
185 && Objects.equals(requirementsAndConstrains, that.requirementsAndConstrains)
186 && Objects.equals(featureGroupIds, that.featureGroupIds);