Search in sources :

Example 1 with UnfiledRecordFolder

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

the class ApiNodesModelFactory method createUnfiledRecordFolder.

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

Example 2 with UnfiledRecordFolder

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

the class UnfiledRecordFolderChildrenRelation method readAll.

@Override
@WebApiDescription(title = "Return a paged list of unfiled container children for the container identified by 'unfiledContainerId'")
public CollectionWithPagingInfo<UnfiledRecordFolderChild> readAll(String unfileRecordFolderId, Parameters parameters) {
    checkNotBlank("unfileRecordFolderId", unfileRecordFolderId);
    mandatory("parameters", parameters);
    String relativePath = parameters.getParameter(Nodes.PARAM_RELATIVE_PATH);
    NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfileRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER, relativePath, true);
    // list unfiled record folders and records
    Set<QName> searchTypeQNames = searchTypesFactory.buildSearchTypesForUnfiledEndpoint(parameters, LIST_UNFILED_RECORD_FOLDER_CHILDREN_EQUALS_QUERY_PROPERTIES);
    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<UnfiledRecordFolderChild> nodes = new AbstractList<UnfiledRecordFolderChild>() {

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

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

Aggregations

UnfiledRecordFolder (org.alfresco.rm.rest.api.model.UnfiledRecordFolder)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 UnfiledRecordFolderChild (org.alfresco.rm.rest.api.model.UnfiledRecordFolderChild)1 FileInfo (org.alfresco.service.cmr.model.FileInfo)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 QName (org.alfresco.service.namespace.QName)1