Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,7 @@ public enum OrchestratorType {

public static final String STORAGE_AIP_METADATA_FILENAME = "aip.json";
public static final String STORAGE_DIP_METADATA_FILENAME = "dip.json";
public static final String STORAGE_METS_FILENAME = "METS.xml";

/*
* OTHER METADATA TYPES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3671,6 +3671,22 @@ public void createSubmission(Path submissionPath, String aipId) throws AlreadyEx
storage.createBinary(submissionStoragePath, new FSPathContentPayload(submissionPath), false);
}

@Override
public void createMetsFile(String aipId, String repId, ContentPayload metsPayload) throws RequestNotValidException, GenericException, AlreadyExistsException, AuthorizationDeniedException, NotFoundException {
RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType);

StoragePath metsOutPut = null;

if (repId!=null) {
metsOutPut = ModelUtils.getMetsStoragePath(aipId, repId);
}
else {
metsOutPut = ModelUtils.getMetsStoragePath(aipId, null);
}
storage.createBinary(metsOutPut, metsPayload, false);

}

private Directory getDocumentationDirectory(String aipId)
throws RequestNotValidException, NotFoundException, GenericException, AuthorizationDeniedException {
return storage.getDirectory(ModelUtils.getDocumentationStoragePath(aipId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2670,6 +2670,20 @@ public void createSubmission(Path submissionPath, String aipId) throws AlreadyEx
}
}

@Override
public void createMetsFile(String aipId, String repID, ContentPayload metsPayload) throws RequestNotValidException, GenericException,
AlreadyExistsException, AuthorizationDeniedException, NotFoundException {
TransactionalModelOperationLog operationLog = operationRegistry.registerUpdateOperationForAIP(aipId);
try {
getModelService().createMetsFile(aipId, repID, metsPayload);
operationRegistry.updateOperationState(operationLog, OperationState.SUCCESS);
} catch (AlreadyExistsException | GenericException | RequestNotValidException | NotFoundException
| AuthorizationDeniedException e) {
operationRegistry.updateOperationState(operationLog, OperationState.FAILURE);
throw e;
}
}

@Override
public File createDocumentation(String aipId, String representationId, List<String> directoryPath, String fileId,
ContentPayload contentPayload) throws RequestNotValidException, GenericException, AlreadyExistsException,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,10 @@ void createSubmission(StorageService submissionStorage, StoragePath submissionSt
void createSubmission(Path submissionPath, String aipId) throws AlreadyExistsException, GenericException,
RequestNotValidException, NotFoundException, AuthorizationDeniedException;

void createMetsFile(String aipId, String repId, ContentPayload contentPayload)
throws RequestNotValidException, GenericException, AlreadyExistsException, AuthorizationDeniedException,
NotFoundException;

File createDocumentation(String aipId, String representationId, List<String> directoryPath, String fileId,
ContentPayload contentPayload) throws RequestNotValidException, GenericException, AlreadyExistsException,
AuthorizationDeniedException, NotFoundException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import org.roda.core.data.v2.risks.Risk;
import org.roda.core.data.v2.risks.RiskIncidence;
import org.roda.core.data.v2.synchronization.central.DistributedInstance;
import org.roda.core.entity.transaction.TransactionalModelOperationLog;
import org.roda.core.index.IndexService;
import org.roda.core.model.lites.ParsedAIPLite;
import org.roda.core.model.lites.ParsedDIPFileLite;
Expand Down Expand Up @@ -167,6 +166,20 @@ public static StoragePath getRepresentationStoragePath(String aipId, String repr
return DefaultStoragePath.parse(getRepresentationPath(aipId, representationId));
}

public static StoragePath getMetsStoragePath(String aipId, String representationId) throws RequestNotValidException {

DefaultStoragePath metsOutputPath = null;

if (representationId != null) {
metsOutputPath = DefaultStoragePath.parse(build(getAIPPath(aipId), RodaConstants.STORAGE_DIRECTORY_REPRESENTATIONS, representationId,
RodaConstants.STORAGE_METS_FILENAME));
}
else {
metsOutputPath = DefaultStoragePath.parse(build(getAIPPath(aipId), RodaConstants.STORAGE_METS_FILENAME));
}
return metsOutputPath;
}

private static List<String> getRepresentationMetadataPath(String aipId, String representationId) {
return build(getRepresentationPath(aipId, representationId), RodaConstants.STORAGE_DIRECTORY_METADATA);
}
Expand Down
Loading