Search in sources :

Example 1 with RecordMissingMetadataException

use of org.alfresco.module.org_alfresco_module_rm.record.RecordMissingMetadataException in project records-management by Alfresco.

the class RecordsEntityResource method completeRecord.

@Operation("complete")
@WebApiDescription(title = "Complete record", description = "Complete a record.")
public Record completeRecord(String recordId, Void body, Parameters parameters, WithResponse withResponse) {
    checkNotBlank("recordId", recordId);
    mandatory("parameters", parameters);
    // Get record
    NodeRef record = apiUtils.validateRecord(recordId);
    // Complete the record
    try {
        recordService.complete(record);
    } catch (RecordMissingMetadataException e) {
        throw new IntegrityException("The record has missing mandatory properties.", null);
    }
    // return record state
    FileInfo info = fileFolderService.getFileInfo(record);
    return nodesModelFactory.createRecord(info, parameters, null, false);
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) FileInfo(org.alfresco.service.cmr.model.FileInfo) IntegrityException(org.alfresco.repo.node.integrity.IntegrityException) RecordMissingMetadataException(org.alfresco.module.org_alfresco_module_rm.record.RecordMissingMetadataException) WebApiDescription(org.alfresco.rest.framework.WebApiDescription) Operation(org.alfresco.rest.framework.Operation)

Aggregations

RecordMissingMetadataException (org.alfresco.module.org_alfresco_module_rm.record.RecordMissingMetadataException)1 IntegrityException (org.alfresco.repo.node.integrity.IntegrityException)1 Operation (org.alfresco.rest.framework.Operation)1 WebApiDescription (org.alfresco.rest.framework.WebApiDescription)1 FileInfo (org.alfresco.service.cmr.model.FileInfo)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1