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();
89 public String getVendorLicenseModelId() {
90 return vendorLicenseModelId;
93 public void setVendorLicenseModelId(String vendorLicenseModelId) {
94 this.vendorLicenseModelId = vendorLicenseModelId;
98 public Version getVersion() {
103 public void setVersion(Version version) {
104 this.version = version;
108 public String getId() {
113 public void setId(String id) {
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 boolean equals(Object obj) {
163 if (obj == null || getClass() != obj.getClass()) {
166 LicenseAgreementEntity that = (LicenseAgreementEntity) obj;
167 return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
168 && Objects.equals(version, that.version)
169 && Objects.equals(id, that.id)
170 && Objects.equals(name, that.name)
171 && Objects.equals(description, that.description)
172 && Objects.equals(licenseTerm, that.licenseTerm)
173 && Objects.equals(requirementsAndConstrains, that.requirementsAndConstrains)
174 && Objects.equals(featureGroupIds, that.featureGroupIds);
178 public int hashCode() {
179 return Objects.hash(vendorLicenseModelId, version, id, name, description, licenseTerm,
180 requirementsAndConstrains, featureGroupIds);