e342e0b3bf606eef9158c8c73ce0a83f9e316d1f
[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.vendorsoftwareproduct.dao.type;
22
23 import com.datastax.driver.mapping.annotations.Column;
24 import com.datastax.driver.mapping.annotations.Frozen;
25 import com.datastax.driver.mapping.annotations.PartitionKey;
26 import com.datastax.driver.mapping.annotations.Table;
27 import org.openecomp.sdc.versioning.dao.types.Version;
28 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
29
30 import java.nio.ByteBuffer;
31
32 @Table(keyspace = "dox", name = "vsp_orchestration_template_candidate")
33 public class OrchestrationTemplateCandidateDataEntity implements VersionableEntity {
34   private static final String ENTITY_TYPE =
35       "Vendor Software Product Upload Orchestration_candidate data";
36
37   @PartitionKey
38   @Column(name = "vsp_id")
39   private String id;
40
41   @PartitionKey(value = 1)
42   @Frozen
43   private Version version;
44
45   @Column(name = "content_data")
46   private ByteBuffer contentData;
47
48   @Column(name = "files_data_structure")
49   private String filesDataStructure;
50
51   /**
52    * Every entity class must have a default constructor according to
53    * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
54    * Definition of mapped classes</a>.
55    */
56   public OrchestrationTemplateCandidateDataEntity() {
57     // Don't delete! Default constructor is required by DataStax driver
58   }
59
60   /**
61    * Instantiates a new OrchestrationTemplateCandidateDataEntity.
62    *
63    * @param id       the id
64    * @param version     the Version
65
66    */
67   public OrchestrationTemplateCandidateDataEntity(String id, Version version) {
68     this.id = id;
69     this.version = version;
70   }
71
72   /**
73    * Instantiates a new OrchestrationTemplateCandidateDataEntity.
74    *
75    * @param filesDataStructure       the files data Structure
76    * @param version     the version
77    * @param contentData the contentData
78    * @param id          the id
79    */
80   public OrchestrationTemplateCandidateDataEntity(String id, Version version,
81                                                   ByteBuffer contentData,
82                                                   String filesDataStructure) {
83     this.id = id;
84     this.contentData = contentData;
85     this.filesDataStructure = filesDataStructure;
86     this.version = version;
87   }
88
89   @Override
90   public String getEntityType() {
91     return ENTITY_TYPE;
92   }
93
94   @Override
95   public String getFirstClassCitizenId() {
96     return null;
97   }
98
99   public String getId() {
100     return id;
101   }
102
103   public void setId(String id) {
104     this.id = id;
105   }
106
107   @Override
108   public Version getVersion() {
109     return version;
110   }
111
112   @Override
113   public void setVersion(Version version) {
114     this.version = version;
115   }
116
117   public ByteBuffer getContentData() {
118     return contentData;
119   }
120
121   public void setContentData(ByteBuffer contentData) {
122     this.contentData = contentData;
123   }
124
125   public String getFilesDataStructure() {
126     return filesDataStructure;
127   }
128
129   public void setFilesDataStructure(String filesDataStructure) {
130     this.filesDataStructure = filesDataStructure;
131   }
132 }