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