Search in sources :

Example 6 with MCRStoredMetadata

use of org.mycore.datamodel.ifs2.MCRStoredMetadata in project mycore by MyCoRe-Org.

the class MCRXMLMetadataManager method create.

/**
 * Stores metadata of a new MCRObject in the persistent store.
 *
 * @param mcrid the MCRObjectID
 * @param xml the xml metadata of the MCRObject
 * @param lastModified the date of last modification to set
 * @return the stored metadata as IFS2 object
 */
public MCRStoredMetadata create(MCRObjectID mcrid, MCRContent xml, Date lastModified) throws IOException {
    MCRStoredMetadata sm;
    try {
        sm = getStore(mcrid).create(xml, mcrid.getNumberAsInteger());
    } catch (JDOMException e) {
        throw new MCRPersistenceException("Error while storing object: " + mcrid, e);
    }
    sm.setLastModified(lastModified);
    MCRConfiguration.instance().systemModified();
    return sm;
}
Also used : MCRStoredMetadata(org.mycore.datamodel.ifs2.MCRStoredMetadata) JDOMException(org.jdom2.JDOMException) MCRPersistenceException(org.mycore.common.MCRPersistenceException)

Aggregations

MCRStoredMetadata (org.mycore.datamodel.ifs2.MCRStoredMetadata)6 JDOMException (org.jdom2.JDOMException)2 MCRPersistenceException (org.mycore.common.MCRPersistenceException)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 MCRContent (org.mycore.common.content.MCRContent)1 MCRMetadataStore (org.mycore.datamodel.ifs2.MCRMetadataStore)1 MCRObjectIDFileSystemDate (org.mycore.datamodel.ifs2.MCRObjectIDFileSystemDate)1