001/* 002 * JKNIV, whinstone one contract to access your database. 003 * 004 * Copyright (C) 2017, the original author or authors. 005 * 006 * This library is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 2.1 of the License. 010 * 011 * This library is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with this library; if not, write to the Free Software Foundation, Inc., 018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 019 */ 020package net.sf.jkniv.whinstone.couchdb.statement; 021 022import com.fasterxml.jackson.annotation.JsonIgnore; 023import com.fasterxml.jackson.annotation.JsonInclude; 024import com.fasterxml.jackson.annotation.JsonProperty; 025import com.fasterxml.jackson.annotation.JsonPropertyOrder; 026 027@JsonInclude(JsonInclude.Include.NON_NULL) 028@JsonPropertyOrder( 029{ "id", "ok", "rev", "error", "reason" }) 030public class BulkCommandResponse 031{ 032 @JsonProperty("id") 033 private String id; 034 @JsonProperty("ok") 035 private Boolean ok; 036 @JsonProperty("rev") 037 private String rev; 038 @JsonProperty("error") 039 private String error; 040 @JsonProperty("reason") 041 private String reason; 042 043 @JsonProperty("id") 044 public String getId() 045 { 046 return id; 047 } 048 049 @JsonProperty("id") 050 public void setId(String id) 051 { 052 this.id = id; 053 } 054 055 @JsonProperty("ok") 056 public Boolean getOk() 057 { 058 return ok; 059 } 060 061 @JsonProperty("ok") 062 public void setOk(Boolean ok) 063 { 064 this.ok = ok; 065 } 066 067 @JsonProperty("rev") 068 public String getRev() 069 { 070 return rev; 071 } 072 073 @JsonProperty("rev") 074 public void setRev(String rev) 075 { 076 this.rev = rev; 077 } 078 079 @JsonProperty("error") 080 public String getError() 081 { 082 return error; 083 } 084 085 @JsonProperty("error") 086 public void setError(String error) 087 { 088 this.error = error; 089 } 090 091 @JsonProperty("reason") 092 public String getReason() 093 { 094 return reason; 095 } 096 097 @JsonProperty("reason") 098 public void setReason(String reason) 099 { 100 this.reason = reason; 101 } 102 103 @JsonIgnore 104 public boolean hasError() 105 { 106 return (this.error != null && this.error.length() > 0); 107 } 108 109 @JsonIgnore 110 public boolean isOk() 111 { 112 return (this.ok != null && this.ok.booleanValue()) || (!hasError()); 113 } 114 115 @Override 116 public String toString() 117 { 118 return "BulkResponse [id=" + id + ", ok=" + ok + ", rev=" + rev + ", error=" + error + ", reason=" + reason 119 + "]"; 120 } 121 122}