com.catcode.odf
Class OpenDocumentMetadata

Object
  extended byOpenDocumentMetadata

public class OpenDocumentMetadata
extends Object

OpenDocumentMetadata describes the content of an OASIS Open Document Format meta-information file. The declarations of the fields in this class closely mirror the element and attribute names in the meta.xml file. For example, the printedBy field contains the information that comes from the <meta:printed-by> element. This is no accident--it allows code that analyzes a meta.xml file to use reflection to call the methods for setting the fields in this class.

Version:
0.2, 2005-10-30
Author:
J. David Eisenberg

Field Summary
protected  Hashtable userDefined
           
 
Constructor Summary
OpenDocumentMetadata()
           
 
Method Summary
 int getCellCount()
          Return the total number of cells in this spreadsheet document.
 int getCharacterCount()
          Return the total number of characters in the document.
 Date getCreationDate()
          Return the document's creation date and time.
 String getCreator()
          Return the last editor of the document.
 Date getDate()
          Return the document's last edit date and time.
 String getDescription()
          Return the document description.
 int getDrawCount()
          Return the total number of drawings in the document.
 int getEditingCycles()
          Return the number of editing cycles for this document.
 Duration getEditingDuration()
          Return the total time spent editing the document.
 Object getFieldByName(String fieldName)
          Returns an Object for a field by name.
 int getFrameCount()
          Return the total number of frames in the document.
 String getGenerator()
          Return the generator meta information.
 int getImageCount()
          Return the total number of images in the document.
 String getInitialCreator()
          Return the document's initial creator.
 String getKeyword()
          Return the list of keywords for this document.
 String getLanguage()
          Return the document's language.
 int getNonWhitespaceCharacterCount()
          Return the total number of non-whitespace characters in the document.
 int getObjectCount()
          Return the total number of graphic objects in this spreadsheet or graphics document.
 int getOleObjectCount()
          Return the total number of OLE objects in the document.
 int getPageCount()
          Return the total number of pages in the document.
 int getParagraphCount()
          Return the total number of paragraphs in the document.
 Date getPrintDate()
          Return the date and time the document was last printed.
 String getPrintedBy()
          Return the last person to print the document.
 int getRowCount()
          Return the total number of rows in the document.
 int getSentenceCount()
          Return the total number of sentences in the document.
 String getSubject()
          Return the document subject.
 int getSyllableCount()
          Return the total number of syllables in the document.
 int getTableCount()
          Return the total number of tables in this text or spreadsheet document.
 String getTitle()
          Return the document title.
 Hashtable getUserDefined()
          Return the user-defined meta information.
 int getWordCount()
          Return the total number of words in the document.
 void setCellCount(int cellCount)
          Set the information corresponding to <meta:cell-count> to given value.
 void setCharacterCount(int characterCount)
          Set the information corresponding to <meta:character-count> to given value.
 void setCreationDate(Date creationDate)
          Set the information corresponding to <meta:creation-date> to given value.
 void setCreationDate(String strCreationDate)
          Set the information corresponding to <meta:creation-date> to given value.
 void setCreator(String creator)
          Set the information corresponding to <dc:creator> to given value.
 void setDate(Date date)
          Set the information corresponding to <dc:date> (the last editing date) to given value.
 void setDate(String strDate)
          Set the information corresponding to <dc:date> (the last editing date) to given value.
 void setDescription(String description)
          Set the information corresponding to <dc:description> to given value.
 void setDrawCount(int drawCount)
          Set the information corresponding to meta:draw-count to given value.
 void setEditingCycles(int editingCycles)
          Set the information corresponding to <meta:editing-cycles> to given value.
 void setEditingCycles(String strEditingCycles)
          Set the information corresponding to <meta:editing-cycles> to given value.
 void setEditingDuration(Duration editingDuration)
          Set the information corresponding to <meta:editing-duration> to given value.
 void setEditingDuration(String strEditingDuration)
          Set the information corresponding to <meta:editing-duration> to given value.
 void setFrameCount(int frameCount)
          Set the information corresponding to <meta:frame-count> to given value.
 void setGenerator(String generator)
          Set the information corresponding to <meta:generator> to given value.
 void setImageCount(int imageCount)
          Set the information corresponding to meta:image-count to given value.
 void setInitialCreator(String initialCreator)
          Set the information corresponding to <meta:initial-creator> to given value.
 void setKeyword(String keyword)
          Set the information corresponding to <meta:keyword> to given value.
 void setLanguage(String language)
          Set the information corresponding to <dc:language> to given value.
 void setNonWhitespaceCharacterCount(int nonWhitespaceCharacterCount)
          Set the information corresponding to <meta:non-whitespace-character-count> to given value.
 void setObjectCount(int objectCount)
          Set the information corresponding to <meta:object-count> to given value.
 void setOleObjectCount(int oleObjectCount)
          Set the information corresponding to meta:ole-object-count to given value.
 void setPageCount(int pageCount)
          Set the information corresponding to meta:page-count to given value.
 void setParagraphCount(int paragraphCount)
          Set the information corresponding to meta:paragraph-count to given value.
 void setPrintDate(Date printDate)
          Set the information corresponding to <meta:print-date> to given value.
 void setPrintDate(String strPrintDate)
          Set the information corresponding to <meta:print-date> to given value.
 void setPrintedBy(String printedBy)
          Set the information corresponding to <meta:printed-by> to given value.
 void setRowCount(int rowCount)
          Set the information corresponding to <meta:row-count> to given value.
 void setSentenceCount(int sentenceCount)
          Set the information corresponding to <meta:sentence-count> to given value.
 void setSubject(String subject)
          Set the information corresponding to <dc:subject> to given value.
 void setSyllableCount(int syllableCount)
          Set the information corresponding to <meta:syllable-count> to given value.
 void setTableCount(int tableCount)
          Set the information corresponding to meta:table-count to given value.
 void setTitle(String title)
          Set the information corresponding to <dc:title> to given value.
 void setUserDefined(Hashtable userDefined)
          Set the information corresponding to all <meta:user-defined> elements.
 void setUserDefined(String name, boolean value)
          Set user-defined info for given name to a boolean value.
 void setUserDefined(String name, double value)
          Set user-defined info for given name to a double value.
 void setUserDefined(String name, int value)
          Set user-defined info for given name to an integer value.
 void setUserDefined(String name, Object value)
          Set user-defined info for given name to an Object value.
 void setWordCount(int wordCount)
          Set the information corresponding to <meta:wod-count> to given value.
 String toString()
          Returns a string representation of this OpenDocumentMetadata.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

