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