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