userDefined

protected Hashtable userDefined
Constructor Detail

OpenDocumentMetadata

public OpenDocumentMetadata()
Method Detail

getGenerator

public String getGenerator()
Return the generator meta information.

Returns:
the generator.

setGenerator

public void setGenerator(String generator)
Set the information corresponding to <meta:generator> to given value.

Parameters:
generator - the generator.

getTitle

public String getTitle()
Return the document title.

Returns:
the title.

setTitle

public void setTitle(String title)
Set the information corresponding to <dc:title> to given value.

Parameters:
title - the title.

getDescription

public String getDescription()
Return the document description.

Returns:
the description.

setDescription

public void setDescription(String description)
Set the information corresponding to <dc:description> to given value.

Parameters:
description - the description.

getSubject

public String getSubject()
Return the document subject.

Returns:
the subject.

setSubject

public void setSubject(String subject)
Set the information corresponding to <dc:subject> to given value.

Parameters:
subject - the subject.

getKeyword

public String getKeyword()
Return the list of keywords for this document.

Returns:
a string of keyword information.

setKeyword

public void setKeyword(String keyword)
Set the information corresponding to <meta:keyword> to given value.

Parameters:
keyword - the keyword.

getInitialCreator

public String getInitialCreator()
Return the document's initial creator.

Returns:
the creator.

setInitialCreator

public void setInitialCreator(String initialCreator)
Set the information corresponding to <meta:initial-creator> to given value.

Parameters:
initialCreator - the initial creator.

getCreator

public String getCreator()
Return the last editor of the document.

Returns:
the last editor.

setCreator

public void setCreator(String creator)
Set the information corresponding to <dc:creator> to given value. This is actually the last person to edit the document.

Parameters:
creator - the last editor.

getPrintedBy

public String getPrintedBy()
Return the last person to print the document.

Returns:
the subject.

setPrintedBy

public void setPrintedBy(String printedBy)
Set the information corresponding to <meta:printed-by> to given value.

Parameters:
printedBy - the last person to print document.

getCreationDate

public Date getCreationDate()
Return the document's creation date and time. In the XML, date and time are in the format YYYY-MM-DDThh:mm:ss.

Returns:
the creation date and time.

setCreationDate

public void setCreationDate(Date creationDate)
Set the information corresponding to <meta:creation-date> to given value.

