ru.biosoft.access
Class FilteredDataCollection

java.lang.Object
  extended byru.biosoft.access.DataElementSupport
      extended byru.biosoft.access.AbstractDataCollection
          extended byru.biosoft.access.DerivedDataCollection
              extended byru.biosoft.access.FilteredDataCollection
All Implemented Interfaces:
DataCollection, DataCollectionListener, DataElement, java.util.EventListener

public class FilteredDataCollection
extends DerivedDataCollection
implements DataCollectionListener

To do:
high document and test
Pendung:
high event issues

Field Summary
static java.lang.String FILTER_PROPERTY
          Key for setting filter in properties.
 
Fields inherited from class ru.biosoft.access.DerivedDataCollection
primaryCollection
 
Fields inherited from class ru.biosoft.access.AbstractDataCollection
cat, info, notificationEnabled, path, propagationEnabled, v_cache
 
Fields inherited from interface ru.biosoft.access.DataCollection
CHILDREN_NODE_IMAGE, CHILDREN_NODE_VISIBLE, CLASS_PROPERTY, CLASSPATH_JAR_PROPERTY, COMPARATOR_OBJECT, CONFIG_FILE_PROPERTY, CONFIG_PATH_PROPERTY, DATA_ELEMENT_CLASS_PROPERTY, DEFAULT_CONFIG_FILE, DEFAULT_CONFIG_SUFFIX, DEFAULT_FILTER_CONFIG_SUFFIX, DEFAULT_FORMAT_CONFIG_SUFFIX, DEFAULT_NODE_CONFIG_SUFFIX, DEFAULT_REPOSITORY, DESCRIPTION_PROPERTY, DISPLAY_NAME_PROPERTY, FILE_PATH_PROPERTY, FILE_PROPERTY, ID_FORMAT, IS_ROOT, JOB_CONTROL_PROPERTY, LATE_CHILDREN_INITIALIZATION, MUTABLE, NAME_PROPERTY, NEXT_CONFIG, NODE_IMAGE, NODE_VISIBLE, PRIMARY_COLLECTION, REMOVE_CHILDREN, TRANSFORMER_CLASS
 
Constructor Summary
FilteredDataCollection(DataCollection parent, java.util.Properties properties)
          Constructor to be used by CollectionFactory.
FilteredDataCollection(DataCollection parent, java.lang.String name, DataCollection primaryCollection, Filter filter, FunctionJobControl jobControl, java.util.Properties properties)
          Creates FilteredDataCollection with the specified parent, name, primary data collection and filter.
 
Method Summary
protected  void cachePut(DataElement de)
          Just a stub.
 boolean contains(java.lang.String name)
          Calls DataCollection.contains(String) method of primary data collection.
 void elementAdded(DataCollectionEvent event)
          Called after data element was added.
 void elementChanged(DataCollectionEvent event)
          Called after data element was changed.
 void elementRemoved(DataCollectionEvent event)
          Called after data element was removed.
 void elementWillAdd(DataCollectionEvent event)
          Called before data element will be added.
 void elementWillChange(DataCollectionEvent event)
          Called before data element will be changed.
 void elementWillRemove(DataCollectionEvent event)
          Called before data element will be removed.
 DataElement get(java.lang.String name)
          Gets data element with specified name.
 java.util.List getNameList()
          Calls DataCollection.getNameList() method of primary data collection
 int getSize()
          Calls DataCollection.getSize() method of primary data collection.
protected  void initNames(FunctionJobControl jobControl)
           
 java.util.Iterator iterator()
          Calls DataCollection.iterator() method of primary data collection
 DataElement put(DataElement de)
          Adds the specified data element to the collection.
 void remove(java.lang.String name)
          Removes the specified data element from the collection, if present.
 
Methods inherited from class ru.biosoft.access.DerivedDataCollection
contains, doGet, doPut, doRemove, getDataElementType, getPrimaryCollection, init, isMutable, toString
 
