Open SiteSearch 4.1.1
Final

ORG.oclc.fmts
Class MarcBuilder

java.lang.Object
  |
  +--ORG.oclc.fmts.MarcBuilder

public class MarcBuilder
extends Object

The MarcBuilder class has the utilities to build a Marc record from a DataDir. It is used by the ZBase Newton formatting classes to build MARC records to return in a Z39.50 response.


Field Summary
protected  int charSet
          integer data type containing the character set of the input data.
 boolean orderNumerically
          boolean indicating whether to order input nodes numerically or leave them alone and let the caller be responsible for the order.
 
Constructor Summary
MarcBuilder()
          Constructs a MarcBuilder object.
 
Method Summary
 void addAllAsSubfield(int marcTag, char marcSubfieldChar, DataDir dir)
          Adds all the sub-Elements of the input Directory node to the Marc record as subfields of the input tag using the input character subfield identifer.
 void addAllWithOriginalSubfield(int marcTag, DataDir dir)
          Adds all the sub-Elements of the input Directory node to the Marc record as subfields of the input tag using their original subfield character.
 void addFieldData(int marcTag, int data)
          Adds a new Marc Field for the input tag and integer data.
 void addFieldData(int marcTag, int data, boolean newNode)
          Adds a new Marc Field for the input tag and integer data and adds a new Marc node for the tag if the input boolean is true.
 void addFieldData(int marcTag, String data)
          Adds a new Marc Field for the input tag and String data.
 void addFieldData(int marcTag, String data, boolean newNode)
          Adds a new Marc Field for the input tag and String data and adds a new Marc node for the tag if the input boolean is true.
 void addIndicators(int marcTag, String data)
          Add the indicators to the Marc field for the input marc tag and String data.
 void addOnlySubfield(int marcTag, char subfieldChar, DataDir dir)
          Adds only the sub-Elements of the input Directory node to the Marc record as subfields of the input tag if they match the input character subfield identifer.
 void addSubFieldData(int marcTag, char subfield, int data)
          Adds a new Marc Subfield for the input tag, character subfield identifier, and integer data.
 void addSubFieldData(int marcTag, char subfield, int data, boolean newNode)
          Adds a new Marc Subfield for the input tag, character subfield identifier, integer data, and creates a new Marc node for the tag if the input boolean is true.
 void addSubFieldData(int marcTag, char subfield, String data)
          Adds a new Marc Subfield for the input tag, character subfield identifier, String data and the subfield is added under the existing tag if it already exists.
 void addSubFieldData(int marcTag, char subfield, String data, boolean newNode)
          Adds a new Marc Subfield for the input tag, character subfield identifier, String data, and creates a new Marc Node if the input boolean is true.
 void addSubFieldData(int marcTag, int subfieldTag, String data)
          Adds a new Marc Subfield for the input tag, integer subfield identifier, and String data.
 void addSubFieldData(int marcTag, int subfieldTag, String data, boolean newNode)
          Adds a new Marc Subfield for the input tag, integer subfield identifier, String data, and creates a new Marc node for the tag if the input boolean is true.
 void appendHoldingsData(DataDir dir)
          Parses the OCLC Library Holdings Directory tag (277) to create the MarcNode in field 948.
 void appendSubFieldData(int marcTag, char subfield, String data)
          Appends data to existing Marc Subfield for the input tag, character subfield identifier, and String data.
 void appendSubFieldData(int marcTag, int subfieldTag, String data)
          Appends data to an existing Marc Subfield for the input tag, integer subfield identifier, and String data.
 char bibliographicLevel()
          Returns a character containing the MARC bibliographic level.
 void bibliographicLevel(char bibliographicLevel)
          Sets the bibliographic Level to the input character.
 String buildIt()
          Builds ands returns a Marc record String from all the nodes stored in MarcBuilder.
 char catalogingSourceCode()
          Returns a character containing the MARC cataloging source code.
 void catalogingSourceCode(char code)
          Sets the cataloging Source Code to the input character.
 void charSet(int charSet)
          Sets the character set value for the input Data.
 void contentsNature(String contentsCodes)
          Sets MARC 008 nature of contents value to the input string.
 void countryCode(String countryCode)
          Sets the Country of Publication Code to the input string.
 String date1()
          Returns a String containing the MARC 008 date1 field.
 void date1(String date)
          Sets the date1 value to the input string.
 String date2()
          Returns a String containing the MARC 008 date2 field.
 void date2(String date)
          Sets the date2 value to the input string.
 String dateRecordEntered()
          Returns a String containing the MARC date record entered.
 void dateRecordEntered(String date)
          Sets the date record entered to the input string - If the charSet=EBCDIC, the input data is converted to ASCII
 char descriptiveCatalogingForm()
          Returns a character containing the MARC descriptivce Cataloging Form;
 void descriptiveCatalogingForm(char code)
          Sets the descriptive Cataloging Form to the input character.
 char encodingLevel()
          Returns a character containing the MARC encoding level.
 void encodingLevel(char encodingLevel)
          Sets the encoding level to the input character.
 char formOfItem()
          Returns a character containing the MARC-008 form of item.
 DataDir getDir(int rootFieldid)
          Converts the marc string to a DataDir object.
 char govtPubCode()
          Returns a character containing the MARC-008 government publication code.
 void govtPublicationCode(char code)
          Sets the fixed field 008 government publication code to the input character.
 void init()
          Initializes the MarcBuilder for a new Marc record.
 void itemForm(char form)
          Sets the fixed field 008 form of item to the input character.
 void languageCode(String languageCode)
          Sets the language Code to the input string.
 String languageIndex()
          Returns a String containing the MARC language index.
 String marcString()
          Returns a String containing the Marc data record.
 char modifiedRecordIndicator()
          Returns a character containing the MARC modified record value.
 void modifiedRecordIndicator(char indicator)
          Sets the modifiedRecordIndicator to the input character.
 String natureOfContents()
          Returns a String containing the MARC 008 nature of contents (bytes 24-27) field.
 void newField(int marcTag)
          Creates a new Marc field node for the input marcTag.
 void publicationStatus(char status)
          Sets the fixed field 008 publicationStatus to the input character.
 char pubStatus()
          Returns a character containing the MARC-008 publication status.
 char recordStatus()
          Returns a character containing the MARC record status.
 void recordStatus(char recordStatus)
          Sets the recordStatus to the input character recordStatus.
 char recordType()
          Returns a character containing the MARC record type.
 void recordType(char recordType)
          Sets the Marc recordType to the input character.
 void serialType(char type)
          Sets the fixed field 008 serial type to the input character.
 String testMarcValidity()
          Tests the validity of the formatted marc string by creating a DataDir of the MarcBuilder object and returns a String with the results.
 String toString()
          Generates a String representation of this object.
 char typeOfSerial()
          Returns a character containing the MARC-008 serialType.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