Parameters:
creationDate - the creationDate.

setCreationDate

public void setCreationDate(String strCreationDate)
Set the information corresponding to <meta:creation-date> to given value.

Parameters:
strCreationDate - the creation date in the form yyyy-mm-ddTHH:mm:ss.

getDate

public Date getDate()
Return the document's last edit date and time. In the XML, date and time are in the format YYYY-MM-DDThh:mm:ss.

Returns:
the date and time of last edit.

setDate

public void setDate(Date date)
Set the information corresponding to <dc:date> (the last editing date) to given value.

Parameters:
date - the last date document was edited.

setDate

public void setDate(String strDate)
Set the information corresponding to <dc:date> (the last editing date) to given value.

Parameters:
strDate - the last editing date in form yyyy-mm-ddTHH:mm:ss.

getPrintDate

public Date getPrintDate()
Return the date and time the document was last printed. In the XML, date and time are in the format YYYY-MM-DDThh:mm:ss.

Returns:
the last print date and time.

setPrintDate

public void setPrintDate(Date printDate)
Set the information corresponding to <meta:print-date> to given value.

Parameters:
printDate - the last editing date.

setPrintDate

public void setPrintDate(String strPrintDate)
Set the information corresponding to <meta:print-date> to given value.

Parameters:
strPrintDate - the last printed date in form yyyy-mm-ddTHH:mm:ss.

getLanguage

public String getLanguage()
Return the document's language. The language consists of a two or three letter Language Code taken from the ISO 639 standard optionally followed by a hyphen (-) and a two-letter Country Code taken from the ISO 3166 standard.

Returns:
the language.

setLanguage

public void setLanguage(String language)
Set the information corresponding to <dc:language> to given value.

Parameters:
language - the language as a two-letter code, optionally followed by hyphen and two-letter country code.

getEditingCycles

public int getEditingCycles()
Return the number of editing cycles for this document.

Returns:
the number of editing cycles.

setEditingCycles

public void setEditingCycles(int editingCycles)
Set the information corresponding to <meta:editing-cycles> to given value.

Parameters:
editingCycles - the number of editing cycles.

setEditingCycles

public void setEditingCycles(String strEditingCycles)
Set the information corresponding to <meta:editing-cycles> to given value.

Parameters:
strEditingCycles - the number of editing cycles.

getEditingDuration

public Duration getEditingDuration()
Return the total time spent editing the document. In the XML, duration is in the form PnYnMnDTnHnMnS.

Returns:
the creation date and time.

setEditingDuration

public void setEditingDuration(Duration editingDuration)
Set the information corresponding to <meta:editing-duration> to given value.

Parameters:
editingDuration - the total editing time.

setEditingDuration

public void setEditingDuration(String strEditingDuration)
Set the information corresponding to <meta:editing-duration> to given value.

Parameters:
strEditingDuration - the total editing time in the form PnYnMnDTnHnMnS.

getPageCount

public int getPageCount()
Return the total number of pages in the document.

Returns:
the number of pages.

setPageCount

public void setPageCount(int pageCount)
Set the information corresponding to meta:page-count to given value.

Parameters:
pageCount - the total number of pages.

getTableCount

public int getTableCount()
Return the total number of tables in this text or spreadsheet document.

Returns:
the number of tables.

setTableCount

public void setTableCount(int tableCount)
Set the information corresponding to meta:table-count to given value.

Parameters:
tableCount - the total number of tables.

getDrawCount

public int getDrawCount()
Return the total number of drawings in the document.

Returns:
the number of drawings.

setDrawCount

public void setDrawCount(int drawCount)
Set the information corresponding to meta:draw-count to given value.

Parameters:
drawCount - the total number of drawings.

getImageCount

public int getImageCount()
Return the total number of images in the document.

Returns:
the number of images.

setImageCount

public void setImageCount(int imageCount)
Set the information corresponding to meta:image-count to given value.

Parameters:
imageCount - the total number of images.

getOleObjectCount

public int getOleObjectCount()
Return the total number of OLE objects in the document.

Returns:
the number of OLE objects.

setOleObjectCount

public void setOleObjectCount(int oleObjectCount)
Set the information corresponding to meta:ole-object-count to given value.

Parameters:
oleObjectCount - the total number of OLE objects.

getParagraphCount

public int getParagraphCount()
Return the total number of paragraphs in the document.

Returns:
the number of paragraphs.

setParagraphCount

public void setParagraphCount(int paragraphCount)
Set the information corresponding to meta:paragraph-count to given value.

