320c8838f08c532ca67a9f9c9c7b3bdc8a8c0539
[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.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_deleted")
35 public class VersionInfoDeletedEntity {
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   /**
64    * Every entity class must have a default constructor according to
65    * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
66    * Definition of mapped classes</a>.
67    */
68   public VersionInfoDeletedEntity() {
69     // Don't delete! Default constructor is required by DataStax driver
70   }
71
72   public VersionInfoDeletedEntity(String entityType, String entityId) {
73     this.entityType = entityType;
74     this.entityId = entityId;
75   }
76
77   public String getEntityType() {
78     return entityType;
79   }
80
81   public void setEntityType(String entityType) {
82     this.entityType = entityType;
83   }
84
85   public String getEntityId() {
86     return entityId;
87   }
88
89   public void setEntityId(String entityId) {
90     this.entityId = entityId;
91   }
92
93   public Version getActiveVersion() {
94     return activeVersion;
95   }
96
97   public void setActiveVersion(Version activeVersion) {
98     this.activeVersion = activeVersion;
99   }
100
101   public VersionStatus getStatus() {
102     return status;
103   }
104
105   public void setStatus(VersionStatus status) {
106     this.status = status;
107   }
108
109   public UserCandidateVersion getCandidate() {
110     return candidate;
111   }
112
113   public void setCandidate(UserCandidateVersion candidate) {
114     this.candidate = candidate;
115   }
116
117   public Set<Version> getViewableVersions() {
118     return viewableVersions;
119   }
120
121   public void setViewableVersions(Set<Version> viewableVersions) {
122     this.viewableVersions = viewableVersions;
123   }
124
125   public Version getLatestFinalVersion() {
126     return latestFinalVersion;
127   }
128
129   public void setLatestFinalVersion(Version latestFinalVersion) {
130     this.latestFinalVersion = latestFinalVersion;
131   }
132 }