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;
31 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
33 import io.swagger.annotations.ApiModel;
34 import io.swagger.annotations.ApiModelProperty;
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;
43 private String timestamp;
44 private Map<String, Object> row_specification;
45 private Map<String, String> consistencyInfo;
47 private Map<String, byte[]> objectMap;
49 @ApiModelProperty(value = "objectMap")
50 public Map<String, byte[]> getObjectMap() {
54 public void setObjectMap(Map<String, byte[]> objectMap) {
55 this.objectMap = objectMap;
58 @ApiModelProperty(value = "keyspace")
59 public String getKeyspaceName() {
63 public void setKeyspaceName(String keyspaceName) {
64 this.keyspaceName = keyspaceName;
67 @ApiModelProperty(value = "Table name")
68 public String getTableName() {
72 public void setTableName(String tableName) {
73 this.tableName = tableName;
76 @ApiModelProperty(value = "Consistency level", allowableValues = "eventual,critical,atomic")
77 public Map<String, String> getConsistencyInfo() {
78 return consistencyInfo;
81 public void setConsistencyInfo(Map<String, String> consistencyInfo) {
82 this.consistencyInfo = consistencyInfo;
85 @ApiModelProperty(value = "Time to live information")
86 public String getTtl() {
90 public void setTtl(String ttl) {
94 @ApiModelProperty(value = "Time stamp")
95 public String getTimestamp() {
99 public void setTimestamp(String timestamp) {
100 this.timestamp = timestamp;
103 @ApiModelProperty(value = "values returned")
104 public Map<String, Object> getValues() {
108 public void setValues(Map<String, Object> values) {
109 this.values = values;
112 @ApiModelProperty(value = "Information for selecting specific rows for insert")
113 public Map<String, Object> getRow_specification() {
114 return row_specification;
117 public void setRow_specification(Map<String, Object> row_specification) {
118 this.row_specification = row_specification;
121 public byte[] serialize() {
122 ByteArrayOutputStream bos = new ByteArrayOutputStream();
123 ObjectOutput out = null;
125 out = new ObjectOutputStream(bos);
126 out.writeObject(this);
127 } catch (IOException e) {
130 return bos.toByteArray();