Search in sources :

Example 11 with FilterProp

use of org.alfresco.repo.node.getchildren.FilterProp in project alfresco-remote-api by Alfresco.

the class SiteAdminSitesGet method getFilterProperties.

private List<FilterProp> getFilterProperties(String filter) {
    if (filter == null || filter.isEmpty() || filter.equals("*")) {
        return null;
    }
    List<FilterProp> filterProps = new ArrayList<FilterProp>();
    filterProps.add(new FilterPropString(ContentModel.PROP_NAME, filter, FilterTypeString.STARTSWITH_IGNORECASE));
    filterProps.add(new FilterPropString(ContentModel.PROP_TITLE, filter, FilterTypeString.STARTSWITH_IGNORECASE));
    return filterProps;
}
Also used : FilterProp(org.alfresco.repo.node.getchildren.FilterProp) ArrayList(java.util.ArrayList) FilterPropString(org.alfresco.repo.node.getchildren.FilterPropString)

Example 12 with FilterProp

use of org.alfresco.repo.node.getchildren.FilterProp in project records-management by Alfresco.

the class FilePlanChildrenRelation method readAll.

@Override
@WebApiDescription(title = "Return a paged list of file plan children (record categories) for the container identified by 'filePlanId'")
public CollectionWithPagingInfo<RecordCategory> readAll(String filePlanId, Parameters parameters) {
    // validate parameters
    checkNotBlank("filePlanId", filePlanId);
    mandatory("parameters", parameters);
    QName filePlanType = apiUtils.getFilePlanType();
    if (// rm site not created
    filePlanType == null) {
        throw new EntityNotFoundException(filePlanId);
    }
    NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(filePlanId, filePlanType);
    // list record categories
    Set<QName> searchTypeQNames = searchTypesFactory.buildSearchTypesForFilePlanEndpoint();
    // FIXME this param null
    List<FilterProp> filterProps = apiUtils.getListChildrenFilterProps(parameters, null);
    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<RecordCategory> nodes = new AbstractList<RecordCategory>() {

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

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

Aggregations

FilterProp (org.alfresco.repo.node.getchildren.FilterProp)12 QName (org.alfresco.service.namespace.QName)6 AbstractList (java.util.AbstractList)5 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 FilterPropString (org.alfresco.repo.node.getchildren.FilterPropString)5 FilterPropBoolean (org.alfresco.repo.node.getchildren.FilterPropBoolean)4 UserInfo (org.alfresco.rest.api.model.UserInfo)4 Query (org.alfresco.rest.framework.resource.parameters.where.Query)4 FileInfo (org.alfresco.service.cmr.model.FileInfo)4 NodeRef (org.alfresco.service.cmr.repository.NodeRef)4 Pair (org.alfresco.util.Pair)4 PagingRequest (org.alfresco.query.PagingRequest)3 GetChildrenCannedQuery (org.alfresco.repo.node.getchildren.GetChildrenCannedQuery)3 WebApiDescription (org.alfresco.rest.framework.WebApiDescription)3 Paging (org.alfresco.rest.framework.resource.parameters.Paging)3 MapBasedQueryWalker (org.alfresco.rest.workflow.api.impl.MapBasedQueryWalker)3 SiteInfo (org.alfresco.service.cmr.site.SiteInfo)3 InvalidArgumentException (org.alfresco.rest.framework.core.exceptions.InvalidArgumentException)2 SortColumn (org.alfresco.rest.framework.resource.parameters.SortColumn)2