fd56b7b50b35eb692c39d6ec937bacd991c27d02
[sdc.git] /
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.Frozen;
26 import com.datastax.driver.mapping.annotations.FrozenValue;
27 import com.datastax.driver.mapping.annotations.PartitionKey;
28 import com.datastax.driver.mapping.annotations.Table;
29
30 import java.util.HashSet;
31 import java.util.Set;
32
33 @Table(keyspace = "dox", name = "version_info_deleted")
34 public class VersionInfoDeletedEntity {
35
36   @PartitionKey
37   @Column(name = "entity_type")
38   private String entityType;
39
40   @ClusteringColumn
41   @Column(name = "entity_id")
42   private String entityId;
43
44   @Column(name = "active_version")
45   @Frozen
46   private Version activeVersion;
47
48   private VersionStatus status;
49
50   @Frozen
51   private UserCandidateVersion candidate;
52
53   @Column(name = "viewable_versions")
54   @FrozenValue
55   private Set<Version> viewableVersions = new HashSet<>();
56
57   @Column(name = "latest_final_version")
58   @Frozen
59   private Version latestFinalVersion;
60
61   /**
62    * Every entity class must have a default constructor according to
63    * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
64    * Definition of mapped classes</a>.
65    */
66   public VersionInfoDeletedEntity() {
67     // Don't delete! Default constructor is required by DataStax driver
68   }
69
70   public VersionInfoDeletedEntity(String entityType, String entityId) {
71     this.entityType = entityType;
72     this.entityId = entityId;
73   }
74
75   public String getEntityType() {
76     return entityType;
77   }
78
79   public void setEntityType(String entityType) {
80     this.entityType = entityType;
81   }
82
83   public String getEntityId() {
84     return entityId;
85   }
86
87   public void setEntityId(String entityId) {
88     this.entityId = entityId;
89   }
90
91   public Version getActiveVersion() {
92     return activeVersion;
93   }
94
95   public void setActiveVersion(Version activeVersion) {
96     this.activeVersion = activeVersion;
97   }
98
99   public VersionStatus getStatus() {
100     return status;
101   }
102
103   public void setStatus(VersionStatus status) {
104     this.status = status;
105   }
106
107   public UserCandidateVersion getCandidate() {
108     return candidate;
109   }
110
111   public void setCandidate(UserCandidateVersion candidate) {
112     this.candidate = candidate;
113   }
114
115   public Set<Version> getViewableVersions() {
116     return viewableVersions;
117   }
118
119   public void setViewableVersions(Set<Version> viewableVersions) {
120     this.viewableVersions = viewableVersions;
121   }
122
123   public Version getLatestFinalVersion() {
124     return latestFinalVersion;
125   }
126
127   public void setLatestFinalVersion(Version latestFinalVersion) {
128     this.latestFinalVersion = latestFinalVersion;
129   }
130 }