charSet

protected int charSet
integer data type containing the character set of the input data.

orderNumerically

public boolean orderNumerically
boolean indicating whether to order input nodes numerically or leave them alone and let the caller be responsible for the order. The default value is to order the fields.
Constructor Detail

MarcBuilder

public MarcBuilder()
Constructs a MarcBuilder object.
Method Detail

init

public void init()
Initializes the MarcBuilder for a new Marc record.

recordStatus

public final char recordStatus()
Returns a character containing the MARC record status.
Returns:
char

recordType

public final char recordType()
Returns a character containing the MARC record type.
Returns:
char

bibliographicLevel

public final char bibliographicLevel()
Returns a character containing the MARC bibliographic level.
Returns:
char

encodingLevel

public final char encodingLevel()
Returns a character containing the MARC encoding level.
Returns:
char

natureOfContents

public final String natureOfContents()
Returns a String containing the MARC 008 nature of contents (bytes 24-27) field.
Returns:
String

dateRecordEntered

public final String dateRecordEntered()
Returns a String containing the MARC date record entered.
Returns:
String

date1

public final String date1()
Returns a String containing the MARC 008 date1 field.
Returns:
String

date2

public final String date2()
Returns a String containing the MARC 008 date2 field.
Returns:
String

languageIndex

public final String languageIndex()
Returns a String containing the MARC language index.
Returns:
String

modifiedRecordIndicator

public final char modifiedRecordIndicator()
Returns a character containing the MARC modified record value.
Returns:
char

catalogingSourceCode

public final char catalogingSourceCode()
Returns a character containing the MARC cataloging source code.
Returns:
catalogingSourceCode char

descriptiveCatalogingForm

public final char descriptiveCatalogingForm()
Returns a character containing the MARC descriptivce Cataloging Form;
Returns:
catalogingSourceCode char

pubStatus

public final char pubStatus()
Returns a character containing the MARC-008 publication status.
Returns:
publicationStatus char

