Class MCRObject

java.lang.Object
org.mycore.datamodel.metadata.MCRBase
org.mycore.datamodel.metadata.MCRObject

public final class MCRObject extends MCRBase
This class holds all information of a metadata object. For persistence operations see methods of MCRMetadataManager.
Version:
$Revision$ $Date$
Author:
Jens Kupferschmidt, Mathias Hegner, Thomas Scheffler (yagee)
  • Field Details

  • Constructor Details

  • Method Details

    • getMetadata

      public MCRObjectMetadata getMetadata()
      This method returns the instance of the MCRObjectMetadata class. If there was no MCRObjectMetadata found, null will be returned.
      Returns:
      the instance of the MCRObjectMetadata class
    • getStructure

      public MCRObjectStructure getStructure()
      This method return the instance of the MCRObjectStructure class. If this was not found, null was returned.
      Returns:
      the instance of the MCRObjectStructure class
    • getLabel

      public String getLabel()
      This methode return the object label. If this is not set, null was returned.
      Returns:
      the lable as a string
    • setLabel

      public void setLabel(String label)
      This method set the object label.
      Parameters:
      label - the object label
    • setUp

      protected void setUp() throws MCRException
      The given DOM was convert into an internal view of metadata. This are the object ID and the object label, also the blocks structure, flags and metadata.
      Overrides:
      setUp in class MCRBase
      Throws:
      MCRException - general Exception of MyCoRe
    • createXML

      public Document createXML() throws MCRException
      This method creates a XML stream for all object data.
      Overrides:
      createXML in class MCRBase
      Returns:
      a JDOM Document with the XML data of the object as byte array
      Throws:
      MCRException - if the content of this class is not valid
    • createJSON

      public com.google.gson.JsonObject createJSON()
      Creates the JSON representation of this object. Extends the MCRBase.createJSON() method with the following content:
         {
           id: "mycore_project_00000001",
           version: "3.0"
           label: "my mycore object",
           
           structure: MCRObjectStructure.createJSON(),
           metadata: MCRObjectMetadata.createJSON(),
           service: MCRObjectService.createJSON(),
         }
       
      Overrides:
      createJSON in class MCRBase
      Returns:
      a json gson representation of this object
    • getRootTagName

      protected String getRootTagName()
      Specified by:
      getRootTagName in class MCRBase
    • debug

      public void debug()
      The method print all informations about this MCRObject.
    • validate

      public void validate()
      Validates this MCRObject. This method throws an exception if:
      • the mcr_id is null
      • the XML schema is null or empty
      • the service part is null or invalid
      • the structure part is null or invalid
      • the metadata part is null or invalid
      Overrides:
      validate in class MCRBase
      Throws:
      MCRException - the MCRObject is invalid
    • hasParent

      public boolean hasParent()
      Returns:
      true if the MCRObject has got a parent mcrobject, false otherwise
    • getParent

      public MCRObjectID getParent()
    • checkLinkTargets

      public void checkLinkTargets()