com.moximedia.aims
Class AimsRecordset

java.lang.Object
  extended bycom.moximedia.aims.AimsRecordset
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class AimsRecordset
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

The AimsRecordset class is associated to AimsFeatureLayer objects to contain data associated with the features. When initialized, the recordset is empty, but records are added when the feature layer is queried or identified. The recordset can be queried using a text query, a spatial filter, or a combination of both. The recordset contains two important collections, a FIELDS collection that contains details about each field, and a FEATURES collection which contains the actual records returned by the query filters. However, in most cases, the programmer can perform all recordset operations using the methods contained in this class.

See Also:
Serialized Form

Constructor Summary
AimsRecordset()
          Creates a new AimsRecordset.
 
Method Summary
protected  boolean addFeature(AimsFeature feature)
          Adds a feature to the features collection.
 boolean addField(AimsField fld)
          Adds a field to the fields collection.
 boolean BOF()
          Returns true if the recordset is at the beginning (before the first record).
 boolean bufferedEOF()
          Returns true if the recordset is at the end of the buffered response (after the last record).
 boolean bufferedMoveNext()
          Moves the recordset pointer to the next record.
 void clear()
          Clears the recordset (removes all features)
 void clearFilter()
          Clears the filter associated with a recordset
 java.lang.Object clone()
          Creates a copy of this recordset.
 boolean EOF()
          Returns true if the recordset is at the end (after the last record).
 java.lang.String getAxlError()
          Sets the error message received from ArcIMS that is related to the most recent recordset query.
 int getBufferSize()
          Gets the buffer size used when retrieving features from the server.
 AimsRecordset getCopy()
           
 AimsEnvelope getFeatureExtent()
          Returns the extent of the specified field for the current recordset record.
 AimsFeatures getFeatures()
          Returns the features collection.
 AimsField getField(int index)
          Gets the field at the specified index of the collection.
 AimsField getField(java.lang.String name)
          Gets the field matching the specified name.
 java.util.Vector getFields()
          Gets the fields collection associated with the recordset.
 AimsFilter getFilter()
          Gets the filter used to query this recordset.
 int getIdentifyMaximumResults()
          Returns the number of maximum results that can be returned by a query.
protected  AimsFeatureLayer getLayer()
           
 AimsRecordset getLayerManagerCopy(AimsMap map, AimsFeatureLayer lyr)
          Creates a copy of this recordset for use in another map.
 java.util.ArrayList getMapTipFields()
           
 int getMaximumResults()
          Returns the number of maximum results that can be returned by a query.
 java.lang.String getRequestAxl()
           
 java.lang.String getResponseAxl()
           
 AimsField getRowIdField()
          Gets the rowid field from the recordset's field collection.
 java.util.HashSet getSelectedSet()
           
 int getSelectedSetCount()
           
 AimsField getSelectedSetField()
           
 java.util.HashSet getSelectedSetSelection()
           
 int getSelectMaximumResults()
          Returns the number of maximum results that can be returned by a query.
 AimsShapeObject getShape()
           
 AimsField getSortField()
           
 boolean hasMapTipFields()
          Returns an indicator of whether the recordset has any fields that can be used as map tips.
 boolean hasMoreRecords()
          Returns a boolean value indicating whether there are more records to be loaded from the server.
 boolean hasSelectedSet()
           
 boolean hasSelection()
           
 void moveField(AimsField fld, int toIndex)
          Moves a field to the specified position in the fields list.
 void moveField(int fromIndex, int toIndex)
          Moves a field to a new position.
 boolean moveFirst()
          Moves the recordset pointer to the first record.
 boolean moveNext()
          Moves the recordset pointer to the next record.
 boolean moveNextGeometry()
          Moves the recordset pointer to the next record.
 boolean movePrevious()
          Moves the recordset pointer to the previous record.
 boolean query()
          Submits a query to refresh the recordset based on the filter.
 boolean query(boolean clearRecordset, boolean getAttributes, boolean getGeometry, int beginRecord)
          Submits a query to refresh the recordset based on the filter.
 boolean queryGeometry()
          Submits a query to refresh the recordset based on the filter.
 void removeField(int index)
          Removes the specified field from the fields list.
 void removeField(java.lang.String name)
          Removes the specified field from the fields list.
 void removeNonServiceFields()
          Removes the fields in the recordset that are not service fields.
