push addional code
[sdc.git] / openecomp-be / lib / openecomp-sdc-action-lib / openecomp-sdc-action-api / src / main / java / org / openecomp / sdc / action / types / ActionArtifact.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.types;
22
23 import com.fasterxml.jackson.annotation.JsonIgnore;
24 import org.openecomp.sdc.action.dao.types.ActionArtifactEntity;
25
26 import java.nio.ByteBuffer;
27 import java.util.Date;
28
29 public class ActionArtifact {
30   private String artifactUuId;
31
32   @JsonIgnore
33   private Integer effectiveVersion;
34
35   private String artifactName;
36   private String artifactLabel;
37   private String artifactCategory;
38   private String artifactDescription;
39   private String artifactProtection;
40   private Date timestamp;
41   private byte[] artifact;
42
43   public String getArtifactUuId() {
44     return artifactUuId;
45   }
46
47   public void setArtifactUuId(String artifactUuId) {
48     this.artifactUuId = artifactUuId;
49   }
50
51   public Integer getEffectiveVersion() {
52     return effectiveVersion;
53   }
54
55   public void setEffectiveVersion(Integer effectiveVersion) {
56     this.effectiveVersion = effectiveVersion;
57   }
58
59   public String getArtifactName() {
60     return artifactName;
61   }
62
63   public void setArtifactName(String artifactName) {
64     this.artifactName = artifactName;
65   }
66
67   public String getArtifactLabel() {
68     return artifactLabel;
69   }
70
71   public void setArtifactLabel(String artifactLabel) {
72     this.artifactLabel = artifactLabel;
73   }
74
75   public String getArtifactCategory() {
76     return artifactCategory;
77   }
78
79   public void setArtifactCategory(String artifactCategory) {
80     this.artifactCategory = artifactCategory;
81   }
82
83   public String getArtifactDescription() {
84     return artifactDescription;
85   }
86
87   public void setArtifactDescription(String artifactDescription) {
88     this.artifactDescription = artifactDescription;
89   }
90
91   public String getArtifactProtection() {
92     return artifactProtection;
93   }
94
95   public void setArtifactProtection(String artifactProtection) {
96     this.artifactProtection = artifactProtection;
97   }
98
99   public Date getTimestamp() {
100     return timestamp;
101   }
102
103   public void setTimestamp(Date timestamp) {
104     this.timestamp = timestamp;
105   }
106
107   public byte[] getArtifact() {
108     return artifact;
109   }
110
111   public void setArtifact(byte[] artifact) {
112     this.artifact = artifact;
113   }
114
115   /**
116    * To entity action artifact entity.
117    *
118    * @return the action artifact entity
119    */
120   public ActionArtifactEntity toEntity() {
121     ActionArtifactEntity destination = new ActionArtifactEntity();
122     destination.setArtifactUuId(this.getArtifactUuId());
123     destination.setEffectiveVersion(this.getEffectiveVersion());
124     destination.setArtifact(ByteBuffer.wrap(this.getArtifact()));
125
126     return destination;
127   }
128
129   @Override
130   public boolean equals(Object obj) {
131     if (obj instanceof ActionArtifact) {
132       ActionArtifact temp = (ActionArtifact) obj;
133       if (artifactUuId.equals(temp.getArtifactUuId())) {
134         return true;
135       }
136     }
137     return false;
138   }
139 }