com.raritantechnologies.utils.filter
Class DynamicStringFilter

java.lang.Object
  extended bycom.raritantechnologies.utils.filter.DynamicStringFilter
All Implemented Interfaces:
IConfigurable, IStringFilter

public class DynamicStringFilter
extends java.lang.Object
implements IStringFilter

Applies a string filtering operation dependent on some session and/or user parameter or on the property of the string (using an IComparator ).

XML Configuration Template:
   <StringFilter class="com.raritantechnologies.utils.filter.DynamicStringFilter" >

   <!-- use default="true" on one of the UseFilter tags if some filtering is always needed -->
   <!-- don't add any UseFilter tags with default attribute set if no filtering is wanted on match failure -->
   <UseFilter default="true"> 

     <!-- The proxy StringFilter to use if comparisons succeed -->
     <StringFilter class="[ class of com.raritantechnologies.utils.filter.IStringFilter ]" >

     </StringFilter>

     <!-- Can use an IComparator to determine if this filter should be used -->
     <Comparator class="[ class of com.raritantechnologies.utils.comparators.IComparator ]" >

     </Comparator>

     <!-- Alternatively, the current session parameters be used to determine if the StringFilter should be used -->
     <SessionParams>
       <Param name="[request parameter name]">
         <ValidValues>  <!-- Any of these values will activate the element renderer -->
           <Value>A valid value</Value>
           <Value>Another valid value</Value>
         </ValidValues>
       </Param>

       <!-- If the above field is valid, check this field (fields are ANDed) -->
       <Param name="[another field]">
         <ValidValues>  <!-- Any of these values will activate the element renderer: -->
           <Value>A value</Value>
           <Value>Another good value</Value>
         </ValidValues>
       </Param>

       <!-- etc... -->

     </SessionParams>

     <UserParams>
       <Param name="[user attribute name]">
         <ValidValues>  <!-- Any of these values will activate the element renderer -->
           <Value>A valid value</Value>
           <Value>Another valid value</Value>
         </ValidValues>
       </Param>

       <!-- If the above field is valid, check this field (fields are ANDed) -->
       <Param name="[another user attribute]">
         <ValidValues>  <!-- Any of these values will activate the element renderer: -->
           <Value>A value</Value>
           <Value>Another good value</Value>
         </ValidValues>
       </Param>

       <!-- etc... -->
     </UserParams>
   </UseFilter>

   <!-- more UseFilter tags etc... -->

   </StringFilter>
  

Developed by Raritan Technologies Inc..

Author:
Ted Sullivan

Nested Class Summary
 class DynamicStringFilter.UseFilter
           
 
Field Summary
 
Fields inherited from interface com.raritantechnologies.utils.filter.IStringFilter
TEMPLATE
 
Constructor Summary
DynamicStringFilter()
           
 
Method Summary
 java.lang.String filterString(java.util.Map parameters, java.lang.String inputString)
           
 java.lang.String filterString(java.lang.String inputString)
           
 java.lang.String filterString(java.lang.String sessionID, java.lang.String inputString)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicStringFilter

public DynamicStringFilter()
Method Detail

filterString

public java.lang.String filterString(java.lang.String inputString)
Specified by:
filterString in interface IStringFilter

filterString

public java.lang.String filterString(java.util.Map parameters,
                                     java.lang.String inputString)
Specified by:
filterString in interface IStringFilter

filterString

public java.lang.String filterString(java.lang.String sessionID,
                                     java.lang.String inputString)
Specified by:
filterString in interface IStringFilter

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

getConfigurationXML

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

getConfigurationXML

public java.lang.String getConfigurationXML()
Specified by:
getConfigurationXML in interface IStringFilter

getConfigurationXML

public java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
Specified by:
getConfigurationXML in interface IStringFilter