protected  void setAxlError(java.lang.String errorMsg)
          Sets the error message related to the recordset query.
 void setBufferSize(int bufferSize)
           
protected  void setFeatures(AimsFeatures features)
           
 void setFilter(AimsFilter filter)
           
 void setIdentifyMaximumResults(int maximumResults)
          Sets the maximum results that can be returned by a query.
protected  void setLayer(AimsFeatureLayer layer)
           
protected  void setMap(AimsMap map)
           
 void setMaximumResults(int maximumResults)
          Sets the maximum results that can be returned by a query.
 void setSelectedSet(java.util.HashSet set)
           
 void setSelectedSetField(AimsField fld)
           
 void setSelectedSetSelection(java.util.HashSet set)
           
 void setSelectMaximumResults(int maximumResults)
          Sets the maximum results that can be returned by a query.
 void setSortField(AimsField field)
           
 void sort()
           
 void sort(AimsField field)
          Sorts the elements by the specified field.
 java.lang.String toString()
          Returns a text representation of of this class.
 boolean usesSelectedSet()
           
 void usesSelectedSet(boolean usesSelectedSet)
           
 java.lang.String valueAsString(AimsField field)
          Returns the contents of the specified field for the current recordset record as a string value.
 java.lang.String valueAsString(java.lang.String fieldName)
          Returns the contents of the specified field for the current recordset record as a string value.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AimsRecordset

public AimsRecordset()
Creates a new AimsRecordset. Note that a working recordset cannot be created by an outside process developed by a programmer, so don't use this method.

Method Detail

getSortField

public AimsField getSortField()

setSortField

public void setSortField(AimsField field)

sort

public void sort(AimsField field)
Sorts the elements by the specified field.

Parameters:
field - The field to sort by.

sort

public void sort()

getLayerManagerCopy

public AimsRecordset getLayerManagerCopy(AimsMap map,
                                         AimsFeatureLayer lyr)
Creates a copy of this recordset for use in another map. Intended for the layer manager process. Note: Does not clone the features contained in the recordset.

Parameters:
map - The map where this layer will be used.
lyr - The layer that uses this recordset.
Returns:
A copy of this feature layer.

clone

public java.lang.Object clone()
Creates a copy of this recordset.

Returns:
An object that is a copy of this recordset. Note that the cloned recordset does not include the feature records of the original recordset. Cast this object back to an AimsRecordset before using.

getCopy

public AimsRecordset getCopy()

setSelectedSetSelection

public void setSelectedSetSelection(java.util.HashSet set)

getSelectedSetSelection

public java.util.HashSet getSelectedSetSelection()

usesSelectedSet

public boolean usesSelectedSet()

usesSelectedSet

public void usesSelectedSet(boolean usesSelectedSet)

hasSelectedSet

public boolean hasSelectedSet()

hasSelection

public boolean hasSelection()

setSelectedSetField

public void setSelectedSetField(AimsField fld)

getSelectedSetField

public AimsField getSelectedSetField()

getSelectedSetCount

public int getSelectedSetCount()

getSelectedSet

public java.util.HashSet getSelectedSet()

setSelectedSet

public void setSelectedSet(java.util.HashSet set)

setFeatures

protected void setFeatures(AimsFeatures features)

getMaximumResults

public int getMaximumResults()
Returns the number of maximum results that can be returned by a query. When this result is reached, the EOF method returns true.

Returns:
The maximum records returned by a query.

setMaximumResults

public void setMaximumResults(int maximumResults)
Sets the maximum results that can be returned by a query. When this result is reached, the EOF method returns true.

Parameters:
maximumResults - The maximum records to return.

getIdentifyMaximumResults

public int getIdentifyMaximumResults()
Returns the number of maximum results that can be returned by a query. When this result is reached, the EOF method returns true.

Returns:
The maximum records returned by a query.

setIdentifyMaximumResults

public void setIdentifyMaximumResults(int maximumResults)
Sets the maximum results that can be returned by a query. When this result is reached, the EOF method returns true.

