push addional code
[sdc.git] / openecomp-be / lib / openecomp-sdc-action-lib / openecomp-sdc-action-api / src / main / java / org / openecomp / sdc / action / dao / types / ActionArtifactEntity.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.action.dao.types;
22
23 import com.datastax.driver.mapping.annotations.Column;
24 import com.datastax.driver.mapping.annotations.PartitionKey;
25 import com.datastax.driver.mapping.annotations.Table;
26 import org.openecomp.sdc.action.types.ActionArtifact;
27
28 import java.nio.ByteBuffer;
29
30 @Table(keyspace = "dox", name = "action_artifact")
31 public class ActionArtifactEntity {
32
33   @PartitionKey
34   @Column(name = "artifactuuid")
35   private String artifactUuId;
36
37   @PartitionKey(value = 1)
38   @Column(name = "effective_version")
39   private int effectiveVersion;
40
41   @Column(name = "artifact")
42   private ByteBuffer artifact;
43
44   public ActionArtifactEntity() {
45     //Default constructor implementation
46   }
47
48   public ActionArtifactEntity(String artifactUuId, int effectiveVersion) {
49     this.artifactUuId = artifactUuId;
50     this.effectiveVersion = effectiveVersion;
51   }
52
53   public String getArtifactUuId() {
54     return artifactUuId;
55   }
56
57   public void setArtifactUuId(String artifactUuId) {
58     this.artifactUuId = artifactUuId;
59   }
60
61   public int getEffectiveVersion() {
62     return effectiveVersion;
63   }
64
65   public void setEffectiveVersion(int effectiveVersion) {
66     this.effectiveVersion = effectiveVersion;
67   }
68
69   public ByteBuffer getArtifact() {
70     return artifact;
71   }
72
73   public void setArtifact(ByteBuffer artifact) {
74     this.artifact = artifact;
75   }
76
77   /**
78    * To dto action artifact.
79    *
80    * @return the action artifact
81    */
82   public ActionArtifact toDto() {
83     ActionArtifact destination = new ActionArtifact();
84     destination.setArtifactUuId(this.getArtifactUuId());
85     destination.setEffectiveVersion(this.getEffectiveVersion());
86     destination.setArtifact(this.getArtifact().array());
87     return destination;
88   }
89 }