dfdc0bc0c6a2bee18f7fd07500a233c21d98f0e2
[sdc.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
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.*;
24 import lombok.EqualsAndHashCode;
25 import lombok.Getter;
26 import lombok.NoArgsConstructor;
27 import lombok.Setter;
28 import org.openecomp.sdc.versioning.dao.types.Version;
29 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
30
31 @EqualsAndHashCode
32 @Getter
33 @Setter
34 @NoArgsConstructor
35 @Table(keyspace = "dox", name = "vsp_component_dependency_model")
36 public class ComponentDependencyModelEntity implements VersionableEntity {
37
38   public static final String ENTITY_TYPE = "Vendor Software Product Component Dependency Model";
39   @PartitionKey
40   @Column(name = "vsp_id")
41   private String vspId;
42   @PartitionKey(value = 1)
43   @Frozen
44   private Version version;
45   @ClusteringColumn
46   @Column(name = "dependency_id")
47   private String id;
48   @Column(name = "sourcecomponent_id")
49   private String sourceComponentId;
50   @Column(name = "targetcomponent_id")
51   private String targetComponentId;
52   @Column(name = "relation")
53   private String relation;
54
55
56   /**
57    * Instantiates a new ComponentDependencyModelEntity entity.
58    *
59    * @param vspId   the vsp id
60    * @param version the version
61    * @param dependencyId      the dependencyId
62    */
63   public ComponentDependencyModelEntity(String vspId, Version version, String dependencyId) {
64     this.vspId = vspId;
65     this.version = version;
66     this.id = dependencyId;
67   }
68
69   @Override
70   public String getEntityType() {
71     return ENTITY_TYPE;
72   }
73
74   @Override
75   public String getFirstClassCitizenId() {
76     return getVspId();
77   }
78 }