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.vendorsoftwareproduct.dao.type;
23 import com.datastax.driver.mapping.annotations.ClusteringColumn;
24 import com.datastax.driver.mapping.annotations.Column;
25 import com.datastax.driver.mapping.annotations.Enumerated;
26 import com.datastax.driver.mapping.annotations.Frozen;
27 import com.datastax.driver.mapping.annotations.PartitionKey;
28 import com.datastax.driver.mapping.annotations.Table;
29 import org.openecomp.sdc.versioning.dao.types.Version;
30 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
32 import java.nio.ByteBuffer;
34 @Table(keyspace = "dox", name = "vsp_process")
35 public class ProcessEntity implements VersionableEntity {
36 public static final String ENTITY_TYPE = "Vendor Software Product Process";
38 @Column(name = "vsp_id")
40 @PartitionKey(value = 1)
42 private Version version;
44 @Column(name = "component_id")
45 private String componentId;
46 @ClusteringColumn(value = 1)
47 @Column(name = "process_id")
50 private String description;
51 @Column(name = "type")
53 private ProcessType type;
54 @Column(name = "artifact_name")
55 private String artifactName;
56 private ByteBuffer artifact;
58 public ProcessEntity() {
63 * Instantiates a new Process entity.
65 * @param vspId the vsp id
66 * @param version the version
67 * @param componentId the component id
70 public ProcessEntity(String vspId, Version version, String componentId, String id) {
72 this.version = version;
73 this.componentId = componentId;
77 public String getVspId() {
81 public void setVspId(String vspId) {
85 public String getComponentId() {
89 public void setComponentId(String componentId) {
90 this.componentId = componentId;
94 public String getEntityType() {
99 public String getFirstClassCitizenId() {
103 public String getId() {
107 public void setId(String id) {
111 public Version getVersion() {
115 public void setVersion(Version version) {
116 this.version = version;
119 public String getName() {
120 return name == null ? "" : name;
123 public void setName(String name) {
127 public String getDescription() {
131 public void setDescription(String description) {
132 this.description = description;
135 public ProcessType getType() {
139 public void setType(ProcessType type) {
143 public String getArtifactName() {
147 public void setArtifactName(String artifactName) {
148 this.artifactName = artifactName;
151 public ByteBuffer getArtifact() {
155 public void setArtifact(ByteBuffer artifact) {
156 this.artifact = artifact;
160 public boolean equals(Object other) {
164 if (other == null || getClass() != other.getClass()) {
168 ProcessEntity that = (ProcessEntity) other;
170 if (vspId != null ? !vspId.equals(that.vspId) : that.vspId != null) {
173 if (version != null ? !version.equals(that.version) : that.version != null) {
176 if (componentId != null ? !componentId.equals(that.componentId) : that.componentId != null) {
179 if (id != null ? !id.equals(that.id) : that.id != null) {
182 if (name != null ? !name.equals(that.name) : that.name != null) {
185 if (description != null ? !description.equals(that.description) : that.description != null) {
188 if (artifactName != null ? !artifactName.equals(that.artifactName)
189 : that.artifactName != null) {
192 if (artifact != null ? !artifact.equals(that.artifact) : that.artifact != null) {
196 if (type != null ? !type.equals(that.type) : that.type != null) {
204 public int hashCode() {
205 int result = vspId != null ? vspId.hashCode() : 0;
206 result = 31 * result + (version != null ? version.hashCode() : 0);
207 result = 31 * result + (componentId != null ? componentId.hashCode() : 0);
208 result = 31 * result + (id != null ? id.hashCode() : 0);
209 result = 31 * result + (name != null ? name.hashCode() : 0);
210 result = 31 * result + (description != null ? description.hashCode() : 0);
211 result = 31 * result + (type != null ? type.hashCode() : 0);
212 result = 31 * result + (artifactName != null ? artifactName.hashCode() : 0);
213 result = 31 * result + (artifact != null ? artifact.hashCode() : 0);
218 public String toString() {
219 return "ProcessEntity{" +
220 "vspId='" + vspId + '\'' +
221 ", version=" + version +
222 ", componentId='" + componentId + '\'' +
223 ", id='" + id + '\'' +
224 ", name='" + name + '\'' +
225 ", description='" + description + '\'' +
227 ", artifactName='" + artifactName + '\'' +