2 * ============LICENSE_START==========================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * ============LICENSE_END=============================================
20 * ====================================================================
23 package org.onap.music.datastore.jsonobjects;
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;
32 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
34 import io.swagger.annotations.ApiModel;
35 import io.swagger.annotations.ApiModelProperty;
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;
44 private String timestamp;
45 private Map<String, Object> row_specification;
46 private Map<String, String> consistencyInfo;
48 @ApiModelProperty(value = "keyspace")
49 public String getKeyspaceName() {
53 public void setKeyspaceName(String keyspaceName) {
54 this.keyspaceName = keyspaceName;
57 @ApiModelProperty(value = "Table name")
58 public String getTableName() {
62 public void setTableName(String tableName) {
63 this.tableName = tableName;
66 @ApiModelProperty(value = "Consistency level", allowableValues = "eventual,critical,atomic")
67 public Map<String, String> getConsistencyInfo() {
68 return consistencyInfo;
71 public void setConsistencyInfo(Map<String, String> consistencyInfo) {
72 this.consistencyInfo = consistencyInfo;
75 @ApiModelProperty(value = "Time to live information")
76 public String getTtl() {
80 public void setTtl(String ttl) {
84 @ApiModelProperty(value = "Time stamp")
85 public String getTimestamp() {
89 public void setTimestamp(String timestamp) {
90 this.timestamp = timestamp;
93 @ApiModelProperty(value = "values returned")
94 public Map<String, Object> getValues() {
98 public void setValues(Map<String, Object> values) {
102 @ApiModelProperty(value = "Information for selecting specific rows for insert")
103 public Map<String, Object> getRow_specification() {
104 return row_specification;
107 public void setRow_specification(Map<String, Object> row_specification) {
108 this.row_specification = row_specification;
111 public byte[] serialize() {
112 ByteArrayOutputStream bos = new ByteArrayOutputStream();
113 ObjectOutput out = null;
115 out = new ObjectOutputStream(bos);
116 out.writeObject(this);
117 } catch (IOException e) {
120 return bos.toByteArray();