Parameters:
maximumResults - The maximum records to return.

getSelectMaximumResults

public int getSelectMaximumResults()
Returns the number of maximum results that can be returned by a query. When this result is reached, the EOF method returns true.

Returns:
The maximum records returned by a query.

setSelectMaximumResults

public void setSelectMaximumResults(int maximumResults)
Sets the maximum results that can be returned by a query. When this result is reached, the EOF method returns true.

Parameters:
maximumResults - The maximum records to return.

getRequestAxl

public java.lang.String getRequestAxl()

getResponseAxl

public java.lang.String getResponseAxl()

setMap

protected void setMap(AimsMap map)

setLayer

protected void setLayer(AimsFeatureLayer layer)

getLayer

protected AimsFeatureLayer getLayer()

getFilter

public AimsFilter getFilter()
Gets the filter used to query this recordset.

Returns:
An AimsFilter object containing the filter used to query this recordset.

setFilter

public void setFilter(AimsFilter filter)

getBufferSize

public int getBufferSize()
Gets the buffer size used when retrieving features from the server. This is the number of records that are returned in a single request.

Returns:
The number of records returned in a single request.

setBufferSize

public void setBufferSize(int bufferSize)

BOF

public boolean BOF()
Returns true if the recordset is at the beginning (before the first record).

Returns:
True if the recorset is at the beginning.

EOF

public boolean EOF()
Returns true if the recordset is at the end (after the last record).

Returns:
True if the recorset is at the end.

bufferedEOF

public boolean bufferedEOF()
Returns true if the recordset is at the end of the buffered response (after the last record). This method does not report true if there are more records to retrieve from the server like the EOF() method does.

Returns:
True if the recorset is at the end.

query

public boolean query()
Submits a query to refresh the recordset based on the filter.

Returns:
true if successful

queryGeometry

public boolean queryGeometry()
Submits a query to refresh the recordset based on the filter.

Returns:
true if successful

query

public boolean query(boolean clearRecordset,
                     boolean getAttributes,
                     boolean getGeometry,
                     int beginRecord)
Submits a query to refresh the recordset based on the filter. This method has arguments to initialize the recordset, and to request the starting point for the result set. This method is used by the identify routines, and it is suggested the the programmer use the query() method instead.

Parameters:
clearRecordset - True if the recordset should be cleared.
beginRecord - 1 to start at the first record, otherwise a positive number. This is used to get more records when the cache routine only sends a partial recordset.
Returns:
true if successful

moveNext

public boolean moveNext()
Moves the recordset pointer to the next record. This method could move the pointer beyond the last record, so it is important to check that you are pointing to a valid record by refering to the result of this method or calling the EOF() method. The difference between this method and the bufferedMoveNext() method is that this one reads more records after the last record. The bufferedMoveNext() method reports EOF() at the end of the buffered record set. Note that this method does not return the geometry of the feature. To move to the next record fetching geometry, use the moveNextGeometry() method instead.

Returns:
true if the record points at a valid record, false if not.

moveNextGeometry

public boolean moveNextGeometry()
Moves the recordset pointer to the next record. This method could move the pointer beyond the last record, so it is important to check that you are pointing to a valid record by refering to the result of this method or calling the EOF() method. The difference between this method and the bufferedMoveNext() method is that this one reads more records after the last record. The bufferedMoveNext() method reports EOF() at the end of the buffered record set. Note that this method returns the geometry of the feature. To move to the next record without fetching geometry, use the moveNext() method instead.

Returns:
true if the record points at a valid record, false if not.

bufferedMoveNext

public boolean bufferedMoveNext()
Moves the recordset pointer to the next record. This method could move the pointer beyond the last record, so it is important to check that you are pointing to a valid record by refering to the result of this method or calling the EOF() method. The difference between this method and the moveNext() method is that this one does not read more records after the last record like the moveNext method does.

Returns:
true if the record points at a valid record, false if not.

movePrevious

public boolean movePrevious()
Moves the recordset pointer to the previous record. This method could move the pointer before the first record, so it is important to check that you are pointing to a valid record by refering to the result of this method or calling the BOF() method.

