2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.action.dao.types;
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;
28 import java.nio.ByteBuffer;
30 @Table(keyspace = "dox", name = "action_artifact")
31 public class ActionArtifactEntity {
34 @Column(name = "artifactuuid")
35 private String artifactUuId;
37 @PartitionKey(value = 1)
38 @Column(name = "effective_version")
39 private int effectiveVersion;
41 @Column(name = "artifact")
42 private ByteBuffer artifact;
45 * Every entity class must have a default constructor according to
46 * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
47 * Definition of mapped classes</a>.
49 public ActionArtifactEntity() {
50 // Don't delete! Default constructor is required by DataStax driver
53 public ActionArtifactEntity(String artifactUuId, int effectiveVersion) {
54 this.artifactUuId = artifactUuId;
55 this.effectiveVersion = effectiveVersion;
58 public String getArtifactUuId() {
62 public void setArtifactUuId(String artifactUuId) {
63 this.artifactUuId = artifactUuId;
66 public int getEffectiveVersion() {
67 return effectiveVersion;
70 public void setEffectiveVersion(int effectiveVersion) {
71 this.effectiveVersion = effectiveVersion;
74 public ByteBuffer getArtifact() {
78 public void setArtifact(ByteBuffer artifact) {
79 this.artifact = artifact;
83 * To dto action artifact.
85 * @return the action artifact
87 public ActionArtifact toDto() {
88 ActionArtifact destination = new ActionArtifact();
89 destination.setArtifactUuId(this.getArtifactUuId());
90 destination.setEffectiveVersion(this.getEffectiveVersion());
91 destination.setArtifact(this.getArtifact().array());