Search in sources :

Example 46 with WebApiDescription

use of org.alfresco.rest.framework.WebApiDescription in project records-management by Alfresco.

the class RecordFolderEntityResource method readById.

@WebApiDescription(title = "Get record folder information", description = "Gets information for a record folder with id 'recordFolderId'")
@WebApiParam(name = "recordFolderId", title = "The record folder id")
public RecordFolder readById(String recordFolderId, Parameters parameters) {
    checkNotBlank("recordFolderId", recordFolderId);
    mandatory("parameters", parameters);
    NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(recordFolderId, RecordsManagementModel.TYPE_RECORD_FOLDER);
    FileInfo info = fileFolderService.getFileInfo(nodeRef);
    return nodesModelFactory.createRecordFolder(info, parameters, null, false);
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) FileInfo(org.alfresco.service.cmr.model.FileInfo) WebApiDescription(org.alfresco.rest.framework.WebApiDescription) WebApiParam(org.alfresco.rest.framework.WebApiParam)

Example 47 with WebApiDescription

use of org.alfresco.rest.framework.WebApiDescription in project records-management by Alfresco.

the class RecordsEntityResource method update.

@Override
@WebApiDescription(title = "Update record", description = "Updates a record with id 'recordId'")
public Record update(String recordId, Record recordInfo, Parameters parameters) {
    checkNotBlank("recordId", recordId);
    mandatory("recordInfo", recordInfo);
    mandatory("parameters", parameters);
    // Get record
    NodeRef record = apiUtils.validateRecord(recordId);
    // update info
    RetryingTransactionCallback<Void> callback = new RetryingTransactionCallback<Void>() {

        public Void execute() {
            apiUtils.updateNode(record, recordInfo, parameters);
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
    // return record state
    RetryingTransactionCallback<FileInfo> readCallback = new RetryingTransactionCallback<FileInfo>() {

        public FileInfo execute() {
            return fileFolderService.getFileInfo(record);
        }
    };
    FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
    apiUtils.postActivity(info, recordInfo.getParentId(), ActivityType.FILE_UPDATED);
    return nodesModelFactory.createRecord(info, parameters, null, false);
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) FileInfo(org.alfresco.service.cmr.model.FileInfo) RetryingTransactionCallback(org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback) WebApiDescription(org.alfresco.rest.framework.WebApiDescription)

Example 48 with WebApiDescription

use of org.alfresco.rest.framework.WebApiDescription in project records-management by Alfresco.

the class RecordsEntityResource method delete.

@Override
@WebApiDescription(title = "Delete record", description = "Deletes a record with id 'recordId'")
public void delete(String recordId, Parameters parameters) {
    checkNotBlank("recordId", recordId);
    mandatory("parameters", parameters);
    NodeRef record = apiUtils.validateRecord(recordId);
    fileFolderService.delete(record);
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) WebApiDescription(org.alfresco.rest.framework.WebApiDescription)

Example 49 with WebApiDescription

use of org.alfresco.rest.framework.WebApiDescription in project records-management by Alfresco.

the class RecordsEntityResource method readById.

@WebApiDescription(title = "Get record information", description = "Gets information for a record with id 'recordId'")
@WebApiParam(name = "recordId", title = "The record id")
public Record readById(String recordId, Parameters parameters) {
    checkNotBlank("recordId", recordId);
    mandatory("parameters", parameters);
    NodeRef record = apiUtils.validateRecord(recordId);
    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) WebApiDescription(org.alfresco.rest.framework.WebApiDescription) WebApiParam(org.alfresco.rest.framework.WebApiParam)

Example 50 with WebApiDescription

use of org.alfresco.rest.framework.WebApiDescription in project records-management by Alfresco.

the class TransferEntityResource method readById.

@Override
@WebApiDescription(title = "Get transfer information", description = "Gets information for a transfer with id 'transferId'")
@WebApiParam(name = "transferId", title = "The transfer id")
public Transfer readById(String transferId, Parameters parameters) throws EntityNotFoundException {
    checkNotBlank("transferId", transferId);
    mandatory("parameters", parameters);
    NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(transferId, RecordsManagementModel.TYPE_TRANSFER);
    FileInfo info = fileFolderService.getFileInfo(nodeRef);
    return nodesModelFactory.createTransfer(info, parameters, null, false);
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) FileInfo(org.alfresco.service.cmr.model.FileInfo) WebApiDescription(org.alfresco.rest.framework.WebApiDescription) WebApiParam(org.alfresco.rest.framework.WebApiParam)

Aggregations

WebApiDescription (org.alfresco.rest.framework.WebApiDescription)52 NodeRef (org.alfresco.service.cmr.repository.NodeRef)47 FileInfo (org.alfresco.service.cmr.model.FileInfo)34 RetryingTransactionCallback (org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)16 HashMap (java.util.HashMap)14 UserInfo (org.alfresco.rest.api.model.UserInfo)13 WebApiParam (org.alfresco.rest.framework.WebApiParam)13 AbstractList (java.util.AbstractList)12 QName (org.alfresco.service.namespace.QName)11 EntityNotFoundException (org.alfresco.rest.framework.core.exceptions.EntityNotFoundException)8 LinkedList (java.util.LinkedList)5 List (java.util.List)5 QNamePattern (org.alfresco.service.namespace.QNamePattern)5 ArrayList (java.util.ArrayList)4 Operation (org.alfresco.rest.framework.Operation)4 Version (org.alfresco.service.cmr.version.Version)4 RegexQNamePattern (org.alfresco.service.namespace.RegexQNamePattern)4 FilterProp (org.alfresco.repo.node.getchildren.FilterProp)3 IntegrityException (org.alfresco.repo.node.integrity.IntegrityException)3 Node (org.alfresco.rest.api.model.Node)3