Search in sources :

Example 1 with TransferChild

use of org.alfresco.rm.rest.api.model.TransferChild in project records-management by Alfresco.

the class TransferChildrenRelation method readAll.

@Override
@WebApiDescription(title = "Return a paged list of record folders or records for the transfer identified by 'transferId'")
public CollectionWithPagingInfo<TransferChild> readAll(String transferId, Parameters parameters) {
    checkNotBlank("transferId", transferId);
    mandatory("parameters", parameters);
    NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(transferId, RecordsManagementModel.TYPE_TRANSFER);
    // list record folder, electronic record or non electronic record
    final PagingResults<FileInfo> pagingResults = fileFolderService.list(parentNodeRef, null, null, null, apiUtils.getSortProperties(parameters), null, Util.getPagingRequest(parameters.getPaging()));
    final List<FileInfo> page = pagingResults.getPage();
    Map<String, UserInfo> mapUserInfo = new HashMap<>();
    List<TransferChild> nodes = new AbstractList<TransferChild>() {

        @Override
        public TransferChild get(int index) {
            FileInfo info = page.get(index);
            return nodesModelFactory.createTransferChild(info, parameters, mapUserInfo, true);
        }

        @Override
        public int size() {
            return page.size();
        }
    };
    Transfer sourceEntity = null;
    if (parameters.includeSource()) {
        FileInfo info = fileFolderService.getFileInfo(parentNodeRef);
        sourceEntity = nodesModelFactory.createTransfer(info, parameters, mapUserInfo, true);
    }
    return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodes, pagingResults.hasMoreItems(), pagingResults.getTotalResultCount().getFirst(), sourceEntity);
}
Also used : AbstractList(java.util.AbstractList) NodeRef(org.alfresco.service.cmr.repository.NodeRef) FileInfo(org.alfresco.service.cmr.model.FileInfo) HashMap(java.util.HashMap) TransferChild(org.alfresco.rm.rest.api.model.TransferChild) Transfer(org.alfresco.rm.rest.api.model.Transfer) UserInfo(org.alfresco.rest.api.model.UserInfo) WebApiDescription(org.alfresco.rest.framework.WebApiDescription)

Example 2 with TransferChild

use of org.alfresco.rm.rest.api.model.TransferChild in project records-management by Alfresco.

the class ApiNodesModelFactory method createTransferChild.

/**
 * Creates an object of type TransferChild
 *
 * @param info
 * @param propertyFilter
 * @param includeParam
 * @param mapUserInfo
 * @param isMinimalInfo
 * @return UnfiledContainer object
 */
public TransferChild createTransferChild(FileInfo info, Parameters parameters, Map<String, UserInfo> mapUserInfo, boolean isMinimalInfo) {
    TransferChild transferChild = new TransferChild();
    mapBasicInfo(transferChild, info, parameters.getFilter(), mapUserInfo, isMinimalInfo);
    mapOptionalInfo(transferChild, info, parameters.getInclude(), isMinimalInfo);
    mapTransferChildInfo(transferChild, info, parameters.getInclude(), isMinimalInfo);
    return transferChild;
}
Also used : TransferChild(org.alfresco.rm.rest.api.model.TransferChild)

Aggregations

TransferChild (org.alfresco.rm.rest.api.model.TransferChild)2 AbstractList (java.util.AbstractList)1 HashMap (java.util.HashMap)1 UserInfo (org.alfresco.rest.api.model.UserInfo)1 WebApiDescription (org.alfresco.rest.framework.WebApiDescription)1 Transfer (org.alfresco.rm.rest.api.model.Transfer)1 FileInfo (org.alfresco.service.cmr.model.FileInfo)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1