Search in sources :

Example 1 with UnfiledContainer

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

the class UnfiledContainerChildrenRelation method readAll.

@Override
@WebApiDescription(title = "Return a paged list of unfiled container children for the container identified by 'unfiledContainerId'")
public CollectionWithPagingInfo<UnfiledContainerChild> readAll(String unfiledContainerId, Parameters parameters) {
    // validate parameters
    checkNotBlank("unfiledContainerId", unfiledContainerId);
    mandatory("parameters", parameters);
    NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfiledContainerId, RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER);
    // list unfiled record folders and records
    Set<QName> searchTypeQNames = searchTypesFactory.buildSearchTypesForUnfiledEndpoint(parameters, LIST_UNFILED_CONTAINER_CHILDREN_EQUALS_QUERY_PROPERTIES);
    List<FilterProp> filterProps = apiUtils.getListChildrenFilterProps(parameters, LIST_UNFILED_CONTAINER_CHILDREN_EQUALS_QUERY_PROPERTIES);
    final PagingResults<FileInfo> pagingResults = fileFolderService.list(parentNodeRef, null, searchTypeQNames, null, apiUtils.getSortProperties(parameters), filterProps, Util.getPagingRequest(parameters.getPaging()));
    final List<FileInfo> page = pagingResults.getPage();
    Map<String, UserInfo> mapUserInfo = new HashMap<>();
    List<UnfiledContainerChild> nodes = new AbstractList<UnfiledContainerChild>() {

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

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

Example 2 with UnfiledContainer

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

the class ApiNodesModelFactory method createUnfiledContainer.

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

Aggregations

UnfiledContainer (org.alfresco.rm.rest.api.model.UnfiledContainer)2 AbstractList (java.util.AbstractList)1 HashMap (java.util.HashMap)1 FilterProp (org.alfresco.repo.node.getchildren.FilterProp)1 UserInfo (org.alfresco.rest.api.model.UserInfo)1 WebApiDescription (org.alfresco.rest.framework.WebApiDescription)1 UnfiledContainerChild (org.alfresco.rm.rest.api.model.UnfiledContainerChild)1 FileInfo (org.alfresco.service.cmr.model.FileInfo)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 QName (org.alfresco.service.namespace.QName)1