Search in sources :

Example 31 with FieldSearchFilter

use of com.agiletec.aps.system.common.FieldSearchFilter in project entando-core by entando.

the class AuthorizationDAO method getUsersByAuthorities.

@Override
public List<String> getUsersByAuthorities(List<String> groupNames, List<String> roleNames) {
    FieldSearchFilter[] filters = {};
    if (CollectionUtils.isNotEmpty(groupNames)) {
        FieldSearchFilter filter = new FieldSearchFilter("groupname", groupNames, false);
        filters = super.addFilter(filters, filter);
    }
    if (CollectionUtils.isNotEmpty(roleNames)) {
        FieldSearchFilter filter = new FieldSearchFilter("rolename", roleNames, false);
        filters = super.addFilter(filters, filter);
    }
    return super.searchId(filters);
}
Also used : FieldSearchFilter(com.agiletec.aps.system.common.FieldSearchFilter)

Example 32 with FieldSearchFilter

use of com.agiletec.aps.system.common.FieldSearchFilter in project entando-core by entando.

the class PageModelManager method searchPageModels.

@Override
public SearcherDaoPaginatedResult<PageModel> searchPageModels(List<FieldSearchFilter> filtersList) throws ApsSystemException {
    SearcherDaoPaginatedResult<PageModel> pagedResult = null;
    try {
        FieldSearchFilter[] filters = null;
        if (null != filtersList) {
            filters = filtersList.toArray(new FieldSearchFilter[filtersList.size()]);
        }
        List<PageModel> pageModels = new ArrayList<>();
        int count = this.getPageModelDAO().count(filters);
        List<String> pageModelCodes = this.getPageModelDAO().search(filters);
        for (String code : pageModelCodes) {
            pageModels.add(this.getPageModel(code));
        }
        pagedResult = new SearcherDaoPaginatedResult<PageModel>(count, pageModels);
    } catch (Throwable t) {
        _logger.error("Error searching groups", t);
        throw new ApsSystemException("Error searching groups", t);
    }
    return pagedResult;
}
Also used : ArrayList(java.util.ArrayList) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) FieldSearchFilter(com.agiletec.aps.system.common.FieldSearchFilter)

Aggregations

FieldSearchFilter (com.agiletec.aps.system.common.FieldSearchFilter)32 ArrayList (java.util.ArrayList)15 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)13 RestListRequest (org.entando.entando.web.common.model.RestListRequest)10 SearcherDaoPaginatedResult (com.agiletec.aps.system.common.model.dao.SearcherDaoPaginatedResult)5 List (java.util.List)5 RestRourceNotFoundException (org.entando.entando.aps.system.exception.RestRourceNotFoundException)5 RestServerError (org.entando.entando.aps.system.exception.RestServerError)5 IDtoBuilder (org.entando.entando.aps.system.services.IDtoBuilder)5 PagedMetadata (org.entando.entando.web.common.model.PagedMetadata)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 BeanPropertyBindingResult (org.springframework.validation.BeanPropertyBindingResult)4 Map (java.util.Map)3 GuiFragment (org.entando.entando.aps.system.services.guifragment.GuiFragment)3 ValidationConflictException (org.entando.entando.web.common.exceptions.ValidationConflictException)3 Filter (org.entando.entando.web.common.model.Filter)3 Test (org.junit.Test)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 GroupUtilizer (com.agiletec.aps.system.services.group.GroupUtilizer)2