push addional code
[sdc.git] / openecomp-be / lib / openecomp-sdc-vendor-software-product-lib / openecomp-sdc-vendor-software-product-api / src / main / java / org / openecomp / sdc / vendorsoftwareproduct / dao / type / ProcessEntity.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.vendorsoftwareproduct.dao.type;
22
23 import com.datastax.driver.mapping.annotations.ClusteringColumn;
24 import com.datastax.driver.mapping.annotations.Column;
25 import com.datastax.driver.mapping.annotations.Frozen;
26 import com.datastax.driver.mapping.annotations.PartitionKey;
27 import com.datastax.driver.mapping.annotations.Table;
28 import org.openecomp.sdc.versioning.dao.types.Version;
29 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
30
31 @Table(keyspace = "dox", name = "vsp_process")
32 public class ProcessEntity implements VersionableEntity {
33   public static final String ENTITY_TYPE = "Vendor Software Product Process";
34   @PartitionKey
35   @Column(name = "vsp_id")
36   private String vspId;
37   @PartitionKey(value = 1)
38   @Frozen
39   private Version version;
40   @ClusteringColumn
41   @Column(name = "component_id")
42   private String componentId;
43   @ClusteringColumn(value = 1)
44   @Column(name = "process_id")
45   private String id;
46   private String name;
47   private String description;
48   @Column(name = "artifact_name")
49   private String artifactName;
50
51   public ProcessEntity() {
52
53   }
54
55   /**
56    * Instantiates a new Process entity.
57    *
58    * @param vspId       the vsp id
59    * @param version     the version
60    * @param componentId the component id
61    * @param id          the id
62    */
63   public ProcessEntity(String vspId, Version version, String componentId, String id) {
64     this.vspId = vspId;
65     this.version = version;
66     this.componentId = componentId;
67     this.id = id;
68   }
69
70   public String getVspId() {
71     return vspId;
72   }
73
74   public void setVspId(String vspId) {
75     this.vspId = vspId;
76   }
77
78   public Version getVersion() {
79     return version;
80   }
81
82   public void setVersion(Version version) {
83     this.version = version;
84   }
85
86   public String getComponentId() {
87     return componentId;
88   }
89
90   public void setComponentId(String componentId) {
91     this.componentId = componentId;
92   }
93
94   @Override
95   public String getEntityType() {
96     return ENTITY_TYPE;
97   }
98
99   @Override
100   public String getFirstClassCitizenId() {
101     return getVspId();
102   }
103
104   public String getId() {
105     return id;
106   }
107
108   public void setId(String id) {
109     this.id = id;
110   }
111
112   public String getName() {
113     return name;
114   }
115
116   public void setName(String name) {
117     this.name = name;
118   }
119
120   public String getDescription() {
121     return description;
122   }
123
124   public void setDescription(String description) {
125     this.description = description;
126   }
127
128   public String getArtifactName() {
129     return artifactName;
130   }
131
132   public void setArtifactName(String artifactName) {
133     this.artifactName = artifactName;
134   }
135
136   @Override
137   public boolean equals(Object obj) {
138     if (this == obj) {
139       return true;
140     }
141     if (obj == null || getClass() != obj.getClass()) {
142       return false;
143     }
144
145     ProcessEntity that = (ProcessEntity) obj;
146
147     if (vspId != null ? !vspId.equals(that.vspId) : that.vspId != null) {
148       return false;
149     }
150     if (version != null ? !version.equals(that.version) : that.version != null) {
151       return false;
152     }
153     if (componentId != null ? !componentId.equals(that.componentId) : that.componentId != null) {
154       return false;
155     }
156     if (id != null ? !id.equals(that.id) : that.id != null) {
157       return false;
158     }
159     if (name != null ? !name.equals(that.name) : that.name != null) {
160       return false;
161     }
162     return description != null ? description.equals(that.description) : that.description == null
163         &&
164         (artifactName != null ? artifactName.equals(that.artifactName) : that.artifactName == null);
165
166   }
167
168   @Override
169   public int hashCode() {
170     int result = vspId != null ? vspId.hashCode() : 0;
171     result = 31 * result + (version != null ? version.hashCode() : 0);
172     result = 31 * result + (componentId != null ? componentId.hashCode() : 0);
173     result = 31 * result + (id != null ? id.hashCode() : 0);
174     result = 31 * result + (name != null ? name.hashCode() : 0);
175     result = 31 * result + (description != null ? description.hashCode() : 0);
176     result = 31 * result + (artifactName != null ? artifactName.hashCode() : 0);
177     return result;
178   }
179 }