Class PostgreServerHandler
java.lang.Object
com.kheops.jmap.server.datasources.egdb.EgdbHandler
com.kheops.jmap.server.datasources.egdb.PostgreServerHandler
Implements all needed methods to handle an Postgre database.
-
Field Summary
Fields inherited from class com.kheops.jmap.server.datasources.egdb.EgdbHandler
requestFID, requestOID
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendAttributeFilter
(AttributeFilter filter, StringBuffer filterBuffer) Append to the filter buffer a new condition using the attribute's name and attribute's value.void
appendGeometryTypesFilter
(GeometryTypesFilter filter, StringBuffer filterBuffer) Append to the filter buffer a new condition using the geometry type.void
appendSpatialFilter
(SpatialQueryFilter filter, StringBuffer filterBuffer) Append to the filter buffer a new condition using the method to determine relationship between geometries.void
appendSqlFilter
(SQLQueryFilter filter, StringBuffer queryBuffer, StringBuffer orderByBuffer) Append to the filter buffer a new condition using the boundaries.buildGeometrySelectStatement
(Attribute[] attributes) Build the select statement for geometry storage type.Method to decode a geometryvoid
determineBinaryInformation
(EgdbFeatureConfig featureConfig) Set feature geometry table, indexes and spatial column name where the geometry is stored.Method to encode a JMap geometryint
Extract the srid form the spatial reference tableprotected String
For versioned layer, this method establishes the restriction to exclude elements that have been removed.int
getAttributeCount
(String attributeName, String queryFilter) Method for attribute statistics.Domain[]
Return the available coded value domains if they exist, otherwise return an empty array.Gets the geometry type name of the layer: ST_POINT, ST_POLYGON,...String[]
Get all available name of the existing layersDomain[]
Return the available range domains if they exist, otherwise return and empty array All available domains will be returned even if they are used or notMethod to return the definition of the all columns of the ESRI Data base.protected String
getDbInstance
(String urlConnection) To return the instance's name of the ESRI databaseReturn an String with the defaults storage type inside the DBTUNE table.The name of Delta table A (adds)The name of Delta table D (deletes)int
Return the total amount of spatial elementsgetFeatureExtent
(String queryFilter) Return the extend of the filtered features when the storage type is SDEBINAY and as consequence a feature table must existsProperties of the feature falseX, falseY, minX, minY, maxX, maxY, gSize, xyUnits, dbNameReturn the name of the feature tablegetGeometryExtent
(String filter) Return the extend of the filtered features when the storage type is GEOMETRYTo get the geometry column name of the layer.When the storage type is binary then the spatial data is saved in the feature table and its attributes remain in the base table.getGeometryStorageType
(String key_config) To get the name of the geometry identifier column name.Return the name of the table which register the last object id value of the layer.Return the name of the spatial index tableint
getJMapAvailableGeometryType
(String geometryType) Gets the JMap geometry type of the layerReturn a String with the layer configuration keyword that was specified when the layer was created e.g.int
getLayerGeometryTypeCode
(Geometry geometry) Get the SDE geometry type code.int
Return the layer id from the layers tableint
This method is deprecated, use extractSridFromSpatialReference() instead Return the srid from sde_spatial_references table.long
getNextId
(int requestId) Used during the insert transaction, to generate the identifier of the new record to insertgetNumericStats
(String attributeName, String queryFilter) Calculate MIN, MAX, AVG, STDEV for numeric attributegetRelatedDomainName
(String attributeName) Return the domain name related to an attribute if both are related.protected String[]
Return an array with the names of the default systems tablesint
Return the identifier of the base table in the SDE_table_registry table.getUniqueValues
(String attributeName, String queryFilter) Return the unique values to storing themReturn the version of the Enterprise GeoDataBase e.g 10.0.0 or 10.2.1protected String
For versioned layer, this method establishes the restriction to exclude elements that have been removed or those elements that correspond to an old version.void
insertElement
(JMapGeoElement geoElement, EditionResult result, Attribute[] attributes) Execute the insertion of the new geoElement.boolean
The feature is versioned or notvoid
loadRelationships
(Attribute attribute) Find possible relationShips with the given attributeprocessDeleteStatement
(long elementsIds) Delete elements from base table.processUpdateStatement
(JMapGeoElement[] elements, Attribute[] attributes) Update elements for unversioned layers.processVersionedDeleteStatement
(long elementsIds) Insert elements in delete delta tables.processVersionedUpdateStatement
(JMapGeoElement[] elements, Attribute[] attributes) Update elements for versioned layers.setupQueryFilters
(QueryFilter[] queryFilters) Build the SQL condition to apply the query filters.protected int
Convert an EGDB domain type to SQL typeMethods inherited from class com.kheops.jmap.server.datasources.egdb.EgdbHandler
availableSchemaNames, buildBinarySqlQuery, buildGeometrySqlQuery, buildQuery, buildVersionedGeometrySqlQuery, bytesToHex, calculateGeometryArea, calculateGeometryLength, calculateNumOfPts, checkGeodatabaseFromSchema, convertCodedValues, convertComparisonClauses, databaseSchema, existsAdditionalSystemTables, extractAttributeName, extractAttributeValues, extractLayerGeometries, filterExcludeRemovedElementsFromBase, getAttributes, getAvailableDomains, getDefaultVersionState, getEgdbDataSourceInfo, getEgdbDialect, getElementsCount, getStorageType, getVersionedElements, isGeodatabase, queryStatesFromVersion, setEgdbDataSourceInfo, setEgdbDialect, systemSchema, updateEgdbDataSourceInfo
-
Constructor Details
-
PostgreServerHandler
-
-
Method Details
-
encode
Description copied from class:EgdbHandler
Method to encode a JMap geometry- Specified by:
encode
in classEgdbHandler
- Throws:
SQLException
-
decode
Description copied from class:EgdbHandler
Method to decode a geometry- Specified by:
decode
in classEgdbHandler
- Parameters:
spatialData
- Spatial data to decodenumofpts
- Valid for OGCWKB and SDEBINARY storage type. Useful only for SDEBINARY storage type. For the other storage type is null- Returns:
- The decoded JMap geometry
- Throws:
Exception
-
appendSqlFilter
public void appendSqlFilter(SQLQueryFilter filter, StringBuffer queryBuffer, StringBuffer orderByBuffer) throws Exception Description copied from class:EgdbHandler
Append to the filter buffer a new condition using the boundaries.- Specified by:
appendSqlFilter
in classEgdbHandler
- Throws:
Exception
-
appendSpatialFilter
Description copied from class:EgdbHandler
Append to the filter buffer a new condition using the method to determine relationship between geometries.- Specified by:
appendSpatialFilter
in classEgdbHandler
- Parameters:
filter
- Spatial relationship method between geometries.filterBuffer
- String buffer which value is the query which the filter is going to append
-
appendGeometryTypesFilter
Description copied from class:EgdbHandler
Append to the filter buffer a new condition using the geometry type.- Specified by:
appendGeometryTypesFilter
in classEgdbHandler
- Parameters:
filter
- Available geometry typefilterBuffer
- String buffer which value is the query which the filter is going to append.
-
appendAttributeFilter
Description copied from class:EgdbHandler
Append to the filter buffer a new condition using the attribute's name and attribute's value. The statement is build taking into account the attribute's value data type.- Specified by:
appendAttributeFilter
in classEgdbHandler
- Parameters:
filter
- Attribute used in the condition.filterBuffer
- String buffer which value is the query which the filter is going to append.
-
getIdColumn
Description copied from class:EgdbHandler
To get the name of the geometry identifier column name.- Specified by:
getIdColumn
in classEgdbHandler
- Returns:
- The name of the ID column in the base table
- Throws:
SQLException
-
getGeometrySpatialColumn
Description copied from class:EgdbHandler
To get the geometry column name of the layer.- Specified by:
getGeometrySpatialColumn
in classEgdbHandler
- Returns:
- The name of the Geometry column in the base table
- Throws:
Exception
-
getColumnDefinition
Description copied from class:EgdbHandler
Method to return the definition of the all columns of the ESRI Data base. Every particular handler need to implement the way to get it. In the return array is included the OBJECT_ID and the SHAPE columns- Specified by:
getColumnDefinition
in classEgdbHandler
- Throws:
SQLException
-
getVersion
Description copied from class:EgdbHandler
Return the version of the Enterprise GeoDataBase e.g 10.0.0 or 10.2.1- Specified by:
getVersion
in classEgdbHandler
- Throws:
SQLException
- Error occurred while retrieving the version of the Enterprise GeoDatabase
-
getLayerConfig
Description copied from class:EgdbHandler
Return a String with the layer configuration keyword that was specified when the layer was created e.g. DEFAULTS, GEOMETRY, WKB_GEOMETRY. Other values need to be explored- Specified by:
getLayerConfig
in classEgdbHandler
- Throws:
SQLException
- Error raised extracting the configuration of a layer
-
getDefaultsStorageType
Description copied from class:EgdbHandler
Return an String with the defaults storage type inside the DBTUNE table. The result depends of the DBMS e.g. SQLServer: Geometry, Geography, SDEBinary, OGCWKB- Specified by:
getDefaultsStorageType
in classEgdbHandler
- Throws:
SQLException
- Error raised extracting the default storage type
-
getGeometryStorageType
- Specified by:
getGeometryStorageType
in classEgdbHandler
- Throws:
SQLException
- Error raised extracting the geometry storage type
-
getAvailableLayerNames
Description copied from class:EgdbHandler
Get all available name of the existing layers- Specified by:
getAvailableLayerNames
in classEgdbHandler
- Throws:
SQLException
-
getDbInstance
Description copied from class:EgdbHandler
To return the instance's name of the ESRI database- Specified by:
getDbInstance
in classEgdbHandler
-
getLayerId
public int getLayerId()Description copied from class:EgdbHandler
Return the layer id from the layers table- Specified by:
getLayerId
in classEgdbHandler
-
getFeatureTableName
Description copied from class:EgdbHandler
Return the name of the feature table- Specified by:
getFeatureTableName
in classEgdbHandler
-
getIndexTableName
Description copied from class:EgdbHandler
Return the name of the spatial index table- Specified by:
getIndexTableName
in classEgdbHandler
-
getDeltaTableAdds
Description copied from class:EgdbHandler
The name of Delta table A (adds)- Specified by:
getDeltaTableAdds
in classEgdbHandler
- Throws:
SQLException
-
getDeltaTableDeletes
Description copied from class:EgdbHandler
The name of Delta table D (deletes)- Specified by:
getDeltaTableDeletes
in classEgdbHandler
- Throws:
SQLException
-
getFeatureProperties
Description copied from class:EgdbHandler
Properties of the feature falseX, falseY, minX, minY, maxX, maxY, gSize, xyUnits, dbName- Specified by:
getFeatureProperties
in classEgdbHandler
- Throws:
SQLException
- Raised when an exception occurs retrieving the properties of the feature
-
getAvailableCodedValueDomains
Description copied from class:EgdbHandler
Return the available coded value domains if they exist, otherwise return an empty array. All available domains will be returned even if they are used or not- Specified by:
getAvailableCodedValueDomains
in classEgdbHandler
- Throws:
Exception
- Raised while loading the coded value domains
-
getAvailableRangeDomains
Description copied from class:EgdbHandler
Return the available range domains if they exist, otherwise return and empty array All available domains will be returned even if they are used or not- Specified by:
getAvailableRangeDomains
in classEgdbHandler
- Throws:
Exception
- Raised while loading the range domains
-
getRelatedDomainName
Description copied from class:EgdbHandler
Return the domain name related to an attribute if both are related. Otherwise return null- Specified by:
getRelatedDomainName
in classEgdbHandler
- Throws:
SQLException
-
isVersioned
Description copied from class:EgdbHandler
The feature is versioned or not- Specified by:
isVersioned
in classEgdbHandler
- Throws:
SQLException
- raised while retrieving the definition column of the layer
-
setupQueryFilters
Description copied from class:EgdbHandler
Build the SQL condition to apply the query filters. The method also reduce the search when storage type is SDEBinary- Specified by:
setupQueryFilters
in classEgdbHandler
- Throws:
Exception
-
getAvailableGeometryType
Description copied from class:EgdbHandler
Gets the geometry type name of the layer: ST_POINT, ST_POLYGON,...- Specified by:
getAvailableGeometryType
in classEgdbHandler
- Returns:
- ST_GEOMETRY type
- Throws:
SQLException
-
getTableRegistryId
Description copied from class:EgdbHandler
Return the identifier of the base table in the SDE_table_registry table. This identifier is used to find the delta tables when the layer is versioned- Specified by:
getTableRegistryId
in classEgdbHandler
- Throws:
SQLException
- Raised when an error occurs retrieving the registry id of the layer
-
getGeometrySpatialDataColumn
Description copied from class:EgdbHandler
When the storage type is binary then the spatial data is saved in the feature table and its attributes remain in the base table. So it is necessary to know where to look for the geometry spatial data to extract the layer's elements.- Specified by:
getGeometrySpatialDataColumn
in classEgdbHandler
- Throws:
SQLException
-
getFeatureExtent
Description copied from class:EgdbHandler
Return the extend of the filtered features when the storage type is SDEBINAY and as consequence a feature table must exists- Specified by:
getFeatureExtent
in classEgdbHandler
-
getJMapAvailableGeometryType
Description copied from class:EgdbHandler
Gets the JMap geometry type of the layer- Specified by:
getJMapAvailableGeometryType
in classEgdbHandler
- Returns:
- ST_GEOMETRY type
-
getAttributeCount
Description copied from class:EgdbHandler
Method for attribute statistics. Calculate the distinct count of a attribute- Specified by:
getAttributeCount
in classEgdbHandler
- Throws:
Exception
-
getUniqueValues
public Hashtable<Object,Object> getUniqueValues(String attributeName, String queryFilter) throws Exception Description copied from class:EgdbHandler
Return the unique values to storing them- Specified by:
getUniqueValues
in classEgdbHandler
- Throws:
Exception
-
getNumericStats
Description copied from class:EgdbHandler
Calculate MIN, MAX, AVG, STDEV for numeric attribute- Specified by:
getNumericStats
in classEgdbHandler
- Throws:
Exception
-
getElementCount
Description copied from class:EgdbHandler
Return the total amount of spatial elements- Specified by:
getElementCount
in classEgdbHandler
- Throws:
SQLException
-
getSystemTables
Description copied from class:EgdbHandler
Return an array with the names of the default systems tables- Specified by:
getSystemTables
in classEgdbHandler
-
determineBinaryInformation
Description copied from class:EgdbHandler
Set feature geometry table, indexes and spatial column name where the geometry is stored.- Specified by:
determineBinaryInformation
in classEgdbHandler
- Throws:
SQLException
- Raised when an error occurs extracting feature geometry table, indexes or spatial column name
-
extractSridFromSpatialReference
Description copied from class:EgdbHandler
Extract the srid form the spatial reference table- Specified by:
extractSridFromSpatialReference
in classEgdbHandler
- Throws:
SQLException
- Error occurred while retrieving the srid of the layer
-
getLayerSrid
Description copied from class:EgdbHandler
This method is deprecated, use extractSridFromSpatialReference() instead Return the srid from sde_spatial_references table. This value is used to work with SQLServer geo-database to extract and insert elements- Specified by:
getLayerSrid
in classEgdbHandler
- Throws:
Exception
-
getGeometryExtent
Description copied from class:EgdbHandler
Return the extend of the filtered features when the storage type is GEOMETRY- Specified by:
getGeometryExtent
in classEgdbHandler
- Throws:
Exception
-
insertElement
public void insertElement(JMapGeoElement geoElement, EditionResult result, Attribute[] attributes) throws Exception Description copied from class:EgdbHandler
Execute the insertion of the new geoElement. Prepare insertion query statement.- Specified by:
insertElement
in classEgdbHandler
- Parameters:
geoElement
- New element to be insertedresult
- Out parameter with the operation's result- Throws:
Exception
-
getIdentifierManagerTableName
Description copied from class:EgdbHandler
Return the name of the table which register the last object id value of the layer. This name is useful to identify the store procedure's name to execute and return the next objectId value. This value is going to be use into an insert statement.- Specified by:
getIdentifierManagerTableName
in classEgdbHandler
- Throws:
SQLException
-
getNextId
Description copied from class:EgdbHandler
Used during the insert transaction, to generate the identifier of the new record to insert- Specified by:
getNextId
in classEgdbHandler
- Returns:
- The next ID available or 0 if none exists
- Throws:
Exception
-
processDeleteStatement
Description copied from class:EgdbHandler
Delete elements from base table. This method is used to delete element for unversioned layers- Specified by:
processDeleteStatement
in classEgdbHandler
-
processVersionedDeleteStatement
Description copied from class:EgdbHandler
Insert elements in delete delta tables. This method is used to delete elements for versioned layers.- Specified by:
processVersionedDeleteStatement
in classEgdbHandler
- Throws:
Exception
-
processUpdateStatement
Description copied from class:EgdbHandler
Update elements for unversioned layers.- Specified by:
processUpdateStatement
in classEgdbHandler
-
processVersionedUpdateStatement
public EditionResult[] processVersionedUpdateStatement(JMapGeoElement[] elements, Attribute[] attributes) throws Exception Description copied from class:EgdbHandler
Update elements for versioned layers.- Specified by:
processVersionedUpdateStatement
in classEgdbHandler
- Throws:
Exception
-
getLayerGeometryTypeCode
Description copied from class:EgdbHandler
Get the SDE geometry type code. This is the code inserted in entity column when a geometry is inserted in F# table. POINT_SHAPE 1 LINE_SHAPE 2 AREA_SHAPE 8- Specified by:
getLayerGeometryTypeCode
in classEgdbHandler
-
toSqlType
Description copied from class:EgdbHandler
Convert an EGDB domain type to SQL type- Specified by:
toSqlType
in classEgdbHandler
-
loadRelationships
Description copied from class:EgdbHandler
Find possible relationShips with the given attribute- Specified by:
loadRelationships
in classEgdbHandler
- Throws:
SQLException
-
buildGeometrySelectStatement
Description copied from class:EgdbHandler
Build the select statement for geometry storage type.- Specified by:
buildGeometrySelectStatement
in classEgdbHandler
-
getVersionedElements10
Description copied from class:EgdbHandler
For versioned layer, this method establishes the restriction to exclude elements that have been removed or those elements that correspond to an old version. Elements from delta table 'A' which are in delta table 'D' are not included in the result. This method may change depending on DMBS because it call the function SDE_get_view_state() included on ArcGIS 10.x- Specified by:
getVersionedElements10
in classEgdbHandler
- Returns:
- Sql query to be used into a sql condition.
-
filterExcludeRemovedElementsFromBase10
Description copied from class:EgdbHandler
For versioned layer, this method establishes the restriction to exclude elements that have been removed. Elements from base table which are in delta table 'D' are not included in the result. This method may change depending on DMBS because it call the function SDE_get_view_state() included on ArcGIS 10.x- Specified by:
filterExcludeRemovedElementsFromBase10
in classEgdbHandler
- Returns:
- Sql query to be used into a sql condition.
- Throws:
SQLException
-