com.raritantechnologies.utils.comparators
Class LookupComparator

java.lang.Object
  extended bycom.raritantechnologies.utils.comparators.LookupComparator
All Implemented Interfaces:
java.util.Comparator, IComparator, IConfigurable

public class LookupComparator
extends java.lang.Object
implements IComparator

Configurable java.util.Comparator that uses a SearchSource to lookup information given the the value to compare. Uses a nested IResultMatcher to determine if a matching result is found in the lookup result set. If so, the comparator returns true.

XML Configuration Template:
   <Comparator class="com.raritantechnologies.utils.comparators.LookupComparator"
                  searchSource="[ name of RTI SearchSource ]"
                  searchField="[ search field that the comparable value will be set to ]" >

     <!-- other search parameters used with the lookup value -->
     <SearchParams>
        <Param name="[ name of parameter ]" value="[ value of parameter ]" />
        
        <!-- etc. . . -->
     </SearchParams>

     <!-- ResultMatcher used to determine if the lookup succeeded. -->
     <ResultMatcher class="[ class of com.raritantechnologies.searchApp.IResultMatcher ]" >

     </ResultMatcher>

   </Comparator>
 

Developed by Raritan Technologies Inc..

Author:
Ted Sullivan

Field Summary
 
Fields inherited from interface com.raritantechnologies.utils.comparators.IComparator
TEMPLATE
 
Constructor Summary
LookupComparator()
           
 
Method Summary
 int compare(java.lang.Object ob1, java.lang.Object ob2)
           
 boolean equals(java.lang.Object object)
           
 java.lang.String getConfigurationXML()
           
 java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
           
 void getConfigurationXML(java.io.Writer writer)
           
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
 void setResultMatcher(IResultMatcher resultMatcher)
           
 void setSearchField(java.lang.String searchField)
           
 void setSearchParams(OrderedMap searchParams)
           
 void setSearchSource(java.lang.String searchSourceName)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LookupComparator

public LookupComparator()
Method Detail

equals

public boolean equals(java.lang.Object object)
Specified by:
equals in interface java.util.Comparator

compare

public int compare(java.lang.Object ob1,
                   java.lang.Object ob2)
Specified by:
compare in interface java.util.Comparator

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IConfigurable

setSearchParams

public void setSearchParams(OrderedMap searchParams)

setSearchSource

public void setSearchSource(java.lang.String searchSourceName)

setSearchField

public void setSearchField(java.lang.String searchField)

setResultMatcher

public void setResultMatcher(IResultMatcher resultMatcher)

getConfigurationXML

public void getConfigurationXML(java.io.Writer writer)
                         throws java.io.IOException
Throws:
java.io.IOException

getConfigurationXML

public java.lang.String getConfigurationXML()

getConfigurationXML

public java.lang.String getConfigurationXML(java.lang.String configurationTemplate)