com.ontimize.util.gis.server.dataproviders
Class BasicOntimizeDataProvider

java.lang.Object
  extended by com.ontimize.util.gis.server.dataproviders.BasicOntimizeDataProvider
All Implemented Interfaces:
IDataAccess, IDataProvider
Direct Known Subclasses:
OntimizePointProvider

public class BasicOntimizeDataProvider
extends java.lang.Object
implements IDataAccess

Vectorial data provider. It uses Ontimize entities in order to request
and modify geograhpic data. The entity database table must have a
binary data column to save the geometry data.

Xml definition parameters:

Name Description Required
entity_name Related Ontimize entity name Yes
geometry_column Geometry data column (binary data type) Yes
keys Primary keys entity columns.Separated by ";" Yes
data_columns Columns containing other layer data (separated by ";"). This parameter will contain extra data fields that may be useful on gis data display. No
geometry_type Geometry type used by the layer: "point", "line" or "polygon" Yes
bbox_columns List of columns containing the bounding box of the layer data.
For points layer: x position and y position.
For lines and polygons: minmum x, maximum x, minimumy and maximum y.
Yes

Sample definition code:

<DataProvider
    class="com.ontimize.util.gis.server.dataproviders.BasicOntimizeDataProvider"
    type="vectorial">
    <Attribute name="entity_name" value="data.ETestLines" />
    <Attribute name="keys" value="lineid" />
    <Attribute name="geometry_column" value="geometry" />
    <Attribute name="bbox_columns" value="minx;maxx;miny;maxy" />
    <Attribute name="geometry_type" value="line" />
</DataProvider>


Field Summary
protected static java.lang.String BBOX_COLUMNS
           
protected  java.lang.String[] bboxColumns
           
protected static java.lang.String DATA_COLUMNS
           
protected  java.lang.String[] dataColumns
           
protected static java.lang.String ENTITY_NAME
           
protected  java.lang.String entityName
           
protected static java.lang.String GEOMETRY_COLUMN
           
protected  java.lang.String geometryColumn
           
protected  java.lang.String geometryType
           
protected static java.lang.String KEYS_COLUMNS
           
protected  java.lang.String[] keysColumns
           
protected  com.ontimize.db.Entity providerEntity
           
protected  java.util.Vector<java.lang.String> queryColumns
           
protected static java.lang.String REFERENCE_LOCATOR
           
protected  java.lang.Object referenceLocator
           
protected  boolean serverSide
           
 
Constructor Summary
BasicOntimizeDataProvider()
          Create a BasicOntimizeDataProvider without configuration parameters setted
BasicOntimizeDataProvider(java.util.Hashtable parameters)
          Create a BasicOntimizeDataProvider with the given parameters
 
Method Summary
protected  void addBoundingBoxToSearch(com.vividsolutions.jts.geom.Envelope boundingBox, java.util.Hashtable<java.lang.String,java.lang.Object> keysValues)
          Parse given bounding box to add new SearchValue objects to the keysValues parameters
protected  void addParentKeysToSearch(java.util.Hashtable<java.lang.String,java.lang.Object> parentKeys, java.util.Hashtable<java.lang.String,java.lang.Object> keysValues)
           
 void delete(java.lang.Object keysValues, int sessionId)
          This method must implement a standard delete operation over the set of records defined by keysValues.
 void initProvider(java.util.Hashtable<java.lang.String,java.lang.Object> parameters)
           
 java.lang.Object insert(java.lang.Object attributesValues, int sessionId)
          This method must implement a standard insert operation with the data contained in attributesValues parameter.
 java.lang.Object query(java.lang.Object keysValues, java.lang.Object attributes, int sessionId)
          This method must implement a standard query operation returning the set of data that matches the conditions specified by the keysValues parameter.
protected  void reprojectBBoxColumns(com.ontimize.db.EntityResult result, java.util.Hashtable appliedFilters)
           
protected  java.util.Vector<com.vividsolutions.jts.geom.Geometry> reprojectGeometryVector(java.util.Vector<com.vividsolutions.jts.geom.Geometry> sourceVector, java.util.Hashtable appliedFilters)
           
protected  void setBBoxColumnsFromGeometry(com.vividsolutions.jts.geom.Geometry geom, java.util.Hashtable<java.lang.String,java.lang.Object> attrValuesHT, java.lang.String[] bboxColumns)
           
protected  void setBBoxColumnsFromGeometryVector(java.util.Vector<com.vividsolutions.jts.geom.Geometry> geomVector, java.util.Hashtable<java.lang.String,java.lang.Object> attrValuesHT, java.lang.String[] bboxColumns)
           
protected  void setOntimizeNullValues(com.ontimize.db.EntityResult result)
           
 void update(java.lang.Object keysValues, java.lang.Object attributesValues, int sessionId)
          This method must implement a standard update operation with the data specified in attributesValues over the set of records defined by keysValues.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REFERENCE_LOCATOR

protected static final java.lang.String REFERENCE_LOCATOR
See Also:
Constant Field Values

ENTITY_NAME

protected static final java.lang.String ENTITY_NAME
See Also:
Constant Field Values

GEOMETRY_COLUMN

protected static final java.lang.String GEOMETRY_COLUMN
See Also:
Constant Field Values

BBOX_COLUMNS

