use of org.mycore.datamodel.metadata.MCRObjectID in project mycore by MyCoRe-Org.
the class MCRSwordContainerManager method replaceMetadataAndMediaResource.
@Override
public DepositReceipt replaceMetadataAndMediaResource(String editIRI, Deposit deposit, AuthCredentials authCredentials, SwordConfiguration swordConfiguration) throws SwordError, SwordServerException, SwordAuthException {
IRI iri = new IRI(editIRI);
String collection = MCRSwordUtil.ParseLinkUtil.EditIRI.getCollectionFromEditIRI(iri);
String objectIdString = MCRSwordUtil.ParseLinkUtil.EditIRI.getObjectFromEditIRI(iri);
final MCRSwordCollectionProvider collectionProvider = MCRSword.getCollection(collection);
LOGGER.info(MessageFormat.format("REQUEST: Replace metadata and resource of {0} from {1} !", objectIdString, collection));
collectionProvider.getAuthHandler().authentication(authCredentials);
MCRObjectID objectId = MCRObjectID.getInstance(objectIdString);
if (!MCRMetadataManager.exists(objectId)) {
throwObjectDoesNotExist(objectIdString);
}
MCRBase retrievedMCRBase = MCRMetadataManager.retrieve(objectId);
return collectionProvider.getContainerHandler().replaceMetadataAndResources((MCRObject) retrievedMCRBase, deposit);
}
use of org.mycore.datamodel.metadata.MCRObjectID in project mycore by MyCoRe-Org.
the class MCRSwordContainerManager method addResources.
@Override
public DepositReceipt addResources(String editIRI, Deposit deposit, AuthCredentials authCredentials, SwordConfiguration swordConfiguration) throws SwordError, SwordServerException, SwordAuthException {
IRI iri = new IRI(editIRI);
String collection = MCRSwordUtil.ParseLinkUtil.EditIRI.getCollectionFromEditIRI(iri);
String objectIdString = MCRSwordUtil.ParseLinkUtil.EditIRI.getObjectFromEditIRI(iri);
final MCRSwordCollectionProvider collectionProvider = MCRSword.getCollection(collection);
LOGGER.info(MessageFormat.format("REQUEST: add resources {0} from {1} !", objectIdString, collection));
collectionProvider.getAuthHandler().authentication(authCredentials);
MCRObjectID objectId = MCRObjectID.getInstance(objectIdString);
if (!MCRMetadataManager.exists(objectId)) {
throwObjectDoesNotExist(objectIdString);
}
MCRBase retrievedMCRBase = MCRMetadataManager.retrieve(objectId);
return collectionProvider.getContainerHandler().addResources((MCRObject) retrievedMCRBase, deposit);
}
use of org.mycore.datamodel.metadata.MCRObjectID in project mycore by MyCoRe-Org.
the class MCRSwordContainerManager method replaceMetadata.
@Override
public DepositReceipt replaceMetadata(String editIRI, Deposit deposit, AuthCredentials authCredentials, SwordConfiguration swordConfiguration) throws SwordError, SwordServerException, SwordAuthException {
IRI iri = new IRI(editIRI);
String collection = MCRSwordUtil.ParseLinkUtil.EditIRI.getCollectionFromEditIRI(iri);
String objectIdString = MCRSwordUtil.ParseLinkUtil.EditIRI.getObjectFromEditIRI(iri);
final MCRSwordCollectionProvider collectionProvider = MCRSword.getCollection(collection);
LOGGER.info(MessageFormat.format("REQUEST: Replace metadata of {0} from {1} !", objectIdString, collection));
collectionProvider.getAuthHandler().authentication(authCredentials);
MCRObjectID objectId = MCRObjectID.getInstance(objectIdString);
if (!MCRMetadataManager.exists(objectId)) {
throwObjectDoesNotExist(objectIdString);
}
MCRBase retrievedMCRBase = MCRMetadataManager.retrieve(objectId);
checkIsObject(retrievedMCRBase);
return collectionProvider.getContainerHandler().replaceMetadata((MCRObject) retrievedMCRBase, deposit);
}
use of org.mycore.datamodel.metadata.MCRObjectID in project mycore by MyCoRe-Org.
the class MCRSwordContainerHandler method addObject.
public DepositReceipt addObject(Deposit deposit) throws SwordError, SwordServerException {
final MCRSwordCollectionProvider collection = MCRSword.getCollection(this.lifecycleConfiguration.getCollection());
final MCRObjectID idOfIngested = collection.getIngester().ingestMetadata(deposit);
final MCRObject createdObject = (MCRObject) MCRMetadataManager.retrieve(idOfIngested);
return collection.getMetadataProvider().provideMetadata(createdObject);
}
use of org.mycore.datamodel.metadata.MCRObjectID in project mycore by MyCoRe-Org.
the class MCRSwordContainerHandler method addObjectWithDerivate.
public DepositReceipt addObjectWithDerivate(String objectIdString, Deposit deposit) throws SwordError, SwordServerException {
final MCRSwordCollectionProvider collection = MCRSword.getCollection(this.lifecycleConfiguration.getCollection());
final MCRObjectID idOfIngested = collection.getIngester().ingestMetadataResources(deposit);
final MCRObject createdObject = (MCRObject) MCRMetadataManager.retrieve(idOfIngested);
return collection.getMetadataProvider().provideMetadata(createdObject);
}
Aggregations