typeOfSerial

public final char typeOfSerial()
Returns a character containing the MARC-008 serialType.
Returns:
publicationStatus char

formOfItem

public final char formOfItem()
Returns a character containing the MARC-008 form of item.
Returns:
publicationStatus char

govtPubCode

public final char govtPubCode()
Returns a character containing the MARC-008 government publication code.
Returns:
char

recordStatus

public final void recordStatus(char recordStatus)
Sets the recordStatus to the input character recordStatus.
Parameters:
recordStatus -  

publicationStatus

public final void publicationStatus(char status)
Sets the fixed field 008 publicationStatus to the input character.
Parameters:
publication - status

serialType

public final void serialType(char type)
Sets the fixed field 008 serial type to the input character.
Parameters:
publication - status

itemForm

public final void itemForm(char form)
Sets the fixed field 008 form of item to the input character.
Parameters:
form - - the code of the form of item

govtPublicationCode

public final void govtPublicationCode(char code)
Sets the fixed field 008 government publication code to the input character.
Parameters:
code - char indicating the value to set the code.

recordType

public final void recordType(char recordType)
Sets the Marc recordType to the input character.

bibliographicLevel

public final void bibliographicLevel(char bibliographicLevel)
Sets the bibliographic Level to the input character.

encodingLevel

public final void encodingLevel(char encodingLevel)
Sets the encoding level to the input character.

charSet

public final void charSet(int charSet)
Sets the character set value for the input Data.

dateRecordEntered

public final void dateRecordEntered(String date)
Sets the date record entered to the input string - If the charSet=EBCDIC, the input data is converted to ASCII

date1

public final void date1(String date)
Sets the date1 value to the input string.

date2

public final void date2(String date)
Sets the date2 value to the input string.

contentsNature

public final void contentsNature(String contentsCodes)
Sets MARC 008 nature of contents value to the input string.

countryCode

public final void countryCode(String countryCode)
Sets the Country of Publication Code to the input string.

languageCode

public final void languageCode(String languageCode)
Sets the language Code to the input string.

modifiedRecordIndicator

public final void modifiedRecordIndicator(char indicator)
Sets the modifiedRecordIndicator to the input character.
Parameters:
the - indicator

catalogingSourceCode

public final void catalogingSourceCode(char code)
Sets the cataloging Source Code to the input character.

descriptiveCatalogingForm

public final void descriptiveCatalogingForm(char code)
Sets the descriptive Cataloging Form to the input character.

newField

public final void newField(int marcTag)
Creates a new Marc field node for the input marcTag.
Parameters:
marcTag - the MARC tag value

addAllAsSubfield

public final void addAllAsSubfield(int marcTag,
                                   char marcSubfieldChar,
                                   DataDir dir)
Adds all the sub-Elements of the input Directory node to the Marc record as subfields of the input tag using the input character subfield identifer.
Parameters:
marcTag - the MarcTag for the data
marcSubfieldChar - the subfield for all the data elements
dir - the root directory node to retrieve all the elements from

addOnlySubfield

public final void addOnlySubfield(int marcTag,
                                  char subfieldChar,
                                  DataDir dir)
Adds only the sub-Elements of the input Directory node to the Marc record as subfields of the input tag if they match the input character subfield identifer.
Parameters:
marcTag - the MarcTag for the data
subfieldChar - the subfield to look for
dir - the root directory node to retrieve all the elements from

addAllWithOriginalSubfield

public final void addAllWithOriginalSubfield(int marcTag,
                                             DataDir dir)
Adds all the sub-Elements of the input Directory node to the Marc record as subfields of the input tag using their original subfield character.
Parameters:
marcTag - the MarcTag for the data
dir - the root directory node to retrieve all the elements from

addFieldData

public final void addFieldData(int marcTag,
                               String data)
Adds a new Marc Field for the input tag and String data. Method to add a new Marc Field.
Parameters:
marcTag - the MARC tag
data - the MARC data

addFieldData

public final void addFieldData(int marcTag,
                               String data,
                               boolean newNode)
Adds a new Marc Field for the input tag and String data and adds a new Marc node for the tag if the input boolean is true.
Parameters:
marcTag - the MARC tag
data - the MARC data
newNode - boolean indicating whether a new marc node for the input tag should be created

addFieldData

public final void addFieldData(int marcTag,
                               int data)