Methods inherited from class ru.biosoft.access.AbstractDataCollection
addDataCollectionListener, checkMutable, close, doAddPostNotify, doAddPreNotify, doRemovePostNotify, doRemovePreNotify, finalize, fireElementAdded, fireElementChanged, fireElementRemoved, fireElementWillAdd, fireElementWillChange, fireElementWillRemove, getCompleteName, getDescription, getInfo, initLog, isNotificationEnabled, isPropagationEnabled, makeInfo, propagateElementChanged, propagateElementWillChange, registerRoot, release, removeDataCollectionListener, setNotificationEnabled, setPropagationEnabled
 
Methods inherited from class ru.biosoft.access.DataElementSupport
getName, getOrigin, registerConstructorWithBadEqual
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ru.biosoft.access.DataElement
getName, getOrigin
 

Field Detail

FILTER_PROPERTY

public static final java.lang.String FILTER_PROPERTY
Key for setting filter in properties.

See Also:
Constant Field Values
Constructor Detail

FilteredDataCollection

public FilteredDataCollection(DataCollection parent,
                              java.util.Properties properties)
                       throws java.lang.Exception
Constructor to be used by CollectionFactory. Obligatory properties are

Parameters:
parent - filtered data collection parent.
properties - Properties for filtered collection.

FilteredDataCollection

public FilteredDataCollection(DataCollection parent,
                              java.lang.String name,
                              DataCollection primaryCollection,
                              Filter filter,
                              FunctionJobControl jobControl,
                              java.util.Properties properties)
Creates FilteredDataCollection with the specified parent, name, primary data collection and filter.

Parameters:
parent - parent for this data collection.
primaryCollection - primary data collection.
filter - filter to be applied to primary data collection.
properties - Properties to initialise DataCollectionInfo. Can be null.
Method Detail

initNames

protected final void initNames(FunctionJobControl jobControl)
Pendung:
high provide more optimal filteredNames initilization for: 1) filter is disabled;

iterator

public java.util.Iterator iterator()
Description copied from class: DerivedDataCollection
Calls DataCollection.iterator() method of primary data collection

Specified by:
iterator in interface DataCollection
Overrides:
iterator in class DerivedDataCollection
Returns:
an iterator over the data elements in primary collection.

getSize

public int getSize()
Description copied from class: DerivedDataCollection
Calls DataCollection.getSize() method of primary data collection.

Specified by:
getSize in interface DataCollection
Overrides:
getSize in class DerivedDataCollection
Returns:
Number of data element in primary data collection.

contains

public boolean contains(java.lang.String name)
Description copied from class: DerivedDataCollection
Calls DataCollection.contains(String) method of primary data collection.

Specified by:
contains in interface DataCollection
Overrides:
contains in class DerivedDataCollection
Parameters:
name - specified name of data element
Returns:
true if primary data collection contains element with specified name,
false otherwise..

get

public DataElement get(java.lang.String name)
                throws java.lang.Exception
Description copied from class: AbstractDataCollection
Gets data element with specified name. This implementation supports cache and for actual access use AbstractDataCollection.doGet(String).

Specified by:
get in interface DataCollection
Overrides:
get in class AbstractDataCollection
Parameters:
name - Name of the data element (cannot be null).
Returns:
DataElement or null if data element not found in the data collection.
Throws:
java.lang.Exception - If error raised in AbstractDataCollection.doGet(String)
See Also:
AbstractDataCollection.doGet(String), AbstractDataCollection.v_cache

cachePut

protected void cachePut(DataElement de)
Just a stub. Do nothing for filtered data collection.

Overrides:
cachePut in class AbstractDataCollection
See Also:
AbstractDataCollection.put(DataElement)

getNameList

public java.util.List getNameList()
Description copied from class: DerivedDataCollection
Calls DataCollection.getNameList() method of primary data collection

