| |
|
| java.lang.Object org.openidex.search.SearchGroup
All known Subclasses: org.openidex.search.FileObjectSearchGroup, org.openidex.search.DataObjectSearchGroup,
SearchGroup | abstract public class SearchGroup (Code) | | Class which groups individual search types. It provides several services
to provide search on them. The services are scanning node system to
provide search object for group of search types -> efficient search.
author: Peter Zavadsky author: Marian Petras |
Inner Class :public interface Factory | |
Inner Class :final public static class Registry extends Object | |
Field Summary | |
final public static String | PROP_FOUND Property name which is fired when performing search and searched object
passed criteria. | final public static String | PROP_RESULT Property name which is fired for in for the case original node 's has
changed the way result was changed based on set criteria. | final protected Set<Object> | resultObjects Set of objects which passed the search criteria (searchtypes). | final protected Set<Node> | searchRoots Set of nodes on which sub-system to search. | protected SearchType[] | searchTypes | protected volatile boolean | stopped Flag indicating the search should be stopped. |
PROP_FOUND | final public static String PROP_FOUND(Code) | | Property name which is fired when performing search and searched object
passed criteria.
|
PROP_RESULT | final public static String PROP_RESULT(Code) | | Property name which is fired for in for the case original node 's has
changed the way result was changed based on set criteria.
Interested listeners should then get the event with values
- property change name = PROP_RESULT
- property source = this search type instance
- old value = detail which was changed or
null there wasn't before for the node -> new value has to be non-null
for the latter case.
- new value = detail which was changed or null if the node was removed from the result -> old value has to be non-null
for that case
This allows implementation of the dynamic changing of result suggested
by Jesse and Sebastian (at least partially implemented now).
|
resultObjects | final protected Set<Object> resultObjects(Code) | | Set of objects which passed the search criteria (searchtypes).
|
searchRoots | final protected Set<Node> searchRoots(Code) | | Set of nodes on which sub-system to search.
|
searchTypes | protected SearchType[] searchTypes(Code) | | search types added to this search group
|
stopped | protected volatile boolean stopped(Code) | | Flag indicating the search should be stopped.
|
add | protected void add(SearchType searchType)(Code) | | Adds a search type to this search group.
If the group already contains the search type, the group is left
unmodified.
Parameters: searchType - search type to be added |
createSearchGroups | public static SearchGroup[] createSearchGroups(SearchType[] items)(Code) | | Creates a search group for each type of object searchable by all
the specified search types.
At first, a set of object types common to all search types
(i.e. Class s representing object types, common
to all search types) is computed. Then a search group is created
for each of the Class s.
Parameters: search - types to create search groups for created search groups See Also: SearchType.getSearchTypeClasses |
doSearch | abstract protected void doSearch()(Code) | | Provides actual search. The subclasses implementating this method should scan the node system
specified by searchRoots , extract search objects from them, add them
to the search object set, test over all search type items in this group,
in case if satisfied all it should fire PROP_FOUND property change and add
the object to resultObjects set.
The method implemenatation should call
SearchGroup.processSearchObject method for each
search object in the node systems.
|
firePropertyChange | protected void firePropertyChange(String name, Object oldValue, Object newValue)(Code) | | Fires property change event.
|
getNodeForFoundObject | abstract public Node getNodeForFoundObject(Object object)(Code) | | Gets node for found object.
|
getResultObjects | public Set<Object> getResultObjects()(Code) | | Getter for result object property.
|
getSearchRoots | public Node[] getSearchRoots()(Code) | | Gets search root nodes.
|
prepareSearch | protected void prepareSearch()(Code) | | Prepares search.
|
processSearchObject | protected void processSearchObject(Object searchObject)(Code) | | Provides search on one search object instance. The object is added to
set of searched objects and passed to all search types encapsulated by
this search group. In the case the object passes all search types is added
to the result set and fired an event PROP_FOUND about successful
match to interested property change listeners.
Parameters: searchObject - object to provide actuall test on it. The actual instancehas to be of type returned by all SearchKey.getSearchObjectType returned by SearchType of this SearchGroup |
removePropertyChangeListener | public synchronized void removePropertyChangeListener(PropertyChangeListener l)(Code) | | Removes property change listener.
|
search | public void search()(Code) | | Does search.
|
setSearchRootNodes | public void setSearchRootNodes(Node[] roots)(Code) | | Sets roots of nodes in which its interested to search.
This method is called at the first search type in the possible created
chain of search types.
|
stopSearch | final public void stopSearch()(Code) | | Stops searching.
|
|
|
|