public class IlvObjectSDOWriter extends Object
close()
method.Constructor and Description |
---|
IlvObjectSDOWriter(Connection connection,
String layerName,
String geometryColumnName,
String xDimName,
String yDimName,
boolean createTable)
Constructs a writer to write data to an Oracle Spatial layer.
|
IlvObjectSDOWriter(Connection connection,
String layerName,
String geometryColumnName,
String xDimName,
String yDimName,
boolean createTable,
IlvAttributeInfoProperty info,
IlvCoordinate upperLeftCorner,
IlvCoordinate lowerRightCorner)
Constructs a writer to write data to an Oracle Spatial layer.
|
Modifier and Type | Method and Description |
---|---|
void |
close(double tolerance,
Long srID)
Closes this writer.
|
Connection |
getConnection()
Returns the current connection of the writer.
|
String |
getLayerName()
Returns the name of the current SDO layer in use.
|
protected String |
getSDOGeometryString(IlvMapFeature feature,
Long srID)
Returns the string corresponding to the SQL description of the specified feature.
|
boolean |
isCheckingStringAttributes()
Returns whether the writer is checking string attributes or not.
|
boolean |
isUsingOrderedRings()
Returns a boolean that indicates whether the order of the
IlvMapRings used
in IlvMapPolygons is known or not. |
void |
populateIndexes(int fixedTilingLevel,
int sdoNumtiles,
String indexName,
String sdoLayerName,
String sdoGeometryColumnName)
Creates the spatial index table.
|
void |
populateIndexes(int fixedTilingLevel,
int sdoNumtiles,
String indexName,
String sdoLayerName,
String sdoGeometryColumnName,
int sdoMaxlevel,
int sdoCommitInterval,
String layerGtype,
String sdoTableSpace,
String sdoInitialExtent,
String sdoNextExtent,
int sdoMinExtents,
int sdoMaxExtents,
int sdoPCTincrease,
String btreeInitialExtent,
String btreeNextExtent,
int btreePCTincrease)
Creates the spatial index table.
|
void |
setCheckingStringAttributes(boolean check)
Enables/disables the checking of string attributes.
|
void |
setUsingOrderedRings(boolean set)
Sets whether the order of the
IlvMapRings used in IlvMapPolygons
is known or not. |
void |
updateFeatureAttribute(String keyColumnName,
IlvFeatureAttribute keyAttribute,
String attributeColumnName,
IlvFeatureAttribute attributeToUpdate)
Updates a row in the SDO layer with one attribute.
|
void |
updateFeatureAttributes(IlvFeatureAttributeProperty attributes,
int keyPos)
Updates a row in the SDO layer with new attributes.
|
void |
writeFeature(IlvMapFeature feature,
boolean saveAttributes,
Long srID)
Puts the specified map feature in the database.
|
int |
writeFeatureIterator(IlvMapFeatureIterator reader,
boolean saveAttributes,
Long srID)
Writes the iterator passed as its argument into the Oracle SDO database.
|
public IlvObjectSDOWriter(Connection connection, String layerName, String geometryColumnName, String xDimName, String yDimName, boolean createTable) throws SQLException
connection
- The Connection
to the Oracle Database.
The writer turns off the connection auto commit mode.layerName
- The name of the SDO layer table. It can be made of the owner name
and the table name ("OwnerName.TableName").geometryColumnName
- The name of the column containing the geometries objects.xDimName
- The name of the X dimension.yDimName
- The name of the Y dimension.createTable
- If set to true
, the writer will create the necessary table
and entries (note that you can do this only under certain Oracle privileges).SQLException
public IlvObjectSDOWriter(Connection connection, String layerName, String geometryColumnName, String xDimName, String yDimName, boolean createTable, IlvAttributeInfoProperty info, IlvCoordinate upperLeftCorner, IlvCoordinate lowerRightCorner) throws SQLException
connection
- The Connection
to the Oracle Database.
The writer turns off the connection auto commit mode.layerName
- The name of the SDO layer table. It can be made of the owner name
and the table name ("OwnerName.TableName").geometryColumnName
- The name of the column containing the geometries objects.xDimName
- The name of the X dimension.yDimName
- The name of the Y dimension.createTable
- If set to true
, the writer will create the necessary table
and entries (note that you can do this only under certain Oracle privileges).info
- If this parameter is set, it will be used in the creation of attributes columns of the layer.upperLeftCorner
- The upper left corner of the extent of the SDO layer. If set to null
,
the corner is computed so that it fits the written data.lowerRightCorner
- The lower right corner of the extent of the SDO layer. If set to null
,
the corner is computed so that it fits the written data.SQLException
public String getLayerName()
public Connection getConnection()
public void setUsingOrderedRings(boolean set)
IlvMapRings
used in IlvMapPolygons
is known or not.
Since Oracle 8.1.6, there is an optimized mode for ordered IlvMapRings
in SDO. If you
are sure that the polygons you want to write into SDO have IlvMapRings
that have :
true
parameter.
The default mode is false
(the orders of the rings are unknown).set
- If set to true
, the orders of the rings are supposed to
be known as the Oracle scheme described above.public boolean isUsingOrderedRings()
IlvMapRings
used
in IlvMapPolygons
is known or not.setUsingOrderedRings(boolean)
public boolean isCheckingStringAttributes()
setCheckingStringAttributes(boolean)
public void setCheckingStringAttributes(boolean check)
check
- When true
, the writer checks the string attributes
before inserting them into the database.isCheckingStringAttributes()
,
writeFeature(ilog.views.maps.IlvMapFeature, boolean, java.lang.Long)
,
writeFeatureIterator(ilog.views.maps.IlvMapFeatureIterator, boolean, java.lang.Long)
,
updateFeatureAttribute(java.lang.String, ilog.views.maps.IlvFeatureAttribute, java.lang.String, ilog.views.maps.IlvFeatureAttribute)
,
updateFeatureAttributes(ilog.views.maps.IlvFeatureAttributeProperty, int)
public void updateFeatureAttributes(IlvFeatureAttributeProperty attributes, int keyPos) throws SQLException, ClassNotFoundException
IlvFeatureAttributeProperty
which has an attribute that identifies the row in the SDO layer to be modified. This attribute
has to be a KEY in order to modify one unique row in the layer after each call to this method.
No commit is done. This method handles the following attributes: IlvStringAttribute
,
IlvIntegerAttribute
, IlvDoubleAttribute
and IlvBooleanAttribute
.
The update is done only if the attributes are columns of the SDO layer itself. If the Key targets more than
one row, then they will all be updated.
For instance, let FOO be an SDO layer with 3 columns: GEOMETRY (type SDO_GEOMETRY), keyID (type
VARCHAR and created as not null key), intID (type NUMBER).
Imagine you have the following: GEOMETRY = whatever ; keyID = "UniqueKey1" ; intID = 122
If you need to update this row with the new intID 1098, then use the following code:
// Construction of the IlvAttributeInfoProperty : it can be done just once. Class[] attributeClasses = new Class[2]; boolean[] nullable = new boolean[2]; nullable[0] = nullable[1] = true; try { attributeClasses[0] = Class.forName("IlvStringAttribute"); attributeClasses[1] = Class.forName("IlvIntegerAttribute"); } catch (ClassNotFoundException e) { e.printStackTrace(); } String[] names = new String[2]; names[0] = new String("keyID"); // the first one must be the KEY names[1] = new String("intID"); IlvAttributeInfoProperty info =
new IlvAttributeInfoProperty(names, attributeClasses, nullable); // the update itself IlvFeatureAttribute[] attributes = new IlvFeatureAttribute[2]; attributes[0] = new IlvStringAttribute("UniqueKey1"); attributes[1] = new IlvIntegerAttribute(1098); // the new value for update IlvFeatureAttributeProperty prop =
new IlvFeatureAttributeProperty(info, attributes); myWriter.updateFeatureAttributes(prop, 0);
attributes
- The list of the attributes.keyPos
- The position of the key attribute in the attributes list.SQLException
ClassNotFoundException
public void updateFeatureAttribute(String keyColumnName, IlvFeatureAttribute keyAttribute, String attributeColumnName, IlvFeatureAttribute attributeToUpdate) throws SQLException, ClassNotFoundException
attributeColumnName
and
valued attributeToUpdate
in the row identified by the key named keyColumnName
and
valued keyAttribute
(Oracle KEY). If the Key targets more than one row, then
they will all be updated.
No commit is done. This method handles the following attributes: IlvStringAttribute
,
IlvIntegerAttribute
, IlvDoubleAttribute
and IlvBooleanAttribute
.
This method executes the following update statement : "UPDATE tableName SET
attributeColumnName = 'attributeToUpdate' WHERE keyColumnName = 'keyAttribute';"keyColumnName
- The name of the column in the SDO layer representing the KEY.keyAttribute
- The value of the key which is an IlvFeatureAttribute
.attributeColumnName
- The name of the column in the SDO layer to be updated.attributeToUpdate
- The value of the attribute to be updated which is an IlvFeatureAttribute
.SQLException
ClassNotFoundException
public void writeFeature(IlvMapFeature feature, boolean saveAttributes, Long srID) throws SQLException, ClassNotFoundException
feature
- The map feature to be written in the Database.saveAttributes
- If set to false
, only the IlvMapGeometry
of the feature is saved
into the SDO layer. If set to true
, the writer will also insert the
IlvFeatureAttributes
contained in the IlvFeatureAttributeProperty
of the feature.
Note that in this last case, the name of the attributes must be the same that
the column names of the Oracle SDO layer table in the database.srID
- The ID of the coordinate system as described in the CS_SRS table. This ID will be saved
in the SDO_SRID column of the SDO_GEOMETRY object wrote. You can pass it as null
.SQLException
ClassNotFoundException
public int writeFeatureIterator(IlvMapFeatureIterator reader, boolean saveAttributes, Long srID) throws Exception
reader
- The IlvMapFeatureIterator
instance.saveAttributes
- If set to false
, only the IlvMapGeometry
of the feature is saved
into the SDO layer. If set to true
, the writer will also insert the
IlvFeatureAttributes
contained in the IlvFeatureAttributeProperty
of the feature.
Note that in this last case, the name of the attributes must be the same that
the column names of the Oracle SDO layer table in the database.srID
- The ID of the coordinate system as described in the CS_SRS table. This ID will be saved
in the SDO_SRID column of the SDO_GEOMETRY objects wrote. You can pass it as null
.Exception
writeFeature(ilog.views.maps.IlvMapFeature, boolean, java.lang.Long)
protected String getSDOGeometryString(IlvMapFeature feature, Long srID) throws ClassNotFoundException, SQLException
(0,50,0,-50); insert into OwnerName.TableName(GEOMETRY) valuesThe 'v' argument passed to the values statement is necessary because the final request for the linestring will be for instance of the following shape:
(MDSYS.SDO_GEOMETRY(2, srID, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1), v));
declare v MDSYS.SDO_ORDINATE_ARRAY; begin v:= MDSYS.SDO_ORDINATE_ARRAY(0,50,0,-50); insert into OwnerName.TableName(GEOMETRY) values
(MDSYS.SDO_GEOMETRY(2, srID, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1), v)); end;
feature
- The IlvMapFeature
to be mapped into a string.srID
- The ID of the coordinate system as described in the CS_SRS table. This ID will appear
in the geometry string returned by this method. You can pass it as null
.ClassNotFoundException
SQLException
public void populateIndexes(int fixedTilingLevel, int sdoNumtiles, String indexName, String sdoLayerName, String sdoGeometryColumnName, int sdoMaxlevel, int sdoCommitInterval, String layerGtype, String sdoTableSpace, String sdoInitialExtent, String sdoNextExtent, int sdoMinExtents, int sdoMaxExtents, int sdoPCTincrease, String btreeInitialExtent, String btreeNextExtent, int btreePCTincrease) throws SQLException
IlvObjectSDOLayer
.
This method just calls the Oracle SDO CREATE INDEX statement. The parameters are the
same as the ones of this statement. To have your data correctly indexed, please
refer to the Oracle SDO documentation (this is strongly recommended). Note that
Oracle recommends the use of R-Tree indexes since Oracle 9i. To have an R-Tree
index, set the first two parameters of the method to 0
.SQLException
public void populateIndexes(int fixedTilingLevel, int sdoNumtiles, String indexName, String sdoLayerName, String sdoGeometryColumnName) throws SQLException
IlvObjectSDOLayer
.SQLException
public void close(double tolerance, Long srID) throws SQLException
Connection
.
This method should be called after each set of calls to #writeFeature
.tolerance
- The tolerance of the layer that is inserted in the [USER_]SDO_GEOM_METADATA table.srID
- The id of the Coordinate System as described in the CS_SRS table. This id will be saved
in the [USER_]SDO_GEOM_METADATA in the SRID column. You can pass it as null.SQLException
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.