push addional code
[sdc.git] / openecomp-be / lib / openecomp-sdc-versioning-lib / openecomp-sdc-versioning-api / src / main / java / org / openecomp / sdc / versioning / dao / types / VersionInfoEntity.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.versioning.dao.types;
22
23 import com.datastax.driver.mapping.annotations.ClusteringColumn;
24 import com.datastax.driver.mapping.annotations.Column;
25 import com.datastax.driver.mapping.annotations.Enumerated;
26 import com.datastax.driver.mapping.annotations.Frozen;
27 import com.datastax.driver.mapping.annotations.FrozenValue;
28 import com.datastax.driver.mapping.annotations.PartitionKey;
29 import com.datastax.driver.mapping.annotations.Table;
30
31 import java.util.HashSet;
32 import java.util.Set;
33
34 @Table(keyspace = "dox", name = "version_info")
35 public class VersionInfoEntity {
36
37   @PartitionKey
38   @Column(name = "entity_type")
39   private String entityType;
40
41   @ClusteringColumn
42   @Column(name = "entity_id")
43   private String entityId;
44
45   @Column(name = "active_version")
46   @Frozen
47   private Version activeVersion;
48
49   @Enumerated
50   private VersionStatus status;
51
52   @Frozen
53   private UserCandidateVersion candidate;
54
55   @Column(name = "viewable_versions")
56   @FrozenValue
57   private Set<Version> viewableVersions = new HashSet<>();
58
59   @Column(name = "latest_final_version")
60   @Frozen
61   private Version latestFinalVersion;
62
63   public VersionInfoEntity() {
64   }
65
66   public VersionInfoEntity(String entityType, String entityId) {
67     this.entityType = entityType;
68     this.entityId = entityId;
69   }
70
71   public String getEntityType() {
72     return entityType;
73   }
74
75   public void setEntityType(String entityType) {
76     this.entityType = entityType;
77   }
78
79   public String getEntityId() {
80     return entityId;
81   }
82
83   public void setEntityId(String entityId) {
84     this.entityId = entityId;
85   }
86
87   public Version getActiveVersion() {
88     return activeVersion;
89   }
90
91   public void setActiveVersion(Version activeVersion) {
92     this.activeVersion = activeVersion;
93   }
94
95   public VersionStatus getStatus() {
96     return status;
97   }
98
99   public void setStatus(VersionStatus status) {
100     this.status = status;
101   }
102
103   public UserCandidateVersion getCandidate() {
104     return candidate;
105   }
106
107   public void setCandidate(UserCandidateVersion candidate) {
108     this.candidate = candidate;
109   }
110
111   public Set<Version> getViewableVersions() {
112     return viewableVersions;
113   }
114
115   public void setViewableVersions(Set<Version> viewableVersions) {
116     this.viewableVersions = viewableVersions;
117   }
118
119   public Version getLatestFinalVersion() {
120     return latestFinalVersion;
121   }
122
123   public void setLatestFinalVersion(Version latestFinalVersion) {
124     this.latestFinalVersion = latestFinalVersion;
125   }
126 }