Returns:
true if the record points at a valid record, false if not.

moveFirst

public boolean moveFirst()
Moves the recordset pointer to the first record. There might not be any records, so it is important to check that you are pointing to a valid record by refering to the result of this method or calling the BOF() and EOF() method.

Returns:
true if the record points at a valid record, false if not.

valueAsString

public java.lang.String valueAsString(java.lang.String fieldName)
Returns the contents of the specified field for the current recordset record as a string value. This method returns an error string if the current record does not point at a valid record.

Parameters:
fieldName - The name of the field that contents are requested.
Returns:
The content of the field as a string

valueAsString

public java.lang.String valueAsString(AimsField field)
Returns the contents of the specified field for the current recordset record as a string value. This method returns an error string if the current record does not point at a valid record.

Parameters:
field - The field that contents are requested.
Returns:
The content of the field as a string

getShape

public AimsShapeObject getShape()

getFeatureExtent

public AimsEnvelope getFeatureExtent()
Returns the extent of the specified field for the current recordset record. This method returns an error string if the current record does not point at a valid record.

Returns:
The extent of the field as an AimsEnvelope

hasMapTipFields

public boolean hasMapTipFields()
Returns an indicator of whether the recordset has any fields that can be used as map tips.

Returns:
True if there are any map tip fields, otherwise false.

getMapTipFields

public java.util.ArrayList getMapTipFields()

hasMoreRecords

public boolean hasMoreRecords()
Returns a boolean value indicating whether there are more records to be loaded from the server.

Returns:
True if more records exist, else false.

clear

public void clear()
Clears the recordset (removes all features)


clearFilter

public void clearFilter()
Clears the filter associated with a recordset


getFeatures

public AimsFeatures getFeatures()
Returns the features collection.

Returns:
the features collection containing the current records of the recordset.

addFeature

protected boolean addFeature(AimsFeature feature)
Adds a feature to the features collection. This method is protected, as features cannot be arbitrarily added by the programmer.

Parameters:
feature - A feature to add to the feature collection.
Returns:
True if successful, otherwise false.

addField

public boolean addField(AimsField fld)
Adds a field to the fields collection.

Parameters:
fld - A field to add to the fields collection.
Returns:
True if successful, otherwise false.

getFields

public java.util.Vector getFields()
Gets the fields collection associated with the recordset.

Returns:
The fields collection associated with the recordset.

getRowIdField

public AimsField getRowIdField()
Gets the rowid field from the recordset's field collection.

Returns:
The rowid field, or null if no rowid field is found.

getField

public AimsField getField(int index)
Gets the field at the specified index of the collection.

Returns:
An AimsField if the field is found, otherwise null.

getField

public AimsField getField(java.lang.String name)
Gets the field matching the specified name.

Returns:
An AimsField if the field is found, otherwise null.

removeNonServiceFields

public void removeNonServiceFields()
Removes the fields in the recordset that are not service fields. Service fields are those that were read from the GET_SERVICE_INFO request.


removeField

public void removeField(int index)
Removes the specified field from the fields list.

Parameters:
index - The index number of the field.

removeField

public void removeField(java.lang.String name)
Removes the specified field from the fields list.

Parameters:
name - The name of the field.

moveField

public void moveField(AimsField fld,
                      int toIndex)
Moves a field to the specified position in the fields list.

Parameters:
fld - The field to move.
toIndex - The location to move to.

moveField

public void moveField(int fromIndex,
                      int toIndex)
Moves a field to a new position.

Parameters:
fromIndex - The original position.
toIndex - The new position.

toString

public java.lang.String toString()
Returns a text representation of of this class.

Returns:
A string describing the class

setAxlError

protected void setAxlError(java.lang.String errorMsg)
Sets the error message related to the recordset query. To be set by the SAX handler process only.

Parameters:
errorMsg - The error received from ArcIMS.

getAxlError

public java.lang.String getAxlError()
Sets the error message received from ArcIMS that is related to the most recent recordset query. If there was no AXL error, the



Internet Mapping Framework for ArcIMS Java Object Model API (v5.0.004)
Copyright © 2005 Moxi Media Inc. and Province of British Columbia. All Rights Reserved.