Open SiteSearch 4.1.1
Final

ORG.oclc.fmts.rules
Class RuleUtil

java.lang.Object
  |
  +--ORG.oclc.fmts.rules.RuleUtil
Direct Known Subclasses:
Add856, AddBriefHoldings, AddCompoundSubjectPhrase, AddDatabaseName, AddFetchAnchor, AddFormattedDupData, AddFSABIISubjects, AddFSMedlineSubjects, AddFullTextButton, AddHoldings, AddHTTPAnchor, AddILL920FieldSendToList, AddILLData, AddILLDatabaseName, AddILLOclcNum, AddILLSendToList, AddImageDisplayAnchor, AddRecordData, AddRecordNumber, AddSaveButton, AddWrapperData, CopyAnchor, DeleteAnchor, EditAnchor, HoldingsSearchKey, SaveDuplicateDatabaseNames, SaveImageInfo, SaveTermFinderResults, UpdateCurrecno

public class RuleUtil
extends Object

The RuleUtil class is the base utility class for all the record display rules used by the RulesBasedDisplayGenerator to created formatted record data. It provides some basic utilities for all the display formatting rules classes.

See Also:
RulesBasedDisplayGenerator, RuleSpec, DisplayUserData

Constructor Summary
RuleUtil()
           
 
Method Summary
 void appendEntityData(String entityName, FormatBerUtil fmtUtil, String separatorB4Entity, DisplayUserData userData)
          Appends the data retrieved from the input entity name to the output formatting buffer held in the FormatBerUtil object.
static String getData(DataDir dir, RuleSpec ruleSpec, FormatBerUtil fmtUtil, boolean doDiacritics, boolean firstOccurrenceOnly, boolean makeAnchor)
          Invokes the getData method with a lineBreak character of space(' ') to generate a String containing data from the input DataDir by retrieving the fields specified in the input RuleSpec object.
static String getData(DataDir dir, RuleSpec ruleSpec, FormatBerUtil fmtUtil, boolean doDiacritics, boolean firstOccurrenceOnly, boolean makeAnchor, String lineBreak)
          Generates a String containing data from the input DataDir by retrieving the fields specified in the input RuleSpec object.
static String getWrapperData(String wrapperName, DisplayUserData userData)
          Retrieves the wrapper data value for the input wrapper name.
static String getWrapperData(String wrapperName, String defaultVal, DisplayUserData userData)
          Retrieves the wrapper data value for the input wrapper name and returns the default value when the entry is not found.
static String getWrapperDataFromRuleParm(RuleSpec ruleSpec, String ruleParmName, String defaultParmName, DisplayUserData userData)
          Retrieves the input parameter from the RuleSpec rules, then retrieves the wrapper data string for the named parameter and uses the default when either the rule parameter does not exist or the wrapper data element does not exist.
static String labelMaker(String text, String begLabel, String endLabel)
          Creates a label from some text and uses the "beforeFieldLabel" and "afterFieldLabel" entries in the user's DisplayUserData wrapper data object to pre-pend and append to the data.
 void saveDataInEntity(String entityName, String data, String entitySeparator, DisplayUserData userData)
          Saves and Appends the input data string in the user state object in the named entity and separates any existing entity data with the input entity separator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleUtil

public RuleUtil()
Method Detail

getWrapperData

public static final String getWrapperData(String wrapperName,
                                          DisplayUserData userData)
Retrieves the wrapper data value for the input wrapper name.
Parameters:
wrapperName - a String that contains the name of the wrapper item.
userData - the DisplayUserData object containing the user's display formatting context.
Returns:
String

getWrapperData

public static final String getWrapperData(String wrapperName,
                                          String defaultVal,
                                          DisplayUserData userData)
Retrieves the wrapper data value for the input wrapper name and returns the default value when the entry is not found.
Parameters:
wrapperName - a String that contains the name of the wrapper item.
defaultVal - a String that contains the default value when the wrapper item is not located.
userData - the DisplayUserData object containing the user's display formatting context.
Returns:
String

getWrapperDataFromRuleParm

public static final String getWrapperDataFromRuleParm(RuleSpec ruleSpec,
                                                      String ruleParmName,
                                                      String defaultParmName,
                                                      DisplayUserData userData)
Retrieves the input parameter from the RuleSpec rules, then retrieves the wrapper data string for the named parameter and uses the default when either the rule parameter does not exist or the wrapper data element does not exist.
Parameters:
wrapperName - a String that contains the name of the wrapper item.
defaultVal - a String that contains the default value when the wrapper item is not located.
userData - the DisplayUserData object containing the user's display formatting context.
Returns:
String

labelMaker

public static final String labelMaker(String text,
                                      String begLabel,
                                      String endLabel)
Creates a label from some text and uses the "beforeFieldLabel" and "afterFieldLabel" entries in the user's DisplayUserData wrapper data object to pre-pend and append to the data.
Parameters:
text - a String that contains the text to be made into a label
begLabel - String to append before the text
endLabel - String to append after the text
Returns:
String

appendEntityData

public final void appendEntityData(String entityName,
                                   FormatBerUtil fmtUtil,
                                   String separatorB4Entity,
                                   DisplayUserData userData)
Appends the data retrieved from the input entity name to the output formatting buffer held in the FormatBerUtil object.
Parameters:
entityName - the name of the entity to store the data
fmtUtil - the FormatBerUtil object holding the format buffer.
separatorB4Entity - the string to append to the existing formatting buffer before adding the entity data.
userData - the DisplayUserData object containing the user's context.

saveDataInEntity

public final void saveDataInEntity(String entityName,
                                   String data,
                                   String entitySeparator,
                                   DisplayUserData userData)
Saves and Appends the input data string in the user state object in the named entity and separates any existing entity data with the input entity separator.
Parameters:
entityName - the name of the entity to store the data
data - the string to store
entitySeparator - the string to append to the existing entity data before adding the input data
userData - the DisplayUserData object containing the user's context.

getData

public static final String getData(DataDir dir,
                                   RuleSpec ruleSpec,
                                   FormatBerUtil fmtUtil,
                                   boolean doDiacritics,
                                   boolean firstOccurrenceOnly,
                                   boolean makeAnchor)
Invokes the getData method with a lineBreak character of space(' ') to generate a String containing data from the input DataDir by retrieving the fields specified in the input RuleSpec object.
Parameters:
dir - the DataDir object containing the record
ruleSpec - the RuleSpec object defining the fields to retrieve
doDiacritics - the flag indicating whether diacritics should be translated to HTML
firstOccurrenceOnly - flag indicating whether to stop the field lookup after the first field is located
makeAnchor - flag indicating whether to create hot-links
Returns:
String

getData

public static final String getData(DataDir dir,
                                   RuleSpec ruleSpec,
                                   FormatBerUtil fmtUtil,
                                   boolean doDiacritics,
                                   boolean firstOccurrenceOnly,
                                   boolean makeAnchor,
                                   String lineBreak)
Generates a String containing data from the input DataDir by retrieving the fields specified in the input RuleSpec object.
Parameters:
dir - the DataDir object containing the record
ruleSpec - the RuleSpec object defining the fields to retrieve
doDiacritics - the flag indicating whether diacritics should be translated to HTML
firstOccurrenceOnly - flag indicating whether to stop the field lookup after the first field is located
makeAnchor - flag indicating whether to create hot-links
lineBreak - the String defining what the line break character is.
Returns:
String

Open SiteSearch 4.1.1
Final