re base 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 / ComponentMonitoringUploadEntity.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.*;
24 import org.openecomp.core.enrichment.types.MonitoringUploadType;
25 import org.openecomp.sdc.versioning.dao.types.Version;
26 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
27
28 import java.nio.ByteBuffer;
29
30 @Table(keyspace = "dox", name = "vsp_component_artifact")
31 public class ComponentMonitoringUploadEntity implements VersionableEntity {
32   public static final String ENTITY_TYPE = "Vendor Software Product Component Artifact";
33   @PartitionKey
34   @Column(name = "vsp_id")
35   private String vspId;
36   @PartitionKey(value = 1)
37   @Frozen
38   private Version version;
39   @ClusteringColumn
40   @Column(name = "component_id")
41   private String componentId;
42   @ClusteringColumn(value = 1)
43   @Column(name = "artifact_type")
44   private MonitoringUploadType type;
45   @ClusteringColumn(value = 2)
46   @Column(name = "artifact_id")
47   private String id;
48   @Column(name = "name")
49   private String artifactName;
50   private ByteBuffer artifact;
51
52   /**
53    * Every entity class must have a default constructor according to
54    * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
55    * Definition of mapped classes</a>.
56    */
57   public ComponentMonitoringUploadEntity() {
58     // Don't delete! Default constructor is required by DataStax driver
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 ComponentMonitoringUploadEntity(String vspId, Version version, String componentId,
70                                          String id) {
71     this.vspId = vspId;
72     this.version = version;
73     this.componentId = componentId;
74     this.id = id;
75   }
76
77   public String getVspId() {
78     return vspId;
79   }
80
81   public void setVspId(String vspId) {
82     this.vspId = vspId;
83   }
84
85   public String getComponentId() {
86     return componentId;
87   }
88
89   public void setComponentId(String componentId) {
90     this.componentId = componentId;
91   }
92
93   @Override
94   public String getEntityType() {
95     return ENTITY_TYPE;
96   }
97
98   @Override
99   public String getFirstClassCitizenId() {
100     return getVspId();
101   }
102
103   public String getId() {
104     return id;
105   }
106
107   public void setId(String id) {
108     this.id = id;
109   }
110
111   public Version getVersion() {
112     return version;
113   }
114
115   public void setVersion(Version version) {
116     this.version = version;
117   }
118
119   public String getArtifactName() {
120     return artifactName;
121   }
122
123   public void setArtifactName(String artifactName) {
124     this.artifactName = artifactName;
125   }
126
127   public ByteBuffer getArtifact() {
128     return artifact;
129   }
130
131   public void setArtifact(ByteBuffer artifact) {
132     this.artifact = artifact;
133   }
134
135   public MonitoringUploadType getType() {
136     return type;
137   }
138
139   public void setType(MonitoringUploadType type) {
140     this.type = type;
141   }
142
143   @Override
144   public String toString() {
145     return "ComponentMonitoringUploadEntity{" +
146         "vspId='" + vspId + '\'' +
147         ", version=" + version +
148         ", componentId='" + componentId + '\'' +
149         ", type=" + type +
150         ", id='" + id + '\'' +
151         ", artifactName='" + artifactName + '\'' +
152         '}';
153   }
154 }