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.Column;
24 import com.datastax.driver.mapping.annotations.Computed;
25 import com.datastax.driver.mapping.annotations.Frozen;
26 import com.datastax.driver.mapping.annotations.PartitionKey;
27 import com.datastax.driver.mapping.annotations.Table;
30 import org.openecomp.sdc.versioning.dao.types.Version;
31 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
33 import java.util.Objects;
35 @Table(keyspace = "dox", name = "vendor_license_model")
36 public class VendorLicenseModelEntity implements VersionableEntity {
37 public static final String ENTITY_TYPE = "Vendor License Model";
40 @Column(name = "vlm_id")
43 @PartitionKey(value = 1)
45 private Version version;
47 @Column(name = "vendor_name")
48 private String vendorName;
49 private String description;
50 private String oldVersion;
51 @Column(name = "icon")
52 private String iconRef;
54 @Computed("writetime(vendor_name)")
55 private Long writetimeMicroSeconds;
58 * Every entity class must have a default constructor according to
59 * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
60 * Definition of mapped classes</a>.
62 public VendorLicenseModelEntity() {
63 // Don't delete! Default constructor is required by DataStax driver
66 public VendorLicenseModelEntity(String id, Version version) {
68 this.version = version;
72 public String getEntityType() {
77 public String getFirstClassCitizenId() {
81 public String getId() {
85 public void setId(String id) {
90 public Version getVersion() {
95 public void setVersion(Version version) {
96 this.version = version;
99 public String getVendorName() {
103 public void setVendorName(String vendorName) {
104 this.vendorName = vendorName;
107 public String getDescription() {
111 public void setDescription(String description) {
112 this.description = description;
115 public String getIconRef() {
119 public void setIconRef(String iconRef) {
120 this.iconRef = iconRef;
123 public void setOldVersion(String oldVersion) {
124 this.oldVersion = oldVersion;
127 public String getOldVersion() {
133 public int hashCode() {
134 return Objects.hash(id, version, vendorName, description, iconRef);
138 public boolean equals(Object obj) {
142 if (obj == null || getClass() != obj.getClass()) {
145 VendorLicenseModelEntity that = (VendorLicenseModelEntity) obj;
146 return Objects.equals(id, that.id)
147 && Objects.equals(version, that.version)
148 && Objects.equals(vendorName, that.vendorName)
149 && Objects.equals(description, that.description)
150 && Objects.equals(iconRef, that.iconRef);