Open SiteSearch 4.1.1
Final

ORG.oclc.gadgets
Class FormatRecords

java.lang.Object
  |
  +--ORG.oclc.gadgets.FormatRecords
Direct Known Subclasses:
BookMarkBrief, BookMarkFull, FormatRecordsAndAttachHoldings, IllForm, RecordHoldings, TermListDisplay, ThesTreeDisplay

public class FormatRecords
extends Object
implements GadgetBuilder

The FormatRecords class is a gadget that invokes a database record formatting class to be executed on the object in the user state named UnformattedRecordData containing a Vector of unformatted record data objects in order to create an HTML string representation of the data. It uses the parameters contained in a RequestManager object and the parameters for the gadget read from the configuration files to build the appropriate output. If an error occurs, an empty string("") is returned.

The parameters to the gadget are:
fmtclass or fmt - the name of the formatting class to use such as 'brief', 'full', or 'bookmark'. This is specified in the [Formats] section of the individual database configuration file.
startrecno - the name of the user state entity that is used to denote the starting record number in the display, such as toprecno or fullrecno. This is used to attach a record number to the display of the record data.
tempDb - flag to indicate that the gadget will format records from a temporary database search (tdbname) where true indicates temporary.
norecordsmessage - text to display when there are no raw records where the default is an empty string("").
errormessage - the text to display when an error occurs formatting the record where the default is Error formatting records from databasename. If the text none is supplied as the error message, no message will appear.

See Also:
UserStateObject, WebZFormatter

Field Summary
protected  DataPairs dataWrappers
          DataPairs object containing the HTML or Text to use in the formatting utilities when the RulesBasedDisplayGenerator is used.
protected  String dbname
          String data type containing a database name.
protected  StyleTable displayGadget
          StyleTable object containing the definitions for the user's FmtDisplay context.
protected  String errormsg
          String data type defining the error message to display.
protected  String fmtName
          String data type containing the name of the format type to use to format the data, such as 'full'.
protected  Hashtable gadgetInfo
          Hashtable object containing the parameters to the gadget.
protected  boolean initted
          boolean data type defining whether the formatting initialization has been executed.
protected  String numHoldings
          String data type containing the number of holdings records to attach - read from the gadget description.
protected  int recno
          integer data type defining the current record number for the data based on the entities currecno for brief displays and
protected  Vector recordData
          Vector object containing the raw data to be formatted.
protected  String recordformat
          String data type containing the ElementSetName of the current records being formatted.
protected  String resultset
          String data type containing the current resultset name for the data being formatted.
protected  int returnedRecs
          integer data type defining the count of raw records.
protected  String searchKeyFmt
          String data type containing the holdings search key formatting class if there are holdings to search and attach to the full record - read from the gadget description.
protected  UserStateObject user
          UserStateObject containing the user specific context.
protected  ZDb zDb
          ZDb object defining a database configuration the user has access to.
protected  ZUserData zUserData
          ZUserData object containing the user's Z3950 context.
 
Constructor Summary
FormatRecords()
          Constructs a FormatRecords object.
 
Method Summary
 String buildit(RequestManager rMngr, String name)
          Generates a String containing the HTML for the data record generated by the database formatting class using the parameters containined in the RequestManager object and the name of the gadget.
protected  void formatPresentData(Vector dataFromPresent, String formatType, StringBuffer formatStringData, int recno, DataPairs wrapperData)
           
 DataPairs getDataWrappers(String name, Hashtable gadgetInfo, StyleTable displayGadget)
           
 void init(UserStateObject user, String name)
           
protected  String runFormat(ZDb zDb, String formatType, Vector rawRecords)
          Deprecated. use runFormat(zDb, formatType, rawRecords, recno, wrapperData)
 String runFormat(ZDb zDb, String formatType, Vector rawRecords, int recno, DataPairs wrapperData)
          Invokes the formatting class object for the input ZDb database object, formatting type, the Vector of records, the record number, and the DataPairs data wrapper definition(html/text) to the class to return a String containing formatted data.
 String toString()
          Generates a String representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