protected static final java.lang.String BBOX_COLUMNS
See Also:
Constant Field Values

DATA_COLUMNS

protected static final java.lang.String DATA_COLUMNS
See Also:
Constant Field Values

KEYS_COLUMNS

protected static final java.lang.String KEYS_COLUMNS
See Also:
Constant Field Values

entityName

protected java.lang.String entityName

providerEntity

protected com.ontimize.db.Entity providerEntity

geometryColumn

protected java.lang.String geometryColumn

bboxColumns

protected java.lang.String[] bboxColumns

dataColumns

protected java.lang.String[] dataColumns

keysColumns

protected java.lang.String[] keysColumns

queryColumns

protected java.util.Vector<java.lang.String> queryColumns

geometryType

protected java.lang.String geometryType

referenceLocator

protected java.lang.Object referenceLocator

serverSide

protected boolean serverSide
Constructor Detail

BasicOntimizeDataProvider

public BasicOntimizeDataProvider()
Create a BasicOntimizeDataProvider without configuration parameters setted


BasicOntimizeDataProvider

public BasicOntimizeDataProvider(java.util.Hashtable parameters)
Create a BasicOntimizeDataProvider with the given parameters

Parameters:
parameters - Hashtable with the configuration parameters for the provider
Method Detail

initProvider

public void initProvider(java.util.Hashtable<java.lang.String,java.lang.Object> parameters)
Specified by:
initProvider in interface IDataProvider

delete

public void delete(java.lang.Object keysValues,
                   int sessionId)
            throws java.lang.Exception
Description copied from interface: IDataAccess
This method must implement a standard delete operation over the set of records defined by keysValues. So, only the records that comply with the conditions specified by keysValues will be deleted.

Specified by:
delete in interface IDataAccess
Parameters:
keysValues - The conditions that the records to be deleted must fulfill
sessionId - Session Id for this user
Throws:
java.lang.Exception

insert

public java.lang.Object insert(java.lang.Object attributesValues,
                               int sessionId)
                        throws java.lang.Exception
Description copied from interface: IDataAccess
This method must implement a standard insert operation with the data contained in attributesValues parameter.

Specified by:
insert in interface IDataAccess
Parameters:
attributesValues - Data to store
sessionId - Session Id for this user
Throws:
java.lang.Exception

update

public void update(java.lang.Object keysValues,
                   java.lang.Object attributesValues,
                   int sessionId)
            throws java.lang.Exception
Description copied from interface: IDataAccess
This method must implement a standard update operation with the data specified in attributesValues over the set of records defined by keysValues. So, only the records that comply with the conditions specified by keysValues will be updated to the new values specified by attributesValues.

Specified by:
update in interface IDataAccess
Parameters:
keysValues - The conditions that the records to be updated must fulfill
attributesValues - The data for updating the records to
sessionId - Session Id for this user
Throws:
java.lang.Exception

query

public java.lang.Object query(java.lang.Object keysValues,
                              java.lang.Object attributes,
                              int sessionId)
                       throws java.lang.Exception
Description copied from interface: IDataProvider
This method must implement a standard query operation returning the set of data that matches the conditions specified by the keysValues parameter. The attributes defines which attributes (or columns if data is obtained from a database) must be recovered, and keysValues specifies which set of records must be recovered.

Specified by:
query in interface IDataProvider
Parameters:
keysValues - Identifiers for the data
attributes - Data attributes to query
sessionId - Session Id for this user
Returns:
Requested data
Throws:
java.lang.Exception

addBoundingBoxToSearch

protected void addBoundingBoxToSearch(com.vividsolutions.jts.geom.Envelope boundingBox,
                                      java.util.Hashtable<java.lang.String,java.lang.Object> keysValues)
Parse given bounding box to add new SearchValue objects to the keysValues parameters

Parameters:
boundingBox - Bounding box used in the query
keysValues - Keys hashtable to use in the query method

setBBoxColumnsFromGeometry

protected void setBBoxColumnsFromGeometry(com.vividsolutions.jts.geom.Geometry geom,
                                          java.util.Hashtable<java.lang.String,java.lang.Object> attrValuesHT,
                                          java.lang.String[] bboxColumns)

setBBoxColumnsFromGeometryVector

protected void setBBoxColumnsFromGeometryVector(java.util.Vector<com.vividsolutions.jts.geom.Geometry> geomVector,
                                                java.util.Hashtable<java.lang.String,java.lang.Object> attrValuesHT,
                                                java.lang.String[] bboxColumns)

addParentKeysToSearch

protected void addParentKeysToSearch(java.util.Hashtable<java.lang.String,java.lang.Object> parentKeys,
                                     java.util.Hashtable<java.lang.String,java.lang.Object> keysValues)

setOntimizeNullValues

protected void setOntimizeNullValues(com.ontimize.db.EntityResult result)

reprojectGeometryVector

protected java.util.Vector<com.vividsolutions.jts.geom.Geometry> reprojectGeometryVector(java.util.Vector<com.vividsolutions.jts.geom.Geometry> sourceVector,
                                                                                         java.util.Hashtable appliedFilters)

reprojectBBoxColumns

protected void reprojectBBoxColumns(com.ontimize.db.EntityResult result,
                                    java.util.Hashtable appliedFilters)