Package org.mycore.datamodel.metadata
Class MCRMetadataManager
java.lang.Object
org.mycore.datamodel.metadata.MCRMetadataManager
Delivers persistence operations for
MCRObject
and MCRDerivate
.- Since:
- 2.0.92
- Author:
- Thomas Scheffler (yagee)
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Adds or updates a derivate MCRMetaLinkID to the structure part and updates the object with the ID in the data store.static void
create
(MCRDerivate mcrDerivate) Stores the derivate.static void
Stores the object.static void
delete
(MCRDerivate mcrDerivate) Deletes MCRDerivate.static void
Deletes MCRObject.static void
Delete the derivate.static void
Deletes the object.static boolean
exists
(MCRObjectID id) Tells if the object or derivate withid
exists.static void
fireRepairEvent
(MCRBase mcrBaseObj) FiresMCREvent.EventType.REPAIR
for given object.static void
fireRepairEvent
(MCRDerivate mcrDerivate) FiresMCREvent.EventType.REPAIR
for given derivate.static void
fireRepairEvent
(MCRObject mcrObject) FiresMCREvent.EventType.REPAIR
for given object.static void
fireUpdateEvent
(MCRObject mcrObject) FiresMCREvent.EventType.UPDATE
for given object.static List<MCRObjectID>
getDerivateIds
(MCRObjectID objectId, long expire, TimeUnit unit) Returns a list of MCRObjectID of the derivates contained in the object with the given ID.static MCRObjectID
getObjectId
(MCRObjectID derivateID, long expire, TimeUnit unit) Returns the MCRObjectID of the object containing derivate with the given ID.static boolean
removeDerivateFromObject
(MCRObjectID objectID, MCRObjectID derivateID) static MCRBase
retrieve
(MCRObjectID id) static MCRDerivate
Retrieves instance ofMCRDerivate
with the givenMCRObjectID
static MCRObject
Retrieves an instance ofMCRObject
with the givenMCRObjectID
static void
Updates theMCRObject
orMCRDerivate
.static void
update
(MCRDerivate mcrDerivate) Updates the derivate or creates it if it does not exist yet.static void
Updates the object or creates it if it does not exist yet.
-
Method Details
-
getObjectId
Returns the MCRObjectID of the object containing derivate with the given ID.- Parameters:
derivateID
- derivateIDexpire
- when should lastModified information expire- Returns:
- null if derivateID has no object referenced
- See Also:
-
getDerivateIds
Returns a list of MCRObjectID of the derivates contained in the object with the given ID.- Parameters:
objectId
- objectIdexpire
- when should lastModified information expire- Returns:
- null if object with objectId does not exist
- See Also:
-
create
public static void create(MCRDerivate mcrDerivate) throws MCRPersistenceException, MCRAccessException Stores the derivate.- Parameters:
mcrDerivate
- derivate instance to store- Throws:
MCRPersistenceException
- if a persistence problem is occurredMCRAccessException
- if write permission to object is missing
-
create
Stores the object.- Parameters:
mcrObject
- object instance to store- Throws:
MCRPersistenceException
- if a persistence problem is occuredMCRAccessException
- if "create-{objectType}" privilege is missing
-
delete
public static void delete(MCRDerivate mcrDerivate) throws MCRPersistenceException, MCRAccessException Deletes MCRDerivate.- Parameters:
mcrDerivate
- to be deleted- Throws:
MCRPersistenceException
- if persistence problem occursMCRAccessException
- if delete permission is missing
-
delete
public static void delete(MCRObject mcrObject) throws MCRPersistenceException, MCRActiveLinkException, MCRAccessException Deletes MCRObject.- Parameters:
mcrObject
- to be deleted- Throws:
MCRActiveLinkException
- cannot be deleted cause its still linkedMCRPersistenceException
- if persistence problem occursMCRAccessException
- if delete permission is missing
-
deleteMCRDerivate
public static void deleteMCRDerivate(MCRObjectID id) throws MCRPersistenceException, MCRAccessException Delete the derivate. The order of delete steps is:
- remove link in object metadata
- remove all files from IFS
- remove derivate
- Parameters:
id
- the object ID- Throws:
MCRPersistenceException
- if a persistence problem is occurredMCRAccessException
- if delete permission is missing
-
deleteMCRObject
public static void deleteMCRObject(MCRObjectID id) throws MCRPersistenceException, MCRActiveLinkException, MCRAccessException Deletes the object.- Throws:
MCRPersistenceException
- if a persistence problem is occurredMCRActiveLinkException
- if object is referenced by other objectsMCRAccessException
- if delete permission is missing
-
exists
Tells if the object or derivate withid
exists.- Parameters:
id
- the object ID- Throws:
MCRPersistenceException
- the xml couldn't be read
-
fireRepairEvent
FiresMCREvent.EventType.REPAIR
for given derivate.- Throws:
MCRPersistenceException
-
fireRepairEvent
FiresMCREvent.EventType.REPAIR
for given object.- Throws:
MCRPersistenceException
-
fireRepairEvent
FiresMCREvent.EventType.REPAIR
for given object.- Throws:
MCRPersistenceException
-
fireUpdateEvent
FiresMCREvent.EventType.UPDATE
for given object. IfMCRBase.isImportMode()
modifydate will not be updated.- Parameters:
mcrObject
- mycore object which is updated- Throws:
MCRPersistenceException
-
retrieveMCRDerivate
Retrieves instance ofMCRDerivate
with the givenMCRObjectID
- Parameters:
id
- the derivate ID- Throws:
MCRPersistenceException
- if a persistence problem is occurred
-
retrieveMCRObject
Retrieves an instance ofMCRObject
with the givenMCRObjectID
- Parameters:
id
- the object ID- Throws:
MCRPersistenceException
- if a persistence problem is occurred
-
retrieve
- Parameters:
id
- derivate or object id- Throws:
MCRPersistenceException
- if a persistence problem is occurred
-
update
Updates theMCRObject
orMCRDerivate
.- Parameters:
base
- the object to update- Throws:
MCRPersistenceException
- if a persistence problem is occurredMCRAccessException
- if write permission is missing or seecreate(MCRObject)
-
update
public static void update(MCRDerivate mcrDerivate) throws MCRPersistenceException, MCRAccessException Updates the derivate or creates it if it does not exist yet.- Throws:
MCRPersistenceException
- if a persistence problem is occurredMCRAccessException
- if write permission to object or derivate is missing
-
update
Updates the object or creates it if it does not exist yet.- Throws:
MCRPersistenceException
- if a persistence problem is occurredMCRAccessException
- if write permission is missing or seecreate(MCRObject)
-
addOrUpdateDerivateToObject
public static boolean addOrUpdateDerivateToObject(MCRObjectID id, MCRMetaEnrichedLinkID link) throws MCRPersistenceException Adds or updates a derivate MCRMetaLinkID to the structure part and updates the object with the ID in the data store.- Parameters:
id
- the object IDlink
- a link to a derivate as MCRMetaLinkID- Returns:
- True if the link is added or updated, false if nothing changed.
- Throws:
MCRPersistenceException
- if a persistence problem is occurred
-
removeDerivateFromObject
public static boolean removeDerivateFromObject(MCRObjectID objectID, MCRObjectID derivateID) throws MCRPersistenceException - Throws:
MCRPersistenceException
-