Update Master to include jar folder.
[music.git] / jar / src / main / java / org / onap / music / datastore / jsonobjects / JsonUpdate.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 update")
37 @JsonIgnoreProperties(ignoreUnknown = true)
38 public class JsonUpdate implements Serializable {
39     private String keyspaceName;
40     private String tableName;
41     private Map<String, Object> values;
42     private String ttl, timestamp;
43     private Map<String, String> consistencyInfo;
44     private Map<String, Object> conditions;
45     private Map<String, Object> row_specification;
46
47     @ApiModelProperty(value = "Conditions")
48     public Map<String, Object> getConditions() {
49         return conditions;
50     }
51
52     public void setConditions(Map<String, Object> conditions) {
53         this.conditions = conditions;
54     }
55
56     @ApiModelProperty(value = "Information for selecting sepcific rows")
57     public Map<String, Object> getRow_specification() {
58         return row_specification;
59     }
60
61     public void setRow_specification(Map<String, Object> row_specification) {
62         this.row_specification = row_specification;
63     }
64
65
66     @ApiModelProperty(value = "Keyspace name")
67     public String getKeyspaceName() {
68         return keyspaceName;
69     }
70
71     public void setKeyspaceName(String keyspaceName) {
72         this.keyspaceName = keyspaceName;
73     }
74
75     @ApiModelProperty(value = "Table name")
76     public String getTableName() {
77         return tableName;
78     }
79
80     public void setTableName(String tableName) {
81         this.tableName = tableName;
82     }
83
84     @ApiModelProperty(value = "Consistency level", allowableValues = "eventual,critical,atomic")
85     public Map<String, String> getConsistencyInfo() {
86         return consistencyInfo;
87     }
88
89     public void setConsistencyInfo(Map<String, String> consistencyInfo) {
90         this.consistencyInfo = consistencyInfo;
91     }
92
93     @ApiModelProperty(value = "Time to live value")
94     public String getTtl() {
95         return ttl;
96     }
97
98     public void setTtl(String ttl) {
99         this.ttl = ttl;
100     }
101
102     @ApiModelProperty(value = "Time stamp")
103     public String getTimestamp() {
104         return timestamp;
105     }
106
107     public void setTimestamp(String timestamp) {
108         this.timestamp = timestamp;
109     }
110
111     @ApiModelProperty(value = "Column values")
112     public Map<String, Object> getValues() {
113         return values;
114     }
115
116     public void setValues(Map<String, Object> values) {
117         this.values = values;
118     }
119
120     public byte[] serialize() {
121         ByteArrayOutputStream bos = new ByteArrayOutputStream();
122         ObjectOutput out = null;
123         try {
124             out = new ObjectOutputStream(bos);
125             out.writeObject(this);
126         } catch (IOException e) {
127             e.printStackTrace();
128         }
129         return bos.toByteArray();
130     }
131
132 }