use of org.alfresco.rest.framework.BinaryProperties in project records-management by Alfresco.
the class RecordsEntityResource method readProperty.
/**
* Download content
*
* @param recordId the id of the record to get the content from
* @param parameters {@link Parameters}
* @return binary content resource
* @throws EntityNotFoundException
*/
@Override
@WebApiDescription(title = "Download content", description = "Download content for a record with id 'recordId'")
@BinaryProperties({ "content" })
public BinaryResource readProperty(String recordId, Parameters parameters) throws EntityNotFoundException {
checkNotBlank("recordId", recordId);
mandatory("parameters", parameters);
NodeRef record = apiUtils.validateRecord(recordId);
if (nodeService.getType(record).equals(RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT)) {
throw new IllegalArgumentException("Cannot read content from Non-electronic record " + recordId + ".");
}
BinaryResource content = apiUtils.getContent(record, parameters, true);
NodeRef primaryParent = nodeService.getPrimaryParent(record).getParentRef();
FileInfo info = fileFolderService.getFileInfo(record);
apiUtils.postActivity(info, primaryParent, ActivityPoster.DOWNLOADED);
return content;
}
Aggregations