Parameters:
paragraphCount - the total number of paragraphs.

getWordCount

public int getWordCount()
Return the total number of words in the document.

Returns:
the number of words.

setWordCount

public void setWordCount(int wordCount)
Set the information corresponding to <meta:wod-count> to given value.

Parameters:
wordCount - the total number of words.

getCharacterCount

public int getCharacterCount()
Return the total number of characters in the document.

Returns:
the number of images.

setCharacterCount

public void setCharacterCount(int characterCount)
Set the information corresponding to <meta:character-count> to given value.

Parameters:
characterCount - the total number of characters.

getFrameCount

public int getFrameCount()
Return the total number of frames in the document.

Returns:
the number of frames.

setFrameCount

public void setFrameCount(int frameCount)
Set the information corresponding to <meta:frame-count> to given value.

Parameters:
frameCount - the total number of frames.

getSentenceCount

public int getSentenceCount()
Return the total number of sentences in the document.

Returns:
the number of sentences.

setSentenceCount

public void setSentenceCount(int sentenceCount)
Set the information corresponding to <meta:sentence-count> to given value.

Parameters:
sentenceCount - the total number of sentences.

getSyllableCount

public int getSyllableCount()
Return the total number of syllables in the document.

Returns:
the number of syllables.

setSyllableCount

public void setSyllableCount(int syllableCount)
Set the information corresponding to <meta:syllable-count> to given value.

Parameters:
syllableCount - the total number of syllables.

getNonWhitespaceCharacterCount

public int getNonWhitespaceCharacterCount()
Return the total number of non-whitespace characters in the document.

Returns:
the number of non-whitespace characters.

setNonWhitespaceCharacterCount

public void setNonWhitespaceCharacterCount(int nonWhitespaceCharacterCount)
Set the information corresponding to <meta:non-whitespace-character-count> to given value.

Parameters:
nonWhitespaceCharacterCount - the total number of non-whitespace characters.

getRowCount

public int getRowCount()
Return the total number of rows in the document. This applies to text documents, strangely, not spreadsheets.

Returns:
the number of images.

setRowCount

public void setRowCount(int rowCount)
Set the information corresponding to <meta:row-count> to given value.

Parameters:
rowCount - the total number of rows.

getCellCount

public int getCellCount()
Return the total number of cells in this spreadsheet document.

Returns:
the number of cells.

setCellCount

public void setCellCount(int cellCount)
Set the information corresponding to <meta:cell-count> to given value.

Parameters:
cellCount - the total number of cells.

getObjectCount

public int getObjectCount()
Return the total number of graphic objects in this spreadsheet or graphics document.

Returns:
the number of graphic objects.

setObjectCount

public void setObjectCount(int objectCount)
Set the information corresponding to <meta:object-count> to given value.

Parameters:
objectCount - the total number of graphic objects.

getUserDefined

public Hashtable getUserDefined()
Return the user-defined meta information. The hashtable key is a String giving the name of this user-defined information; the value is an Object which can either be Double, Date (for date), Duration (for time) Boolean, or String.

Returns:
the user-defined information.

setUserDefined

public void setUserDefined(Hashtable userDefined)
Set the information corresponding to all <meta:user-defined> elements.

Parameters:
userDefined - all user-defined meta-information.

setUserDefined

public void setUserDefined(String name,
                           int value)
Set user-defined info for given name to an integer value.

Parameters:
name - the name for this user-defined info
value - the integer value

setUserDefined

public void setUserDefined(String name,
                           double value)
Set user-defined info for given name to a double value.

Parameters:
name - the name for this user-defined info
value - the double value

setUserDefined

public void setUserDefined(String name,
                           boolean value)
Set user-defined info for given name to a boolean value.

Parameters:
name - the name for this user-defined info
value - the boolean value

setUserDefined

public void setUserDefined(String name,
                           Object value)
Set user-defined info for given name to an Object value. This is the catch-all that handles Dates, Durations, and true Double, Boolean, and String.

Parameters:
name - the name for this user-defined info
value - the object value

getFieldByName

public Object getFieldByName(String fieldName)
Returns an Object for a field by name.

Returns:
the field value for the given name, null if no such field.

toString

public String toString()
Returns a string representation of this OpenDocumentMetadata. This method is intended to be used only for debugging purposes. It lists all the non-static fields of the object in the order returned by getDeclaredFields(), with their values converted via toString().

Returns:
a string representation of this OpenDocumentMetadata.