2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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.*;
24 import org.openecomp.sdc.versioning.dao.types.Version;
25 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
27 @Table(keyspace = "dox", name = "vsp_component_dependency_model")
28 public class ComponentDependencyModelEntity implements VersionableEntity {
30 public static final String ENTITY_TYPE = "Vendor Software Product Component Dependency Model";
32 @Column(name = "vsp_id")
34 @PartitionKey(value = 1)
36 private Version version;
38 @Column(name = "dependency_id")
40 @Column(name = "sourcecomponent_id")
41 private String sourceComponentId;
42 @Column(name = "targetcomponent_id")
43 private String targetComponentId;
44 @Column(name = "relation")
45 private String relation;
48 * Every entity class must have a default constructor according to
49 * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
50 * Definition of mapped classes</a>.
52 public ComponentDependencyModelEntity() {
53 // Don't delete! Default constructor is required by DataStax driver
57 * Instantiates a new ComponentDependencyModelEntity entity.
59 * @param vspId the vsp id
60 * @param version the version
61 * @param dependencyId the dependencyId
63 public ComponentDependencyModelEntity(String vspId, Version version, String dependencyId) {
65 this.version = version;
66 this.id = dependencyId;
70 public String getEntityType() {
75 public String getFirstClassCitizenId() {
80 public String getId() {
85 public void setId(String id) {
90 public Version getVersion() {
95 public void setVersion(Version version) {
96 this.version = version;
99 public String getVspId() {
103 public void setVspId(String vspId) {
107 public String getTargetComponentId() {
108 return targetComponentId;
111 public void setTargetComponentId(String targetComponentId) {
112 this.targetComponentId = targetComponentId;
115 public String getSourceComponentId() {
116 return sourceComponentId;
119 public void setSourceComponentId(String sourceComponentId) {
120 this.sourceComponentId = sourceComponentId;
123 public String getRelation() {
127 public void setRelation(String relation) {
128 this.relation = relation;
132 public boolean equals(Object o) {
136 if (o == null || getClass() != o.getClass()) {
140 ComponentDependencyModelEntity that = (ComponentDependencyModelEntity) o;
142 if (vspId != null ? !vspId.equals(that.vspId) : that.vspId != null) {
145 if (version != null ? !version.equals(that.version) : that.version != null) {
148 if (id != null ? !id.equals(that.id) : that.id != null) {
151 if (sourceComponentId != null ? !sourceComponentId.equals(that.sourceComponentId)
152 : that.sourceComponentId != null) {
155 if (targetComponentId != null ? !targetComponentId.equals(that.targetComponentId)
156 : that.targetComponentId != null) {
159 if (relation != null ? !relation.equals(that.relation) : that.relation != null) {
167 public int hashCode() {
168 int result = vspId != null ? vspId.hashCode() : 0;
169 result = 31 * result + (version != null ? version.hashCode() : 0);
170 result = 31 * result + (id != null ? id.hashCode() : 0);
171 result = 31 * result + (sourceComponentId != null ? sourceComponentId.hashCode() : 0);
172 result = 31 * result + (targetComponentId != null ? targetComponentId.hashCode() : 0);
173 result = 31 * result + (relation != null ? relation.hashCode() : 0);