Search in sources :

Example 41 with WebApiDescription

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

the class UnfiledRecordFolderEntityResource method readById.

@WebApiDescription(title = "Get unfiled record folder information", description = "Gets information for an unfiled record folder with id 'unfiledRecordFolderId'")
@WebApiParam(name = "unfiledRecordFolderId", title = "The unfiled record folder id")
public UnfiledRecordFolder readById(String unfiledRecordFolderId, Parameters parameters) {
    checkNotBlank("unfiledRecordFolderId", unfiledRecordFolderId);
    mandatory("parameters", parameters);
    String relativePath = parameters.getParameter(Nodes.PARAM_RELATIVE_PATH);
    NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(unfiledRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER, relativePath, true);
    FileInfo info = fileFolderService.getFileInfo(nodeRef);
    return nodesModelFactory.createUnfiledRecordFolder(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 42 with WebApiDescription

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

the class UnfiledRecordFolderEntityResource method delete.

@Override
@WebApiDescription(title = "Delete unfiled record folder", description = "Deletes an unfiled record folder with id 'unfiledRecordFolderId'")
public void delete(String unfiledRecordFolderId, Parameters parameters) {
    checkNotBlank("unfiledRecordFolderId", unfiledRecordFolderId);
    mandatory("parameters", parameters);
    NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(unfiledRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER);
    fileFolderService.delete(nodeRef);
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) WebApiDescription(org.alfresco.rest.framework.WebApiDescription)

Example 43 with WebApiDescription

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

the class RecordCategoriesEntityResource method readById.

@WebApiDescription(title = "Get record category information", description = "Gets information for a record category with id 'recordCategoryId'")
@WebApiParam(name = "recordCategoryId", title = "The record category id")
public RecordCategory readById(String recordCategoryId, Parameters parameters) {
    checkNotBlank("recordCategoryId", recordCategoryId);
    mandatory("parameters", parameters);
    String relativePath = parameters.getParameter(Nodes.PARAM_RELATIVE_PATH);
    NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(recordCategoryId, RecordsManagementModel.TYPE_RECORD_CATEGORY, relativePath, true);
    FileInfo info = fileFolderService.getFileInfo(nodeRef);
    return nodesModelFactory.createRecordCategory(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 44 with WebApiDescription

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

the class RecordCategoriesEntityResource method update.

@Override
@WebApiDescription(title = "Update record category", description = "Updates a record category with id 'recordCategoryId'")
public RecordCategory update(String recordCategoryId, RecordCategory recordCategoryInfo, Parameters parameters) {
    checkNotBlank("recordCategoryId", recordCategoryId);
    mandatory("recordCategoryInfo", recordCategoryInfo);
    mandatory("parameters", parameters);
    NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(recordCategoryId, RecordsManagementModel.TYPE_RECORD_CATEGORY);
    RetryingTransactionCallback<Void> callback = new RetryingTransactionCallback<Void>() {

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

        public FileInfo execute() {
            return fileFolderService.getFileInfo(nodeRef);
        }
    };
    FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
    return nodesModelFactory.createRecordCategory(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 45 with WebApiDescription

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

the class RecordCategoriesEntityResource method delete.

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

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