From 3a05e405bde787d128946aeada26b5d2ecd29386 Mon Sep 17 00:00:00 2001 From: ccancellieri Date: Wed, 26 Sep 2012 14:17:00 +0200 Subject: [PATCH] Adding support to resourceEncoder for Description, Abstract and layerEncoder queriable --- .../rest/encoder/GSLayerEncoder.java | 58 ++++++++++--------- .../rest/encoder/GSResourceEncoder.java | 32 ++++++++++ 2 files changed, 62 insertions(+), 28 deletions(-) diff --git a/src/main/java/it/geosolutions/geoserver/rest/encoder/GSLayerEncoder.java b/src/main/java/it/geosolutions/geoserver/rest/encoder/GSLayerEncoder.java index f144794..b83f717 100644 --- a/src/main/java/it/geosolutions/geoserver/rest/encoder/GSLayerEncoder.java +++ b/src/main/java/it/geosolutions/geoserver/rest/encoder/GSLayerEncoder.java @@ -60,35 +60,37 @@ public class GSLayerEncoder extends PropertyXMLEncoder { else set("enabled","false"); } + + private final static String DESCRIPTION = "description"; + /** + * Add the 'description' node with a text value from 'description' + * + */ + protected void addDescription(final String description) { + add(DESCRIPTION, description); + } + /** + * Set or modify the 'description' node with a text value from 'description' + */ + public void setDescription(final String description) { + set(DESCRIPTION, description); + } -// /** -// * @param name the name of the layer -// */ -// protected void addName(final String name){ -// add("name",name); -// } -// -// /** -// * @return name the name of the layer or null -// */ -// public String getName() { -// final Element nameNode = get("name"); -// if (nameNode != null) -// return nameNode.getText(); -// else -// return null; -// } -// -// /** -// * @param name the name of the layer -// * @throws IllegalArgumentException -// */ -// public void setName(final String name) throws IllegalArgumentException { -// if (name==null || name.isEmpty()) -// throw new IllegalArgumentException("Unable to set an empty or null parameter"); -// set("name",name); -// } - +// queryable + private final static String QUERYABLE = "queryable"; + /** + * Add the 'queryable' node with a text value from 'queryable' (true as default) + */ + protected void addQueryable(final String queryable) { + add(QUERYABLE, queryable!=null?queryable.toString():"true"); + } + /** + * Set or modify the 'queryable' node with a text value from 'queryable' (true as default) + */ + public void setQueryable(final Boolean queryable) { + set(QUERYABLE, queryable!=null?queryable.toString():"true"); + } + /** * @see {@link GSLayerEncoder#setWmsPath(String)} * diff --git a/src/main/java/it/geosolutions/geoserver/rest/encoder/GSResourceEncoder.java b/src/main/java/it/geosolutions/geoserver/rest/encoder/GSResourceEncoder.java index dffc20c..ef746cf 100644 --- a/src/main/java/it/geosolutions/geoserver/rest/encoder/GSResourceEncoder.java +++ b/src/main/java/it/geosolutions/geoserver/rest/encoder/GSResourceEncoder.java @@ -194,6 +194,38 @@ public abstract class GSResourceEncoder else return null; } + + private final static String DESCRIPTION = "description"; + + /** + * Add the 'description' node with a text value from 'description' + * + */ + protected void addDescription(final String description) { + add(DESCRIPTION, description); + } + + /** + * Set or modify the 'description' node with a text value from 'description' + */ + public void setDescription(final String description) { + set(DESCRIPTION, description); + } + + private final static String ABSTRACT = "abstract"; + /** + * Add the 'abstract' node with a text value from 'abstract' + * + */ + protected void addAbstract(final String _abstract) { + add(ABSTRACT, _abstract); + } + /** + * Set or modify the 'abstract' node with a text value from 'abstract' + */ + public void setAbstract(final String _abstract) { + set(ABSTRACT, _abstract); + } private final static String TITLE = "title";