it.geosolutions.geoserver.rest.encoder.metadata.virtualtable
Class GSVirtualTableEncoder

java.lang.Object
  extended by it.geosolutions.geoserver.rest.encoder.utils.XmlElement
      extended by it.geosolutions.geoserver.rest.encoder.metadata.virtualtable.GSVirtualTableEncoder

public class GSVirtualTableEncoder
extends XmlElement

GSVirtualTableEncoder - Encodes a metadata VirtualTable for a GeoServer featureType. Example (based on the example provided in the Geoserver documentation - see parameterizing-sql-views):

 {

Author:
Emmanuel Blondel - emmanuel.blondel1@gmail.com | emmanuel.blondel@fao.org

Field Summary
static String KEYCOLUMN
           
static String NAME
           
static String SQL
           
 
Constructor Summary
GSVirtualTableEncoder()
          Constructs a GSVirtualTableEncoder
GSVirtualTableEncoder(String name, String sql, List<String> keyColumns, List<VTGeometryEncoder> geomEncList, List<VTParameterEncoder> paramEncList)
          Constructs directly a GSVirtualTableEncoder
 
Method Summary
 void addKeyColumn(String keycolumn)
          Adds a keyColumn
protected  void addName(String name)
          Add the 'name' node with a text value from 'name'
protected  void addSql(String sql)
          Add the 'sql' node with a text value from 'sql'
 void addVirtualTableGeometry(String name, String geometryType, String srid)
          Adds quickly a geometry to the virtual table
 void addVirtualTableGeometry(VTGeometryEncoder geomEnc)
          Adds a geometry to the VirtualTable
 void addVirtualTableParameter(String name, String defaultValue, String regexpValidator)
          Adds quickly a parameter to the VirtualTable
 void addVirtualTableParameter(VTParameterEncoder paramEnc)
          Adds a parameter to the VirtualTable
 boolean delKeyColumn(String keycolumn)
          Deletes a keyColumn
 boolean delVirtualTableGeometry(String name)
          Deletes a geometry from the VirtualTable
 boolean delVirtualTableParameter(String name)
          Deletes a parameter from the VirtualTable
 String getName()
          Get the name of the virtual table
 String getSql()
          Get the sql query
 void setName(String name)
          Set or modify the 'name' node with a text value from 'name'
 void setSql(String sql)
          Set or modify the 'sql' node with a text value from 'sql'
protected  void setup(String name, String sql, List<String> keyColumns, List<VTGeometryEncoder> geomEncList, List<VTParameterEncoder> paramEncList)
          Set-up quickly a GSVirtualTableEncoder
 boolean validate()
           
 
Methods inherited from class it.geosolutions.geoserver.rest.encoder.utils.XmlElement
add, add, addContent, getRoot, isEmpty, remove, set, set, setRoot, setRoot, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
See Also:
Constant Field Values

SQL

public static final String SQL
See Also:
Constant Field Values

KEYCOLUMN

public static final String KEYCOLUMN
See Also:
Constant Field Values
Constructor Detail

GSVirtualTableEncoder

public GSVirtualTableEncoder()
Constructs a GSVirtualTableEncoder


GSVirtualTableEncoder

public GSVirtualTableEncoder(String name,
                             String sql,
                             List<String> keyColumns,
                             List<VTGeometryEncoder> geomEncList,
                             List<VTParameterEncoder> paramEncList)
Constructs directly a GSVirtualTableEncoder

Parameters:
name - (required)
sql - (required)
keyColumns - (optional)
geomEncList - (optional for geometryless sql view)
paramEncList - (optional)
Method Detail

setup

protected void setup(String name,
                     String sql,
                     List<String> keyColumns,
                     List<VTGeometryEncoder> geomEncList,
                     List<VTParameterEncoder> paramEncList)
Set-up quickly a GSVirtualTableEncoder

Parameters:
name - (must be the same as the featureType nativeName)
sql -
keyColumns -
geomEncList -
paramEncList -

addName

protected void addName(String name)
Add the 'name' node with a text value from 'name'


setName

public void setName(String name)
Set or modify the 'name' node with a text value from 'name'


getName

public String getName()
Get the name of the virtual table

Returns:

addSql

protected void addSql(String sql)
Add the 'sql' node with a text value from 'sql'


setSql

public void setSql(String sql)
Set or modify the 'sql' node with a text value from 'sql'


getSql

public String getSql()
Get the sql query

Returns:

addKeyColumn

public void addKeyColumn(String keycolumn)
Adds a keyColumn

Parameters:
keycolumn -

delKeyColumn

public boolean delKeyColumn(String keycolumn)
Deletes a keyColumn

Parameters:
keycolumn -
Returns:
true if the keycolumn was removed

addVirtualTableGeometry

public void addVirtualTableGeometry(VTGeometryEncoder geomEnc)
Adds a geometry to the VirtualTable

Parameters:
geomEnc -

addVirtualTableGeometry

public void addVirtualTableGeometry(String name,
                                    String geometryType,
                                    String srid)
Adds quickly a geometry to the virtual table

Parameters:
name -
geometryType -
srid -

delVirtualTableGeometry

public boolean delVirtualTableGeometry(String name)
Deletes a geometry from the VirtualTable

Parameters:
name -
Returns:
true if the geometry was removed, otherwise false

addVirtualTableParameter

public void addVirtualTableParameter(VTParameterEncoder paramEnc)
Adds a parameter to the VirtualTable

Parameters:
paramEnc -

addVirtualTableParameter

public void addVirtualTableParameter(String name,
                                     String defaultValue,
                                     String regexpValidator)
Adds quickly a parameter to the VirtualTable

Parameters:
name -
defaultValue -
regexpValidator -

delVirtualTableParameter

public boolean delVirtualTableParameter(String name)
Deletes a parameter from the VirtualTable

Parameters:
name -
Returns:

validate

public boolean validate()
                 throws IllegalStateException
Throws:
IllegalStateException


Copyright © 2007-2014 GeoSolutions. All Rights Reserved.