# HG changeset patch # User Raimund Renkert # Date 1381322981 -7200 # Node ID a1cef118c32ab5bbe986ccb5d0b8f7906e4d3a72 # Parent 6f4afcd28ff33c67b65645f5b3fe1db02955a163 Added attribute 'totalcount' to response. diff -r 6f4afcd28ff3 -r a1cef118c32a src/main/java/de/intevation/lada/rest/Response.java --- a/src/main/java/de/intevation/lada/rest/Response.java Fri Sep 27 10:20:19 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/Response.java Wed Oct 09 14:49:41 2013 +0200 @@ -28,6 +28,7 @@ private Map errors; private Map warnings; private Boolean readonly; + private int totalCount; /** * Constructor to create a basic Response object. @@ -43,6 +44,24 @@ this.errors = new HashMap(); this.warnings = new HashMap(); this.readonly = Boolean.FALSE; + this.totalCount = 0; + } + + /** + * Constructor to create a basic Response object. + * + * @param success Information if the operation was successful. + * @param code The return code. + * @param data The data object wrapped by the response. + */ + public Response(boolean success, int code, Object data, int totalCount) { + this.success = success; + this.message = Integer.toString(code); + this.data = data; + this.errors = new HashMap(); + this.warnings = new HashMap(); + this.readonly = Boolean.FALSE; + this.totalCount = totalCount; } public Boolean getSuccess() { @@ -93,6 +112,20 @@ this.readonly = readonly; } + /** + * @return the totalCount + */ + public int getTotalCount() { + return totalCount; + } + + /** + * @param totalCount the totalCount to set + */ + public void setTotalCount(int totalCount) { + this.totalCount = totalCount; + } + private HashMap convertCodes(Map codes) { HashMap converted = new HashMap(); if (codes == null || codes.isEmpty()) {