Class AbstractDataSet


  • public abstract class AbstractDataSet
    extends java.lang.Object
    Abstract class to represent editable data sets
    • Field Detail

      • READ_ONLY_SET

        public static int READ_ONLY_SET
        Access modes: read only or read write.
      • READ_WRITE_SET

        public static int READ_WRITE_SET
      • GEOMETRY_SET

        public static java.lang.String GEOMETRY_SET
        Data sets types
      • TOPOLOGY_FEATURE_SET

        public static java.lang.String TOPOLOGY_FEATURE_SET
      • ANNOTATION_TEXT_SET

        public static java.lang.String ANNOTATION_TEXT_SET
      • datasetName

        protected java.lang.String datasetName
        Generic name.
      • baseTable

        protected java.lang.String baseTable
        Database table name
      • geometryColumn

        protected java.lang.String geometryColumn
        Geometry column name.
      • keyColumn

        protected java.lang.String keyColumn
        Key column name.
      • workspace

        protected java.lang.String workspace
      • sequenceName

        protected java.lang.String sequenceName
        Database sequence name to allow retrieval of new keys.
      • features

        protected java.util.Hashtable<java.lang.String,​AbstractFeature> features
        Abstract features.
      • changeCache

        protected EditChangeManager changeCache
        Change cache manager to stores the editing history.
      • geomDimension

        protected int geomDimension
        Geometry dimension.
      • geomSRID

        protected long geomSRID
        Data Spatial reference ID.
      • hasGeodeticSRID

        protected boolean hasGeodeticSRID
      • mode

        protected int mode
        Access mode
      • type

        protected java.lang.String type
        Data set type
      • dataModel

        protected AbstractDataModel dataModel
        Parent data model. Data set may belong to a network or topology model.
      • workingArea

        protected java.awt.geom.Rectangle2D workingArea
        Data set loaded area.
      • attrJavaTypes

        protected java.util.Hashtable<java.lang.String,​java.lang.String> attrJavaTypes
        Loaded attributes and their java types. The supported Java types are: String, Short, Integer, Long, Float, Double, BigDecimal, Date, Time, Timestamp.
      • nonNullAttributes

        protected java.util.Vector<java.lang.String> nonNullAttributes
        Names of non complex attributes that are not null (key attribute must be there).
      • queryCondition

        protected java.lang.String queryCondition
        Query condition to be added to final query for filtering
    • Constructor Detail

      • AbstractDataSet

        public AbstractDataSet()
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the data set name.
      • setName

        public void setName​(java.lang.String name)
        Sets the data set name.
        Parameters:
        name -
      • setSpatialInfo

        public void setSpatialInfo​(java.lang.String tableName,
                                   java.lang.String keyColumn,
                                   java.lang.String geomColumn)
        Sets the basic spatial information for this data set.
        Parameters:
        tableName -
        keyColumn -
        geomColumn -
      • getBaseTable

        public java.lang.String getBaseTable()
        Returns:
      • getGeometryColumn

        public java.lang.String getGeometryColumn()
        Returns:
      • getKeyColumn

        public java.lang.String getKeyColumn()
        Returns:
      • setSequenceName

        public void setSequenceName​(java.lang.String sequence)
        Parameters:
        sequence -
      • getSequenceName

        public java.lang.String getSequenceName()
        Returns:
      • loadData

        public boolean loadData​(AbstractDataAccessObject da,
                                java.awt.geom.Rectangle2D mbr,
                                WorkSpace workspace,
                                int mode)
                         throws java.lang.Exception,
                                MDSException
        Parameters:
        da - data access object with opened conection
        mbr - area to load data
        workspace - workspace parameters
        mode - access mode
        Returns:
        Throws:
        java.lang.Exception
        MDSException
      • save

        public boolean save​(AbstractDataAccessObject da)
                     throws java.lang.Exception,
                            MDSException
        Commit data set changes. If data belongs to a model (network or topology), the data is not committed. For this situations, use the model save method.
        Parameters:
        da - data access object with opened connection
        Returns:
        Throws:
        java.lang.Exception
        MDSException
      • getType

        public java.lang.String getType()
        Returns:
      • getMode

        public int getMode()
        Returns:
      • isInEditMode

        public boolean isInEditMode()
        Returns if data set can be edited (read-write mode).
        Returns:
      • setDataModel

        public void setDataModel​(AbstractDataModel model)
        Parameters:
        model -
      • getWorkingArea

        public java.awt.geom.Rectangle2D getWorkingArea()
        Returns:
      • getAttributeJavaType

        public java.lang.String getAttributeJavaType​(java.lang.String attrName)
        Parameters:
        attrName -
        Returns:
      • setAttributeJavaType

        public java.lang.String setAttributeJavaType​(java.lang.String attrName,
                                                     java.lang.String attrType)
      • getAttributeNames

        public java.lang.String[] getAttributeNames()
        Returns the attribute names (spatial and non-spatial) that can be edited.
        Returns:
      • getRealKeyValue

        public java.lang.String getRealKeyValue​(java.lang.String keyColumn,
                                                java.lang.String keyValue)
        Returns the real key value being used in the data set. This value will be based on the key column java type.
        Parameters:
        keyColumn -
        keyValue -
        Returns:
      • getNonNullAttributes

        public java.util.Vector<java.lang.String> getNonNullAttributes()
        Returns the a list of non complex attributes that can not have null values.
        Returns:
      • addToNonNullAttributes

        public void addToNonNullAttributes​(java.lang.String attr)
        Adds the attribute name to the list of non null attributes.
        Parameters:
        attr -
      • isNonNullAttribute

        public boolean isNonNullAttribute​(java.lang.String attr)
        Returns if attribute is a non null attribute.
        Parameters:
        attr -
        Returns:
      • getFeatureSpatialAttribute

        public java.lang.Object getFeatureSpatialAttribute​(java.lang.String key)
        Parameters:
        key -
        Returns:
      • getFeatureAttribute

        public oracle.mapviewer.share.Field getFeatureAttribute​(java.lang.String key,
                                                                java.lang.String attrName)
        Parameters:
        key -
        attrName -
        Returns:
      • getGeometryDimensions

        public int getGeometryDimensions()
        Returns:
      • getGeometrySrid

        public long getGeometrySrid()
        Returns:
      • getModifiedFeatures

        public java.lang.String[] getModifiedFeatures()
        Returns:
      • getNewFeatures

        public java.lang.String[] getNewFeatures()
        Returns:
      • getRemovedFeatures

        public java.lang.String[] getRemovedFeatures()
        Returns:
      • size

        public int size()
      • put

        public boolean put​(AbstractFeature feature)
        Adds the feature to feature list, but no changes are recorded. Feature must not exists.
        Parameters:
        feature -
        Returns:
      • addFeature

        public boolean addFeature​(AbstractFeature feature)
                           throws java.lang.Exception
        Adds a new feature to the data set if data set is read-write mode. Change manager records this change.
        Parameters:
        feature -
        Returns:
        Throws:
        java.lang.Exception
      • appendFeature

        public boolean appendFeature​(AbstractFeature feature)
                              throws java.lang.Exception
        Appends a feature to current list of the data set features. Change manager does not record this change. Use this method if you want to extend the feature list, but do not want to record it as a data set change.
        Parameters:
        feature -
        Returns:
        Throws:
        java.lang.Exception
      • deleteFeature

        public boolean deleteFeature​(java.lang.String key)
                              throws java.lang.Exception
        Removes a feature from the current list of the data set features. Change manager does not record this change.
        Parameters:
        key -
        Returns:
        Throws:
        java.lang.Exception
      • removeFeature

        public boolean removeFeature​(java.lang.String key)
                              throws java.lang.Exception
        Removes a feature from the data set if data set is read-write mode. Change manager records this change.
        Parameters:
        key -
        Returns:
        Throws:
        java.lang.Exception
      • isRemovedFeature

        public boolean isRemovedFeature​(java.lang.String key)
        Parameters:
        key -
        Returns:
      • isModifiedFeature

        public boolean isModifiedFeature​(java.lang.String key)
        Parameters:
        key -
        Returns:
      • isNewFeature

        public boolean isNewFeature​(java.lang.String key)
        Parameters:
        key -
        Returns:
      • updateFeatureAttribute

        public boolean updateFeatureAttribute​(java.lang.String key,
                                              oracle.mapviewer.share.Field newValue)
                                       throws java.lang.Exception
        Updates the feature attribute defined in input value if data set is read-write mode. Change manager records this change.
        Parameters:
        key -
        newValue - contains the attribute name and value
        Returns:
        Throws:
        java.lang.Exception
      • updateFeatureAttributes

        public boolean updateFeatureAttributes​(java.lang.String key,
                                               oracle.mapviewer.share.Field[] newValues)
                                        throws java.lang.Exception
        Update feature attributes if data set is in read-write mode. Change manager records this change.
        Parameters:
        key -
        newValues -
        Returns:
        Throws:
        java.lang.Exception
      • updateFeatureGeometry

        public boolean updateFeatureGeometry​(java.lang.String key,
                                             java.lang.Object newGeometry)
                                      throws java.lang.Exception
        Update feature geometry if data set is in read-write mode. Change manager records this change.
        Parameters:
        key -
        newGeometry -
        Returns:
        Throws:
        java.lang.Exception
      • isModified

        public boolean isModified()
        Returns:
      • undo

        public void undo​(EditChangeEvent change)
        Restores the last edit operation.
      • clearFeatures

        public void clearFeatures()
        Removes all features and clears the change cache.
      • clearChanges

        public void clearChanges()
        Clears the change cache.
      • getFeatures

        public java.util.List<GeoObject> getFeatures()
        Returns the current set of features.
        Returns:
      • getFeature

        public AbstractFeature getFeature​(java.lang.String key)
        Parameters:
        key -
        Returns:
      • getFeatureKeyValue

        public java.lang.String getFeatureKeyValue​(AbstractFeature feat)
        Returns the feature key value
        Parameters:
        feat -
        Returns:
      • getQueryForLoading

        public java.lang.String getQueryForLoading()
        Returns:
      • hasSpatialAttributeChanged

        public boolean hasSpatialAttributeChanged​(java.lang.String key)
        Returns if spatial attribute of modified feature has changed. For new and removed features this method returns false.
        Parameters:
        key -
        Returns:
      • getChangedAttributesOfModifiedFeature

        public java.lang.String[] getChangedAttributesOfModifiedFeature​(java.lang.String key)
        Returns the attribute names of modified features that have the values changed. For new and removed features this method returns null.
        Parameters:
        key -
        Returns:
      • setHoldLayerUpdate

        public void setHoldLayerUpdate​(boolean value)
      • getKeyColumnJavaType

        public java.lang.String getKeyColumnJavaType()
        Returns:
      • adjustColumnNames

        protected void adjustColumnNames()
        Adjusts key column and spatial column names to the values in list of attributes.
      • hasGeodeticSRID

        public boolean hasGeodeticSRID()
        Returns if data set has geodetic SRID.
        Returns:
      • getQueryCondition

        public java.lang.String getQueryCondition()
        Returns:
      • setQueryCondition

        public void setQueryCondition​(java.lang.String condition)
        Parameters:
        condition -
      • setWorkspace

        public void setWorkspace​(java.lang.String workspace)
      • getWorkspace

        public java.lang.String getWorkspace()