Search in sources :

Example 11 with PolyStringNormalizer

use of com.evolveum.midpoint.prism.polystring.PolyStringNormalizer in project midpoint by Evolveum.

the class AbstractTreeTablePanel method createOrgChildQuery.

protected ObjectQuery createOrgChildQuery() {
    SelectableBeanImpl<OrgType> dto = selected.getObject();
    String oid = dto != null && dto.getValue() != null ? dto.getValue().getOid() : getModel().getObject();
    BasicSearchPanel<String> basicSearch = (BasicSearchPanel<String>) get(createComponentPath(ID_SEARCH_FORM, ID_BASIC_SEARCH));
    String object = basicSearch.getModelObject();
    DropDownChoice<String> searchScopeChoice = (DropDownChoice<String>) get(createComponentPath(ID_SEARCH_FORM, ID_SEARCH_SCOPE));
    String scope = searchScopeChoice.getModelObject();
    if (StringUtils.isBlank(object)) {
        object = null;
    }
    PageBase page = getPageBase();
    PrismContext context = page.getPrismContext();
    S_AtomicFilterExit q;
    if (object == null || SEARCH_SCOPE_ONE.equals(scope)) {
        q = context.queryFor(OrgType.class).isDirectChildOf(oid);
    } else {
        q = context.queryFor(OrgType.class).isChildOf(oid);
    }
    if (object == null) {
        return q.build();
    }
    PolyStringNormalizer normalizer = context.getDefaultPolyStringNormalizer();
    String normalizedString = normalizer.normalize(object);
    if (StringUtils.isEmpty(normalizedString)) {
        return q.build();
    }
    ObjectQuery query = q.and().block().item(OrgType.F_NAME).containsPoly(normalizedString).matchingNorm().or().item(OrgType.F_DISPLAY_NAME).containsPoly(normalizedString).matchingNorm().build();
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Searching child orgs of org {} with query:\n{}", oid, query.debugDump());
    }
    return query;
}
Also used : DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) BasicSearchPanel(com.evolveum.midpoint.web.component.BasicSearchPanel) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) PrismContext(com.evolveum.midpoint.prism.PrismContext) S_AtomicFilterExit(com.evolveum.midpoint.prism.query.builder.S_AtomicFilterExit) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) PolyStringNormalizer(com.evolveum.midpoint.prism.polystring.PolyStringNormalizer)

Aggregations

PolyStringNormalizer (com.evolveum.midpoint.prism.polystring.PolyStringNormalizer)11 S_AtomicFilterEntry (com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry)4 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)2 PrismContext (com.evolveum.midpoint.prism.PrismContext)2 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)2 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)2 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)2 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)1 AlphanumericPolyStringNormalizer (com.evolveum.midpoint.prism.impl.polystring.AlphanumericPolyStringNormalizer)1 Ascii7PolyStringNormalizer (com.evolveum.midpoint.prism.impl.polystring.Ascii7PolyStringNormalizer)1 PrismDefaultPolyStringNormalizer (com.evolveum.midpoint.prism.polystring.PrismDefaultPolyStringNormalizer)1 AndFilter (com.evolveum.midpoint.prism.query.AndFilter)1 ObjectFilter (com.evolveum.midpoint.prism.query.ObjectFilter)1 S_AtomicFilterExit (com.evolveum.midpoint.prism.query.builder.S_AtomicFilterExit)1 DisplayableValue (com.evolveum.midpoint.util.DisplayableValue)1 BasicSearchPanel (com.evolveum.midpoint.web.component.BasicSearchPanel)1 AccountDetailsSearchDto (com.evolveum.midpoint.web.page.admin.configuration.dto.AccountDetailsSearchDto)1 ObjectSearchDto (com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectSearchDto)1 ReportOutputSearchDto (com.evolveum.midpoint.web.page.admin.reports.dto.ReportOutputSearchDto)1 ReportSearchDto (com.evolveum.midpoint.web.page.admin.reports.dto.ReportSearchDto)1