Adds a new Marc Field for the input tag and integer data. Method to add a new Marc Field.
Parameters:
marcTag - the MARC tag
data - the integer MARC data

addFieldData

public final void addFieldData(int marcTag,
                               int data,
                               boolean newNode)
Adds a new Marc Field for the input tag and integer data and adds a new Marc node for the tag if the input boolean is true. Method to add a new Marc Field.
Parameters:
marcTag - the MARC tag
data - the integer MARC data
newNode - boolean indicating whether a new marc node for the input tag should be created

addIndicators

public final void addIndicators(int marcTag,
                                String data)
Add the indicators to the Marc field for the input marc tag and String data.
Parameters:
marcTag - the MARC tag
data - the indicator string - should be 2 chars

addSubFieldData

public final void addSubFieldData(int marcTag,
                                  char subfield,
                                  String data)
Adds a new Marc Subfield for the input tag, character subfield identifier, String data and the subfield is added under the existing tag if it already exists.
Parameters:
marcTag - the MARC tag
subfield - the subfield character
data - the field data

addSubFieldData

public final void addSubFieldData(int marcTag,
                                  char subfield,
                                  String data,
                                  boolean newNode)
Adds a new Marc Subfield for the input tag, character subfield identifier, String data, and creates a new Marc Node if the input boolean is true.
Parameters:
marcTag - the MARC tag
subfield - the subfield character
data - the field data
newNode - boolean indicating whether a new marc node for the input tag should be created

addSubFieldData

public final void addSubFieldData(int marcTag,
                                  int subfieldTag,
                                  String data)
Adds a new Marc Subfield for the input tag, integer subfield identifier, and String data.
Parameters:
marcTag - the MARC tag
subfieldTag - the integer value of the subfield that will get converted to the appropriate character
data - the subfield data

addSubFieldData

public final void addSubFieldData(int marcTag,
                                  int subfieldTag,
                                  String data,
                                  boolean newNode)
Adds a new Marc Subfield for the input tag, integer subfield identifier, String data, and creates a new Marc node for the tag if the input boolean is true.
Parameters:
marcTag - the MARC tag
subfieldTag - the integer value of the subfield that will get converted to the appropriate character
data - the subfield data
newNode - boolean indicating whether a new marc node for the input tag should be created

addSubFieldData

public final void addSubFieldData(int marcTag,
                                  char subfield,
                                  int data)
Adds a new Marc Subfield for the input tag, character subfield identifier, and integer data.
Parameters:
marcTag - the MARC tag
subfield - the subfield character
data - the integer field data

addSubFieldData

public final void addSubFieldData(int marcTag,
                                  char subfield,
                                  int data,
                                  boolean newNode)
Adds a new Marc Subfield for the input tag, character subfield identifier, integer data, and creates a new Marc node for the tag if the input boolean is true.
Parameters:
marcTag - the MARC tag
subfield - the subfield character
data - the integer field data
newNode - boolean indicating whether a new marc node for the input tag should be created

appendSubFieldData

public final void appendSubFieldData(int marcTag,
                                     char subfield,
                                     String data)
Appends data to existing Marc Subfield for the input tag, character subfield identifier, and String data.
Parameters:
marcTag - the MARC tag
subfield - the subfield charcter
data - the field data

appendSubFieldData

public final void appendSubFieldData(int marcTag,
                                     int subfieldTag,
                                     String data)
Appends data to an existing Marc Subfield for the input tag, integer subfield identifier, and String data.
Parameters:
marcTag - the MARC tag
subfieldTag - the integer value of the subfield that will get converted to the appropriate character
data - the subfield data

appendHoldingsData

public final void appendHoldingsData(DataDir dir)
Parses the OCLC Library Holdings Directory tag (277) to create the MarcNode in field 948.
Parameters:
dir - pointing to the 277 tag
See Also:
FormatBerUtil

testMarcValidity

public String testMarcValidity()
Tests the validity of the formatted marc string by creating a DataDir of the MarcBuilder object and returns a String with the results.

getDir

public DataDir getDir(int rootFieldid)
Converts the marc string to a DataDir object.
Returns:
DataDir object

toString

public String toString()
Generates a String representation of this object.
Returns:
String
Overrides:
toString in class Object

marcString

public String marcString()
Returns a String containing the Marc data record.
Returns:
String

buildIt

public String buildIt()
Builds ands returns a Marc record String from all the nodes stored in MarcBuilder.

Open SiteSearch 4.1.1
Final