Class OdfOfficeMeta

java.lang.Object
org.odftoolkit.odfdom.incubator.meta.OdfOfficeMeta

public class OdfOfficeMeta extends Object
OdfOfficeMeta represent the meta data feature in the ODF document.

It provides convenient method to get meta data info.

  • Constructor Details

    • OdfOfficeMeta

      public OdfOfficeMeta(OdfFileDom metaDom)
      Constructor of OdfOfficeMeta feature.
      Parameters:
      metaDom - the file DOM element of meta.xml
  • Method Details

    • getOfficeMetaElement

      public OfficeMetaElement getOfficeMetaElement()
      Get the instance of OfficeMetaElement which represents this feature.
      Returns:
      the instance of OfficeMetaElement
    • getGenerator

      public String getGenerator()
      Receives the value of the ODFDOM element representation MetaGeneratorElement , See <meta:generator>.
      Returns:
      the generator info of the current document;

      null, if the element is not set.

    • setGenerator

      public void setGenerator(String generator)
      Sets the value of the ODFDOM element representation MetaGeneratorElement , See <meta:generator>.
      Parameters:
      generator - set the specified document generator. NULL will remove the element from the meta.xml.
    • getTitle

      public String getTitle()
      Receives the value of the ODFDOM element representation DcTitleElement , See <dc:title>.
      Returns:
      the title of the current document;

      null, if the element is not set.

    • setTitle

      public void setTitle(String title)
      Sets the value of the ODFDOM element representation DcTitleElement , See <dc:title>.
      Parameters:
      title - set the specified document title. NULL will remove the element from the meta.xml.
    • getDescription

      public String getDescription()
      Receives the value of the ODFDOM element representation DcDescriptionElement , See <dc:description>.
      Returns:
      the description of the current document;

      null, if the element is not set.

    • setDescription

      public void setDescription(String description)
      Sets the value of the ODFDOM element representation DcDescriptionElement , See <dc:description>.
      Parameters:
      description - set the specified document description. NULL will remove the element from the meta.xml.
    • getSubject

      public String getSubject()
      Receives the value of the ODFDOM element representation DcSubjectElement , See <dc:subject>.
      Returns:
      the subject of the current document;

      null, if the element is not set.

    • setSubject

      public void setSubject(String subject)
      Sets the value of the ODFDOM element representation DcSubjectElement , See <dc:subject>.
      Parameters:
      subject - set the specified document subject. NULL will remove the element from the meta.xml.
    • getKeywords

      public List<String> getKeywords()
      Receives the list value of the ODFDOM element representation MetaKeywordElement , See <meta:keyword>.
      Returns:
      the keywords of the current document;

      null, if the element is not set.

    • setKeywords

      public void setKeywords(List<String> keyList)
      Sets the list value of the ODFDOM element representation MetaKeywordElement , See <meta:keyword>.
      Parameters:
      keyList - set the specified list of keywords
    • addKeyword

      public void addKeyword(String keyword)
      Add the keyword to the current document. Create child element <meta:keyword>.
      Parameters:
      keyword - the value of child element <meta:keyword>.
    • getUserDefinedDataNames

      public List<String> getUserDefinedDataNames()
      Receives the list value of the ODFDOM element representation MetaUserDefinedElement , See <meta:user-defined>.
      Returns:
      get the list of user-defined metadata names;

      null, if the element is not set.

    • getUserDefinedElementByAttributeName

      public MetaUserDefinedElement getUserDefinedElementByAttributeName(String name)
      Receives the ODFDOM element representation MetaUserDefinedElement by attribute name, See <meta:user-defined>.
      Parameters:
      name - the name of the user-defined metadata
      Returns:
      the MetaUserDefinedElement which is identified by the specified name;

      null, if the element is not set.

    • getUserDefinedDataValue

      public String getUserDefinedDataValue(String name)
      Receives the value of the ODFDOM element representation MetaUserDefinedElement by attribute name, See <meta:user-defined>.
      Parameters:
      name - the name of the user-defined metadata
      Returns:
      the value of the user-defined metadata with the specified name;

      null, if the element is not set.

    • getUserDefinedDataType

      public String getUserDefinedDataType(String name)
      Receives the data type of the ODFDOM element representation MetaUserDefinedElement by attribute name, See <meta:user-defined>.
      Parameters:
      name - the name of the user-defined metadata
      Returns:
      the data type of the user-defined metadata with the specified name;

      null, if the element is not set.

    • removeUserDefinedDataByName

      public void removeUserDefinedDataByName(String name)
      Remove the ODFDOM element representation MetaUserDefinedElement by attribute name, See <meta:user-defined>.
      Parameters:
      name - the name of the user-defined metadata
    • setUserDefinedDataValue

      public void setUserDefinedDataValue(String name, String value)
      Sets the value of the ODFDOM element representation MetaUserDefinedElement by attribute name, See <meta:user-defined>.
      Parameters:
      name - the name need to set for the user-defined metadata
      value - the value need to set for the user-defined metadata
    • setUserDefinedDataType

      public void setUserDefinedDataType(String name, String value)
      Sets the data type of the ODFDOM element representation MetaUserDefinedElement by attribute name, See <meta:user-defined>.
      Parameters:
      name - the name need to set for the user-defined metadata
      value - the value need to set for the user-defined metadata
    • setUserDefinedData

      public void setUserDefinedData(String name, String type, String value)
      Sets the ODFDOM element representation MetaUserDefinedElement , See <meta:user-defined> if the element with the attribute name exists,then update;or create a new element if type or value is null,the original will not be updated.
      Parameters:
      name - the name need to set for the user-defined metadata
      type - the data type need to set for the user-defined metadata
      value - the value need to set for the user-defined metadata
    • getInitialCreator

      public String getInitialCreator()
      Receives the value of the ODFDOM element representation MetaInitialCreatorElement , See <meta:initial-creator>.
      Returns:
      get the initial creator of the current document;

      null, if the element is not set.

    • setInitialCreator

      public void setInitialCreator(String initialCreator)
      Sets the value of the ODFDOM element representation MetaInitialCreatorElement , See <meta:initial-creator>.
      Parameters:
      initialCreator - set the specified initial creator. NULL will remove the element from the meta.xml.
    • getCreator

      public String getCreator()
      Receives the value of the ODFDOM element representation DcCreatorElement , See <dc:creator>
      Returns:
      the creator of the current document;

      null, if the element is not set.

    • setCreator

      public void setCreator(String creator)
      Sets the value of the ODFDOM element representation DcCreatorElement , See <dc:creator>.
      Parameters:
      creator - set the specified creator. NULL will remove the element from the meta.xml.
    • getPrintedBy

      public String getPrintedBy()
      Receives the value of the ODFDOM element representation MetaPrintedByElement , See <meta:printed-by>
      Returns:
      the name of the last person who printed the current document;

      null, if element is not set

    • setPrintedBy

      public void setPrintedBy(String printedBy)
      Sets the value of the ODFDOM element representation MetaPrintedByElement , See <meta:printed-by>.
      Parameters:
      printedBy - the name need to set for the last person who printed the current document. NULL will remove the element from the meta.xml.
    • getCreationDate

      public Calendar getCreationDate()
      Receives the value of the ODFDOM element representation MetaCreationDateElement , See <meta:creation-date>
      Returns:
      the date and time when the document was created initially;

      null, if element is not set

    • setCreationDate

      public void setCreationDate(Calendar creationDate)
      Sets the value of the ODFDOM element representation MetaCreationDateElement , See <meta:creation-date>.
      Parameters:
      creationDate - the date and time need to set. NULL will remove the element from the meta.xml.
    • getDate

      public Calendar getDate()
      Receives the value of the ODFDOM element representation DcDateElement , See <dc:date>.
      Returns:
      the date and time when the document was last modified;

      null, if the element is not set.

    • setDate

      public void setDate(Calendar date)
      Sets the value of the ODFDOM element representation DcDateElement , See <dc:date>.
      Parameters:
      date - the date and time need to set. NULL will remove the element from the meta.xml.
    • getPrintDate

      public Calendar getPrintDate()
      Receives the value of the ODFDOM element representation MetaPrintDateElement , See <meta:print-date>.
      Returns:
      the date and time when the document was last printed;

      null, if the element is not set.

    • setPrintDate

      public void setPrintDate(Calendar printDate)
      Sets the value of the ODFDOM element representation MetaPrintDateElement , See <meta:print-date>.
      Parameters:
      printDate - the date and time need to set. NULL will remove the element from the meta.xml.
    • getLanguage

      public String getLanguage()
      Receives the value of the ODFDOM element representation DcLanguageElement , See <dc:language>.
      Returns:
      the default language of the document;

      null, if the element is not set.

    • setLanguage

      public void setLanguage(String language)
      Sets the value of the ODFDOM element representation DcLanguageElement , See <dc:language>.
      Parameters:
      language - the default language need to set fo the current document. NULL will remove the element from the meta.xml.
    • getEditingCycles

      public Integer getEditingCycles()
      Receives the value of the ODFDOM element representation MetaEditingCyclesElement , See <meta:editing-cycles>.
      Returns:
      the number of times that the document has been edited;

      null, if the element is not set.

    • setEditingCycles

      public void setEditingCycles(Integer editingCycles)
      Sets the value of the ODFDOM element representation MetaEditingCyclesElement , See <meta:editing-cycles>.
      Parameters:
      editingCycles - set the specified edit times. NULL will remove the element from the meta.xml.
    • getEditingDuration

      public Duration getEditingDuration()
      Receives the value of the ODFDOM element representation MetaEditingDurationElement , See <meta:editing-duration>.
      Returns:
      the total time spent editing the document;

      null, if the element is not set.

    • setEditingDuration

      public void setEditingDuration(Duration editingDuration)
      Sets the value of the ODFDOM element representation MetaEditingDurationElement , See <meta:editing-duration>.
      Parameters:
      editingDuration - the time need to set. NULL will remove the element from the meta.xml.
    • getDocumentStatistic

      public OdfMetaDocumentStatistic getDocumentStatistic()
      Receives the sub feature of OdfMetaDocumentStatistic.
      Returns:
      the statistics about the document which can be represented by OdfMetaDocumentStatistic feature;

      null, if the feature is not exist.

    • getHyperlinkBehaviour

      public OdfMetaHyperlinkBehaviour getHyperlinkBehaviour()
      Receives the OdfMetaHyperlinkBehaviour feature.
      Returns:
      the default behavior of hyperlinks in the current document which can be represented by OdfMetaHyperlinkBehaviour feature;

      null, if the feature is not exist.

    • getAutoReload

      public OdfMetaAutoReload getAutoReload()
      Receives the OdfMetaAutoReload feature.
      Returns:
      the information whether the document is reloaded or replaced by another document after a certain period of time has elapsed.

      It can be represented by OdfMetaAutoReload feature;

      null, if the feature is not exist.

    • getTemplate

      public OdfMetaTemplate getTemplate()
      Receives the OdfMetaTemplate feature.
      Returns:
      the information specified the URL for the document that was used to create a document.

      It can be represented by OdfMetaTemplate feature;

      null, if the feature is not exist.

    • setAutomaticUpdate

      public void setAutomaticUpdate(boolean enableAutomaticUpdate)
      Parameters:
      enableAutomaticUpdate - If the automatic update of metadata is enabled, metadata such as last modified data is set during saving the document. The default is true, disabling the default allows to load and save a document without changing any data.
    • hasAutomaticUpdate

      public boolean hasAutomaticUpdate()
      Returns:
      If the automatic update of metadata is enabled, metadata such as last modified data is set during saving the document. The default is true, disabling the default allows to load and save a document without changing any data.
    • toString

      public String toString()
      Overrides:
      toString in class Object