use of org.alfresco.rm.rest.api.model.Transfer 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);
}
use of org.alfresco.rm.rest.api.model.Transfer in project records-management by Alfresco.
the class ApiNodesModelFactory method createTransfer.
/**
* Creates an object of type Transfer
*
* @param info
* @param propertyFilter
* @param includeParam
* @param mapUserInfo
* @param isMinimalInfo
* @return UnfiledContainer object
*/
public Transfer createTransfer(FileInfo info, Parameters parameters, Map<String, UserInfo> mapUserInfo, boolean isMinimalInfo) {
Transfer transfer = new Transfer();
mapTransferInfo(transfer, info, mapUserInfo, parameters.getFilter(), parameters.getInclude(), isMinimalInfo);
return transfer;
}
use of org.alfresco.rm.rest.api.model.Transfer 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);
}
Aggregations