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 * ====================================================================
22 package org.onap.music.datastore.jsonobjects;
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;
30 import io.swagger.annotations.ApiModel;
31 import io.swagger.annotations.ApiModelProperty;
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 String ttl, timestamp;
39 private Map<String, Object> row_specification;
40 private Map<String, String> consistencyInfo;
42 @ApiModelProperty(value = "keyspace")
43 public String getKeyspaceName() {
47 public void setKeyspaceName(String keyspaceName) {
48 this.keyspaceName = keyspaceName;
51 @ApiModelProperty(value = "Table name")
52 public String getTableName() {
56 public void setTableName(String tableName) {
57 this.tableName = tableName;
60 @ApiModelProperty(value = "Consistency level", allowableValues = "eventual,critical,atomic")
61 public Map<String, String> getConsistencyInfo() {
62 return consistencyInfo;
65 public void setConsistencyInfo(Map<String, String> consistencyInfo) {
66 this.consistencyInfo = consistencyInfo;
69 @ApiModelProperty(value = "Time to live information")
70 public String getTtl() {
74 public void setTtl(String ttl) {
78 @ApiModelProperty(value = "Time stamp")
79 public String getTimestamp() {
83 public void setTimestamp(String timestamp) {
84 this.timestamp = timestamp;
87 @ApiModelProperty(value = "values returned")
88 public Map<String, Object> getValues() {
92 public void setValues(Map<String, Object> values) {
96 @ApiModelProperty(value = "Information for selecting specific rows for insert")
97 public Map<String, Object> getRow_specification() {
98 return row_specification;
101 public void setRow_specification(Map<String, Object> row_specification) {
102 this.row_specification = row_specification;
105 public byte[] serialize() {
106 ByteArrayOutputStream bos = new ByteArrayOutputStream();
107 ObjectOutput out = null;
109 out = new ObjectOutputStream(bos);
110 out.writeObject(this);
111 } catch (IOException e) {
112 // TODO Auto-generated catch block
115 return bos.toByteArray();