user

protected UserStateObject user
UserStateObject containing the user specific context.

zUserData

protected ZUserData zUserData
ZUserData object containing the user's Z3950 context.

displayGadget

protected StyleTable displayGadget
StyleTable object containing the definitions for the user's FmtDisplay context.

gadgetInfo

protected Hashtable gadgetInfo
Hashtable object containing the parameters to the gadget.

zDb

protected ZDb zDb
ZDb object defining a database configuration the user has access to.

dataWrappers

protected DataPairs dataWrappers
DataPairs object containing the HTML or Text to use in the formatting utilities when the RulesBasedDisplayGenerator is used.

resultset

protected String resultset
String data type containing the current resultset name for the data being formatted.

dbname

protected String dbname
String data type containing a database name.

fmtName

protected String fmtName
String data type containing the name of the format type to use to format the data, such as 'full'.

recordformat

protected String recordformat
String data type containing the ElementSetName of the current records being formatted.

searchKeyFmt

protected String searchKeyFmt
String data type containing the holdings search key formatting class if there are holdings to search and attach to the full record - read from the gadget description.

numHoldings

protected String numHoldings
String data type containing the number of holdings records to attach - read from the gadget description.

recordData

protected Vector recordData
Vector object containing the raw data to be formatted.

recno

protected int recno
integer data type defining the current record number for the data based on the entities currecno for brief displays and

returnedRecs

protected int returnedRecs
integer data type defining the count of raw records.

initted

protected boolean initted
boolean data type defining whether the formatting initialization has been executed.

errormsg

protected String errormsg
String data type defining the error message to display.
Constructor Detail

FormatRecords

public FormatRecords()
Constructs a FormatRecords object.
Method Detail

buildit

public String buildit(RequestManager rMngr,
                      String name)
Generates a String containing the HTML for the data record generated by the database formatting class using the parameters containined in the RequestManager object and the name of the gadget.
Specified by:
buildit in interface GadgetBuilder
Parameters:
rMngr - object containing input parameters for the request.
name - the name of the gadget - the section name in the configuration file defining the particular gadget.
Returns:
String

formatPresentData

protected final void formatPresentData(Vector dataFromPresent,
                                       String formatType,
                                       StringBuffer formatStringData,
                                       int recno,
                                       DataPairs wrapperData)

runFormat

protected final String runFormat(ZDb zDb,
                                 String formatType,
                                 Vector rawRecords)
                          throws Exception
Deprecated. use runFormat(zDb, formatType, rawRecords, recno, wrapperData)
Invokes the formatting class object for the input ZDb database object, formatting class name, and passes the Vector of records to the class to return a String containing formatted data.
Parameters:
zDb - the ZDb database object
formattingClassName - the String containing the name of the format class. i.e. 'full' or 'brief'
rawRecords - the Vector of raw data records
Returns:
String

runFormat

public final String runFormat(ZDb zDb,
                              String formatType,
                              Vector rawRecords,
                              int recno,
                              DataPairs wrapperData)
                       throws Exception
Invokes the formatting class object for the input ZDb database object, formatting type, the Vector of records, the record number, and the DataPairs data wrapper definition(html/text) to the class to return a String containing formatted data.
Parameters:
zDb - the ZDb database object
formatType - the String containing the name of the format class. i.e. 'full' or 'brief'
rawRecords - the Vector of raw data records
recno - the record number of the first record in the set
wrapperData - the DataPairs object containing all the html or text to wrap around the record data
Returns:
String

init

public final void init(UserStateObject user,
                       String name)

getDataWrappers

public final DataPairs getDataWrappers(String name,
                                       Hashtable gadgetInfo,
                                       StyleTable displayGadget)

toString

public String toString()
Generates a String representation of the object.
Specified by:
toString in interface GadgetBuilder
Returns:
String
Overrides:
toString in class Object

Open SiteSearch 4.1.1
Final