Search in sources :

Example 6 with MCRMetaIFS

use of org.mycore.datamodel.metadata.MCRMetaIFS in project mycore by MyCoRe-Org.

the class MCRMODSCommands method createDerivate.

private static MCRDerivate createDerivate(MCRObjectID documentID, File fileDir) throws MCRPersistenceException, IOException, MCRAccessException {
    MCRDerivate derivate = new MCRDerivate();
    derivate.setId(MCRObjectID.getNextFreeId(documentID.getProjectId(), "derivate"));
    derivate.setLabel("data object from " + documentID);
    String schema = CONFIG.getString("MCR.Metadata.Config.derivate", "datamodel-derivate.xml").replaceAll(".xml", ".xsd");
    derivate.setSchema(schema);
    MCRMetaLinkID linkId = new MCRMetaLinkID();
    linkId.setSubTag("linkmeta");
    linkId.setReference(documentID, null, null);
    derivate.getDerivate().setLinkMeta(linkId);
    MCRMetaIFS ifs = new MCRMetaIFS();
    ifs.setSubTag("internal");
    ifs.setSourcePath(fileDir.getAbsolutePath());
    derivate.getDerivate().setInternals(ifs);
    LOGGER.debug("Creating new derivate with ID {}", derivate.getId());
    MCRMetadataManager.create(derivate);
    setDefaultPermissions(derivate.getId());
    return derivate;
}
Also used : MCRMetaLinkID(org.mycore.datamodel.metadata.MCRMetaLinkID) MCRDerivate(org.mycore.datamodel.metadata.MCRDerivate) MCRMetaIFS(org.mycore.datamodel.metadata.MCRMetaIFS)

Aggregations

MCRDerivate (org.mycore.datamodel.metadata.MCRDerivate)6 MCRMetaIFS (org.mycore.datamodel.metadata.MCRMetaIFS)6 MCRMetaLinkID (org.mycore.datamodel.metadata.MCRMetaLinkID)6 MCRObjectID (org.mycore.datamodel.metadata.MCRObjectID)2 SignedJWT (com.nimbusds.jwt.SignedJWT)1 IOException (java.io.IOException)1 Response (javax.ws.rs.core.Response)1 MCRAccessException (org.mycore.access.MCRAccessException)1 MCRAccessInterface (org.mycore.access.MCRAccessInterface)1 MCRPersistenceException (org.mycore.common.MCRPersistenceException)1 MCRSession (org.mycore.common.MCRSession)1 MCRUserInformation (org.mycore.common.MCRUserInformation)1 MCRObject (org.mycore.datamodel.metadata.MCRObject)1 MCRPath (org.mycore.datamodel.niofs.MCRPath)1 MCRRestAPIException (org.mycore.restapi.v1.errors.MCRRestAPIException)1