use of org.apache.abdera.i18n.iri.IRI in project dataverse by IQSS.
the class ReceiptGenerator method createDatasetReceipt.
DepositReceipt createDatasetReceipt(String baseUrl, Dataset dataset) {
logger.fine("baseUrl was: " + baseUrl);
DepositReceipt depositReceipt = new DepositReceipt();
String globalId = dataset.getGlobalIdString();
String editIri = baseUrl + "/edit/study/" + globalId;
depositReceipt.setEditIRI(new IRI(editIri));
/**
* @todo: should setLocation depend on if an atom entry or a zip file
* was deposited? (This @todo has been carried over from the DVN 3.x
* version.)
*/
depositReceipt.setLocation(new IRI(editIri));
depositReceipt.setEditMediaIRI(new IRI(baseUrl + "/edit-media/study/" + globalId));
depositReceipt.setStatementURI("application/atom+xml;type=feed", baseUrl + "/statement/study/" + globalId);
depositReceipt.addDublinCore("bibliographicCitation", dataset.getLatestVersion().getCitation());
depositReceipt.setSplashUri(dataset.getPersistentURL());
return depositReceipt;
}
use of org.apache.abdera.i18n.iri.IRI in project mycore by MyCoRe-Org.
the class MCRSwordCollectionManager method createNew.
@Override
public DepositReceipt createNew(String editIRI, Deposit deposit, AuthCredentials authCredentials, SwordConfiguration swordConfiguration) throws SwordError, SwordServerException, SwordAuthException {
LOGGER.info("createNew:{}", editIRI);
String collection = MCRSwordUtil.ParseLinkUtil.CollectionIRI.getCollectionNameFromCollectionIRI(new IRI(editIRI));
MCRSwordCollectionProvider collectionProvider = MCRSword.getCollection(collection);
collectionProvider.getAuthHandler().authentication(authCredentials);
return collectionProvider.getContainerHandler().addObject(deposit);
}
use of org.apache.abdera.i18n.iri.IRI in project mycore by MyCoRe-Org.
the class MCRSwordContainerManager method getEntry.
@Override
public DepositReceipt getEntry(String editIRI, Map<String, String> map, AuthCredentials authCredentials, SwordConfiguration swordConfiguration) throws SwordServerException, SwordError, 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("REQUEST: Get entry {} from {}!", objectIdString, collection);
collectionProvider.getAuthHandler().authentication(authCredentials);
MCRObjectID objectId = MCRObjectID.getInstance(objectIdString);
if (!MCRMetadataManager.exists(objectId)) {
throwObjectDoesNotExist(objectIdString);
}
MCRBase retrievedMCRBase = MCRMetadataManager.retrieve(objectId);
checkIsObject(retrievedMCRBase);
final Optional<Map<String, String>> accept = Optional.of(map);
return collectionProvider.getContainerHandler().getMetadata(collection, (MCRObject) retrievedMCRBase, accept);
}
use of org.apache.abdera.i18n.iri.IRI in project mycore by MyCoRe-Org.
the class MCRSwordContainerManager method deleteContainer.
@Override
public void deleteContainer(String editIRI, 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("REQUEST: Delete {} from {}", objectIdString, collection);
collectionProvider.getAuthHandler().authentication(authCredentials);
MCRObjectID objectId = MCRObjectID.getInstance(objectIdString);
if (!MCRMetadataManager.exists(objectId)) {
throwObjectDoesNotExist(objectIdString);
}
final MCRBase object = MCRMetadataManager.retrieve(objectId);
checkIsObject(object);
collectionProvider.getContainerHandler().deleteObject((MCRObject) object);
}
use of org.apache.abdera.i18n.iri.IRI in project mycore by MyCoRe-Org.
the class MCRSwordMediaManager method addResource.
public DepositReceipt addResource(String editMediaIRI, Deposit deposit, AuthCredentials authCredentials, SwordConfiguration swordConfiguration) throws SwordError, SwordServerException, SwordAuthException {
LOGGER.info("addResource: {}", editMediaIRI);
final IRI mediaEditIRI = new IRI(editMediaIRI);
final String requestDerivateID = MCRSwordUtil.ParseLinkUtil.MediaEditIRI.getDerivateFromMediaEditIRI(mediaEditIRI);
String requestFilePath = MCRSwordUtil.ParseLinkUtil.MediaEditIRI.getFilePathFromMediaEditIRI(mediaEditIRI);
final String collection = MCRSwordUtil.ParseLinkUtil.MediaEditIRI.getCollectionFromMediaEditIRI(mediaEditIRI);
doAuthentication(authCredentials, collection);
checkObject(requestDerivateID);
if (requestFilePath == null) {
requestFilePath = "/";
}
getMediaProvider(collection).addResource(requestDerivateID, requestFilePath, deposit);
final MCRObject mcrObject = MCRSwordUtil.getMcrObjectForDerivateID(requestDerivateID);
return MCRSword.getCollection(collection).getMetadataProvider().provideMetadata(mcrObject);
}
Aggregations