Package org.mycore.datamodel.metadata
Class MCRObject
java.lang.Object
org.mycore.datamodel.metadata.MCRBase
org.mycore.datamodel.metadata.MCRObject
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 Summary
Modifier and TypeFieldDescriptionstatic final int
constant value for the object id lengthprotected String
static final String
Fields inherited from class org.mycore.datamodel.metadata.MCRBase
importMode, jdomDocument, MCR_ENCODING, mcrId, mcrSchema, mcrService, mcrVersion, NL, SLASH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
com.google.gson.JsonObject
Creates the JSON representation of this object.This method creates a XML stream for all object data.void
debug()
The method print all informations about this MCRObject.getLabel()
This methode return the object label.This method returns the instance of the MCRObjectMetadata class.protected String
This method return the instance of the MCRObjectStructure class.boolean
void
This method set the object label.protected void
setUp()
The given DOM was convert into an internal view of metadata.void
validate()
Validates this MCRObject.Methods inherited from class org.mycore.datamodel.metadata.MCRBase
getId, getSchema, getService, getVersion, isImportMode, isValid, setFromJDOM, setFromURI, setFromXML, setId, setImportMode, setSchema, setVersion, toString
-
Field Details
-
ROOT_NAME
- See Also:
-
MAX_LABEL_LENGTH
public static final int MAX_LABEL_LENGTHconstant value for the object id length- See Also:
-
mcrLabel
-
-
Constructor Details
-
MCRObject
This is the constructor of the MCRObject class. It creates an instance of the parser class and the metadata class.
The constructor reads the following information from the property file:- MCR.XMLParser.Class
- Throws:
MCRException
- general Exception of MyCoRe
-
MCRObject
- Throws:
SAXParseException
-
MCRObject
-
MCRObject
- Throws:
SAXParseException
IOException
-
-
Method Details
-
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
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
This methode return the object label. If this is not set, null was returned.- Returns:
- the lable as a string
-
setLabel
This method set the object label.- Parameters:
label
- the object label
-
setUp
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 classMCRBase
- Throws:
MCRException
- general Exception of MyCoRe
-
createXML
This method creates a XML stream for all object data.- Overrides:
createXML
in classMCRBase
- 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 theMCRBase.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 classMCRBase
- Returns:
- a json gson representation of this object
-
getRootTagName
- Specified by:
getRootTagName
in classMCRBase
-
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 classMCRBase
- Throws:
MCRException
- the MCRObject is invalid
-
hasParent
public boolean hasParent()- Returns:
- true if the MCRObject has got a parent mcrobject, false otherwise
-
getParent
-
checkLinkTargets
public void checkLinkTargets()
-