push addional code
[sdc.git] / openecomp-be / lib / openecomp-sdc-vendor-license-lib / openecomp-sdc-vendor-license-api / src / main / java / org / openecomp / sdc / vendorlicense / dao / types / VendorLicenseModelEntity.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.vendorlicense.dao.types;
22
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;
28 import org.openecomp.sdc.versioning.dao.types.Version;
29 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
30
31 import java.util.Objects;
32
33 @Table(keyspace = "dox", name = "vendor_license_model")
34 public class VendorLicenseModelEntity implements VersionableEntity {
35   public static final String ENTITY_TYPE = "Vendor License Model";
36
37   @PartitionKey
38   @Column(name = "vlm_id")
39   private String id;
40
41   @PartitionKey(value = 1)
42   @Frozen
43   private Version version;
44
45   //    @Column(name = "last_modification_time")
46   //    private Date lastModificationTime;
47
48   @Column(name = "vendor_name")
49   private String vendorName;
50   private String description;
51   @Column(name = "icon")
52   private String iconRef;
53
54   @Computed("writetime(vendor_name)")
55   private Long writetimeMicroSeconds;
56
57   public VendorLicenseModelEntity() {
58   }
59
60   public VendorLicenseModelEntity(String id, Version version) {
61     this.id = id;
62     this.version = version;
63   }
64
65   @Override
66   public String getEntityType() {
67     return ENTITY_TYPE;
68   }
69
70   @Override
71   public String getFirstClassCitizenId() {
72     return getId();
73   }
74
75   public String getId() {
76     return id;
77   }
78
79   public void setId(String id) {
80     this.id = id;
81   }
82
83   @Override
84   public Version getVersion() {
85     return version;
86   }
87
88   @Override
89   public void setVersion(Version version) {
90     this.version = version;
91   }
92
93   public String getVendorName() {
94     return vendorName;
95   }
96
97   public void setVendorName(String vendorName) {
98     this.vendorName = vendorName;
99   }
100
101   public String getDescription() {
102     return description;
103   }
104
105   public void setDescription(String description) {
106     this.description = description;
107   }
108
109   public String getIconRef() {
110     return iconRef;
111   }
112
113   public void setIconRef(String iconRef) {
114     this.iconRef = iconRef;
115   }
116
117   @Override
118   public boolean equals(Object obj) {
119     if (this == obj) {
120       return true;
121     }
122     if (obj == null || getClass() != obj.getClass()) {
123       return false;
124     }
125     VendorLicenseModelEntity that = (VendorLicenseModelEntity) obj;
126     return Objects.equals(id, that.id)
127         && Objects.equals(version, that.version)
128         && Objects.equals(vendorName, that.vendorName)
129         && Objects.equals(description, that.description)
130         && Objects.equals(iconRef, that.iconRef);
131   }
132
133   @Override
134   public int hashCode() {
135     return Objects.hash(id, version, vendorName, description, iconRef);
136   }
137
138   //    public Date getLastModificationTime() {
139   //        return lastModificationTime;
140   //    }
141   //
142   //    public void setLastModificationTime(Date lastModificationTime) {
143   //        this.lastModificationTime = lastModificationTime;
144   //    }
145
146   public Long getWritetimeMicroSeconds() {
147     return writetimeMicroSeconds;
148   }
149
150   public void setWritetimeMicroSeconds(Long writetimeMicroSeconds) {
151     this.writetimeMicroSeconds = writetimeMicroSeconds;
152   }
153 }