Specified by:
getNameList in interface DataCollection
Overrides:
getNameList in class DerivedDataCollection
Returns:
primary data collection name list.

put

public DataElement put(DataElement de)
                throws java.lang.Exception
Description copied from class: AbstractDataCollection
Adds the specified data element to the collection. Notifies all listeners if the data element was added or changed. #doPut(DataElement) method is used to put the data element. If the data collection previously contained the specified element, the old value is replaced.
Note that this implementation slow enough!!!

Specified by:
put in interface DataCollection
Overrides:
put in class AbstractDataCollection
Parameters:
de - Data element that will be putted in the data collection (Cannt be null).
Returns:
previous version of the data element, or null if there was no one.
Throws:
java.lang.Exception - If error occured.
See Also:
#doPut(DataElement), AbstractDataCollection.isMutable()

remove

public void remove(java.lang.String name)
            throws java.lang.Exception
Description copied from class: AbstractDataCollection
Removes the specified data element from the collection, if present. Notifies all listeners if the data element was removed. #doRemove(ru.biosoft.access.DataElement) method is used to remove the data element.

Specified by:
remove in interface DataCollection
Overrides:
remove in class AbstractDataCollection
Parameters:
name -
Throws:
java.lang.Exception - If any error.
See Also:
#doRemove(ru.biosoft.access.DataElement), AbstractDataCollection.isMutable()

elementWillRemove

public void elementWillRemove(DataCollectionEvent event)
                       throws DataCollectionVetoException,
                              java.lang.Exception
Description copied from interface: DataCollectionListener
Called before data element will be removed.

Specified by:
elementWillRemove in interface DataCollectionListener
Parameters:
event - DataCollectionEvent information about will removed data element.
Throws:
DataCollectionVetoException - If listener cancel removing of data element.
java.lang.Exception - If error occured.

elementRemoved

public void elementRemoved(DataCollectionEvent event)
                    throws java.lang.Exception
Description copied from interface: DataCollectionListener
Called after data element was removed.

Specified by:
elementRemoved in interface DataCollectionListener
Parameters:
event - DataCollectionEvent information about removed data element.
Throws:
java.lang.Exception - If error occured.

elementWillAdd

public void elementWillAdd(DataCollectionEvent event)
                    throws DataCollectionVetoException,
                           java.lang.Exception
Description copied from interface: DataCollectionListener
Called before data element will be added.

Specified by:
elementWillAdd in interface DataCollectionListener
Parameters:
event - DataCollectionEvent information about will added data element.
Throws:
DataCollectionVetoException - If listener cancel adding of data element.
java.lang.Exception - If error occured.

elementAdded

public void elementAdded(DataCollectionEvent event)
                  throws java.lang.Exception
Description copied from interface: DataCollectionListener
Called after data element was added.

Specified by:
elementAdded in interface DataCollectionListener
Parameters:
event - DataCollectionEvent information about added data element.
Throws:
java.lang.Exception - If error occured.

elementWillChange

public void elementWillChange(DataCollectionEvent event)
                       throws DataCollectionVetoException,
                              java.lang.Exception
Description copied from interface: DataCollectionListener
Called before data element will be changed. e contains old data element (which will be changed).

Specified by:
elementWillChange in interface DataCollectionListener
Parameters:
event - DataCollectionEvent information about will change data element.
Throws:
DataCollectionVetoException - If listener cancel changing of data element.
java.lang.Exception - If error occured.
To do:
URGENT Use filter

elementChanged

public void elementChanged(DataCollectionEvent event)
                    throws java.lang.Exception
Description copied from interface: DataCollectionListener
Called after data element was changed. e contains old data element (which already changed).

Specified by:
elementChanged in interface DataCollectionListener
Parameters:
event - DataCollectionEvent information about changed data element.
Throws:
java.lang.Exception - If error occured.
To do:
URGENT Use filter


Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.