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();
}
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();
}
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();
}
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();
}
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;
}
Aggregations