Search in sources :

Example 1 with S_AtomicFilterEntry

use of com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry in project midpoint by Evolveum.

the class PageCreatedReports method createQuery.

private ObjectQuery createQuery() {
    ReportOutputSearchDto dto = searchModel.getObject();
    S_AtomicFilterEntry q = QueryBuilder.queryFor(ReportOutputType.class, getPrismContext());
    if (StringUtils.isNotEmpty(dto.getText())) {
        PolyStringNormalizer normalizer = getPrismContext().getDefaultPolyStringNormalizer();
        String normalizedString = normalizer.normalize(dto.getText());
        q = q.item(ReportOutputType.F_NAME).containsPoly(normalizedString).matchingNorm().and();
    }
    String oid = dto.getReportTypeMap().get(dto.getReportType());
    if (StringUtils.isNotEmpty(oid)) {
        q = q.item(ReportOutputType.F_REPORT_REF).ref(oid).and();
    }
    return q.all().build();
}
Also used : ReportOutputSearchDto(com.evolveum.midpoint.web.page.admin.reports.dto.ReportOutputSearchDto) S_AtomicFilterEntry(com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry) PolyStringNormalizer(com.evolveum.midpoint.prism.polystring.PolyStringNormalizer)

Example 2 with S_AtomicFilterEntry

use of com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry in project midpoint by Evolveum.

the class PageTasks method createTaskQuery.

private ObjectQuery createTaskQuery() {
    TasksSearchDto dto = searchModel.getObject();
    TaskDtoExecutionStatusFilter status = dto.getStatus();
    String category = dto.getCategory();
    boolean showSubtasks = dto.isShowSubtasks();
    S_AtomicFilterEntry q = QueryBuilder.queryFor(TaskType.class, getPrismContext());
    if (status != null) {
        q = status.appendFilter(q);
    }
    if (category != null && !ALL_CATEGORIES.equals(category)) {
        q = q.item(TaskType.F_CATEGORY).eq(category).and();
    }
    if (StringUtils.isNotBlank(searchText)) {
        PolyStringNormalizer normalizer = getPrismContext().getDefaultPolyStringNormalizer();
        String normalizedString = normalizer.normalize(searchText);
        q = q.item(TaskType.F_NAME).containsPoly(normalizedString, normalizedString).matchingNorm().and();
        // ???
        searchText = "";
    }
    if (!Boolean.TRUE.equals(showSubtasks)) {
        q = q.item(TaskType.F_PARENT).isNull().and();
    }
    return q.all().build();
}
Also used : S_AtomicFilterEntry(com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry) PolyStringNormalizer(com.evolveum.midpoint.prism.polystring.PolyStringNormalizer)

Example 3 with S_AtomicFilterEntry

use of com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry in project midpoint by Evolveum.

the class ObjectAlreadyExistHandler method createQueryByIcfName.

private ObjectQuery createQueryByIcfName(ShadowType shadow) throws SchemaException {
    // TODO: error handling TODO TODO TODO set matching rule instead of null in equlas filter
    Collection<ResourceAttribute<?>> secondaryIdentifiers = ShadowUtil.getSecondaryIdentifiers(shadow);
    S_AtomicFilterEntry q = QueryBuilder.queryFor(ShadowType.class, prismContext);
    // secondary identifiers connected by 'or' clause
    q = q.block();
    for (ResourceAttribute<?> secondaryIdentifier : secondaryIdentifiers) {
        q = q.itemAs(secondaryIdentifier).or();
    }
    q = q.none().endBlock().and();
    // resource + object class
    q = q.item(ShadowType.F_RESOURCE_REF).ref(shadow.getResourceRef().getOid()).and();
    return q.item(ShadowType.F_OBJECT_CLASS).eq(shadow.getObjectClass()).build();
}
Also used : S_AtomicFilterEntry(com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry) ResourceAttribute(com.evolveum.midpoint.schema.processor.ResourceAttribute)

Example 4 with S_AtomicFilterEntry

use of com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry in project midpoint by Evolveum.

the class PageCertCampaigns method createCampaignsQuery.

private ObjectQuery createCampaignsQuery() {
    S_AtomicFilterEntry q = getPrismContext().queryFor(AccessCertificationCampaignType.class);
    if (definitionOid != null) {
        q = q.item(AccessCertificationCampaignType.F_DEFINITION_REF).ref(definitionOid).and();
    }
    CertCampaignsSearchDto dto = searchModel.getObject();
    q = dto.getStateFilter().appendFilter(q);
    return q.all().build();
}
Also used : S_AtomicFilterEntry(com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry) CertCampaignsSearchDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCampaignsSearchDto)

Example 5 with S_AtomicFilterEntry

use of com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry in project midpoint by Evolveum.

the class TaskRetriever method listWaitingTasks.

@SuppressWarnings("SameParameterValue")
public List<? extends Task> listWaitingTasks(TaskWaitingReasonType reason, OperationResult result) throws SchemaException {
    S_AtomicFilterEntry q = prismContext.queryFor(TaskType.class);
    q = q.item(TaskType.F_EXECUTION_STATE).eq(TaskExecutionStateType.WAITING).and();
    if (reason != null) {
        q = q.item(TaskType.F_WAITING_REASON).eq(reason).and();
    }
    ObjectQuery query = q.all().build();
    List<PrismObject<TaskType>> prisms = repositoryService.searchObjects(TaskType.class, query, null, result);
    List<? extends Task> tasks = resolveTasksFromTaskTypes(prisms, result);
    result.recordSuccessIfUnknown();
    return tasks;
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) S_AtomicFilterEntry(com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery)

Aggregations

S_AtomicFilterEntry (com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry)12 PolyStringNormalizer (com.evolveum.midpoint.prism.polystring.PolyStringNormalizer)4 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)2 ResourceAttribute (com.evolveum.midpoint.schema.processor.ResourceAttribute)2 RefinedAttributeDefinition (com.evolveum.midpoint.common.refinery.RefinedAttributeDefinition)1 RefinedObjectClassDefinition (com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition)1 PrismPropertyDefinition (com.evolveum.midpoint.prism.PrismPropertyDefinition)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 S_AtomicFilterExit (com.evolveum.midpoint.prism.query.builder.S_AtomicFilterExit)1 ResourceObjectDefinition (com.evolveum.midpoint.schema.processor.ResourceObjectDefinition)1 ResourceObjectTypeDefinition (com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 DropDownChoicePanel (com.evolveum.midpoint.web.component.input.DropDownChoicePanel)1 CertCampaignsSearchDto (com.evolveum.midpoint.web.page.admin.certification.dto.CertCampaignsSearchDto)1 AccountDetailsSearchDto (com.evolveum.midpoint.web.page.admin.configuration.dto.AccountDetailsSearchDto)1 ReportOutputSearchDto (com.evolveum.midpoint.web.page.admin.reports.dto.ReportOutputSearchDto)1 ReportSearchDto (com.evolveum.midpoint.web.page.admin.reports.dto.ReportSearchDto)1 FailedOperationTypeType (com.evolveum.midpoint.xml.ns._public.common.common_3.FailedOperationTypeType)1 ShadowKindType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType)1