[SDC] rebase 1710 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 / MibEntity.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.core.enrichment.types.ArtifactType;
29 import org.openecomp.sdc.versioning.dao.types.Version;
30 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
31
32 import java.io.Serializable;
33 import java.nio.ByteBuffer;
34
35 @Table(keyspace = "dox", name = "vsp_component_artifact")
36 public class MibEntity implements VersionableEntity, Serializable {
37   public static final String ENTITY_TYPE = "Vendor Software Product Component Artifact";
38   @PartitionKey
39   @Column(name = "vsp_id")
40   private String vspId;
41   @PartitionKey(value = 1)
42   @Frozen
43   private Version version;
44   @ClusteringColumn
45   @Column(name = "component_id")
46   private String componentId;
47   @ClusteringColumn(value = 1)
48   @Column(name = "artifact_type")
49   private ArtifactType type;
50   @ClusteringColumn(value = 2)
51   @Column(name = "artifact_id")
52   private String id;
53   @Column(name = "name")
54   private String artifactName;
55   private ByteBuffer artifact;
56
57   public MibEntity() {
58
59   }
60
61   /**
62    * Instantiates a new Component artifact entity.
63    *
64    * @param vspId       the vsp id
65    * @param version     the version
66    * @param componentId the component id
67    * @param id          the id
68    */
69   public MibEntity(String vspId, Version version, String componentId, String id) {
70     this.vspId = vspId;
71     this.version = version;
72     this.componentId = componentId;
73     this.id = id;
74   }
75
76   public String getVspId() {
77     return vspId;
78   }
79
80   public void setVspId(String vspId) {
81     this.vspId = vspId;
82   }
83
84   public String getComponentId() {
85     return componentId;
86   }
87
88   public void setComponentId(String componentId) {
89     this.componentId = componentId;
90   }
91
92   @Override
93   public String getEntityType() {
94     return ENTITY_TYPE;
95   }
96
97   @Override
98   public String getFirstClassCitizenId() {
99     return getVspId();
100   }
101
102   public String getId() {
103     return id;
104   }
105
106   public void setId(String id) {
107     this.id = id;
108   }
109
110   public Version getVersion() {
111     return version;
112   }
113
114   public void setVersion(Version version) {
115     this.version = version;
116   }
117
118   public String getArtifactName() {
119     return artifactName;
120   }
121
122   public void setArtifactName(String artifactName) {
123     this.artifactName = artifactName;
124   }
125
126   public ByteBuffer getArtifact() {
127     return artifact;
128   }
129
130   public void setArtifact(ByteBuffer artifact) {
131     this.artifact = artifact;
132   }
133
134   public ArtifactType getType() {
135     return type;
136   }
137
138   public void setType(ArtifactType type) {
139     this.type = type;
140   }
141
142   @Override
143   public String toString() {
144     return "MibEntity{" +
145         "vspId='" + vspId + '\'' +
146         ", version=" + version +
147         ", componentId='" + componentId + '\'' +
148         ", type=" + type +
149         ", id='" + id + '\'' +
150         ", artifactName='" + artifactName + '\'' +
151         '}';
152   }
153 }