Mercurial > lada > lada-server
changeset 379:a1cef118c32a
Added attribute 'totalcount' to response.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 09 Oct 2013 14:49:41 +0200 |
parents | 6f4afcd28ff3 |
children | ced1b02b36f6 |
files | src/main/java/de/intevation/lada/rest/Response.java |
diffstat | 1 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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<String, String> errors; private Map<String, String> warnings; private Boolean readonly; + private int totalCount; /** * Constructor to create a basic Response object. @@ -43,6 +44,24 @@ this.errors = new HashMap<String, String>(); this.warnings = new HashMap<String, String>(); 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<String, String>(); + this.warnings = new HashMap<String, String>(); + 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<String, String> convertCodes(Map<String, Integer> codes) { HashMap<String, String> converted = new HashMap<String, String>(); if (codes == null || codes.isEmpty()) {