Search in sources :

Example 1 with TransferContainer

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

the class ApiNodesModelFactory method createTransferContainer.

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

Example 2 with TransferContainer

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

the class TransferContainerChildrenRelation method readAll.

@Override
@WebApiDescription(title = "Return a paged list of transfers for the transfer container identified by 'transferContainerId'")
public CollectionWithPagingInfo<Transfer> readAll(String transferContainerId, Parameters parameters) {
    checkNotBlank("transferContainerId", transferContainerId);
    mandatory("parameters", parameters);
    NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(transferContainerId, RecordsManagementModel.TYPE_TRANSFER_CONTAINER);
    // list transfers
    Set<QName> searchTypeQNames = searchTypesFactory.buildSearchTypesForTransferContainersEndpoint();
    final PagingResults<FileInfo> pagingResults = fileFolderService.list(parentNodeRef, null, searchTypeQNames, null, apiUtils.getSortProperties(parameters), null, Util.getPagingRequest(parameters.getPaging()));
    final List<FileInfo> page = pagingResults.getPage();
    Map<String, UserInfo> mapUserInfo = new HashMap<>();
    List<Transfer> nodes = new AbstractList<Transfer>() {

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

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

Aggregations

TransferContainer (org.alfresco.rm.rest.api.model.TransferContainer)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 QName (org.alfresco.service.namespace.QName)1