Some Sonar and CLM issues resolved.
[music.git] / src / main / java / org / onap / music / datastore / jsonobjects / JsonInsert.java
1 /*
2  * ============LICENSE_START==========================================
3  * org.onap.music
4  * ===================================================================
5  *  Copyright (c) 2017 AT&T Intellectual Property
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  * 
19  * ============LICENSE_END=============================================
20  * ====================================================================
21  */
22 package org.onap.music.datastore.jsonobjects;
23
24 import java.io.ByteArrayOutputStream;
25 import java.io.IOException;
26 import java.io.ObjectOutput;
27 import java.io.ObjectOutputStream;
28 import java.io.Serializable;
29 import java.util.Map;
30 import io.swagger.annotations.ApiModel;
31 import io.swagger.annotations.ApiModelProperty;
32
33 @ApiModel(value = "JsonTable", description = "Json model for table vlaues insert")
34 public class JsonInsert implements Serializable {
35     private String keyspaceName;
36     private String tableName;
37     private Map<String, Object> values;
38     private String ttl;
39     private String timestamp;
40     private Map<String, Object> row_specification;
41     private Map<String, String> consistencyInfo;
42
43     @ApiModelProperty(value = "keyspace")
44     public String getKeyspaceName() {
45         return keyspaceName;
46     }
47
48     public void setKeyspaceName(String keyspaceName) {
49         this.keyspaceName = keyspaceName;
50     }
51
52     @ApiModelProperty(value = "Table name")
53     public String getTableName() {
54         return tableName;
55     }
56
57     public void setTableName(String tableName) {
58         this.tableName = tableName;
59     }
60
61     @ApiModelProperty(value = "Consistency level", allowableValues = "eventual,critical,atomic")
62     public Map<String, String> getConsistencyInfo() {
63         return consistencyInfo;
64     }
65
66     public void setConsistencyInfo(Map<String, String> consistencyInfo) {
67         this.consistencyInfo = consistencyInfo;
68     }
69
70     @ApiModelProperty(value = "Time to live information")
71     public String getTtl() {
72         return ttl;
73     }
74
75     public void setTtl(String ttl) {
76         this.ttl = ttl;
77     }
78
79     @ApiModelProperty(value = "Time stamp")
80     public String getTimestamp() {
81         return timestamp;
82     }
83
84     public void setTimestamp(String timestamp) {
85         this.timestamp = timestamp;
86     }
87
88     @ApiModelProperty(value = "values returned")
89     public Map<String, Object> getValues() {
90         return values;
91     }
92
93     public void setValues(Map<String, Object> values) {
94         this.values = values;
95     }
96
97     @ApiModelProperty(value = "Information for selecting specific rows for insert")
98     public Map<String, Object> getRow_specification() {
99         return row_specification;
100     }
101
102     public void setRow_specification(Map<String, Object> row_specification) {
103         this.row_specification = row_specification;
104     }
105
106     public byte[] serialize() {
107         ByteArrayOutputStream bos = new ByteArrayOutputStream();
108         ObjectOutput out = null;
109         try {
110             out = new ObjectOutputStream(bos);
111             out.writeObject(this);
112         } catch (IOException e) {
113             e.printStackTrace();
114         }
115         return bos.toByteArray();
116     }
117
118 }