use of com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry in project midpoint by Evolveum.
the class PageCreatedReports method appendTypeFilter.
private ObjectQuery appendTypeFilter() {
DropDownChoicePanel<String> typeSelect = (DropDownChoicePanel<String>) getMainForm().get(ID_REPORT_TYPE_SELECT);
String typeRef = typeSelect == null ? reportTypeMal.get(getReportType()) : typeSelect.getBaseFormComponent().getModelObject();
S_AtomicFilterEntry q = getPrismContext().queryFor(ReportDataType.class);
S_AtomicFilterExit refF;
if (StringUtils.isNotBlank(typeRef)) {
Entry<String, String> typeRefFilter = reportTypeMal.entrySet().stream().filter(e -> e.getValue().equals(typeRef)).findFirst().get();
if (typeRefFilter != null) {
refF = q.item(ReportDataType.F_REPORT_REF).ref(typeRefFilter.getKey());
return refF.build();
}
}
return null;
}
use of com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry in project midpoint by Evolveum.
the class PageReports method createQuery.
private ObjectQuery createQuery() {
ReportSearchDto dto = searchModel.getObject();
String text = dto.getText();
Boolean parent = !dto.isParent();
S_AtomicFilterEntry q = QueryBuilder.queryFor(ReportType.class, getPrismContext());
if (StringUtils.isNotEmpty(text)) {
PolyStringNormalizer normalizer = getPrismContext().getDefaultPolyStringNormalizer();
String normalizedText = normalizer.normalize(text);
q = q.item(ReportType.F_NAME).eqPoly(normalizedText).matchingNorm().and();
}
if (parent) {
q = q.item(ReportType.F_PARENT).eq(true).and();
}
return q.all().build();
}
use of com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry in project midpoint by Evolveum.
the class TaskManagerQuartzImpl method listWaitingTasks.
private List<Task> listWaitingTasks(TaskWaitingReason reason, OperationResult result) throws SchemaException {
S_AtomicFilterEntry q = QueryBuilder.queryFor(TaskType.class, prismContext);
q = q.item(TaskType.F_EXECUTION_STATUS).eq(TaskExecutionStatusType.WAITING).and();
if (reason != null) {
q = q.item(TaskType.F_WAITING_REASON).eq(reason.toTaskType()).and();
}
ObjectQuery query = q.all().build();
List<PrismObject<TaskType>> prisms = repositoryService.searchObjects(TaskType.class, query, null, result);
List<Task> tasks = resolveTasksFromTaskTypes(prisms, result);
result.recordSuccessIfUnknown();
return tasks;
}
use of com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry in project midpoint by Evolveum.
the class ShadowManager method createSearchShadowQuery.
private ObjectQuery createSearchShadowQuery(ProvisioningContext ctx, Collection<ResourceAttribute<?>> identifiers, boolean primaryIdentifiersOnly, PrismContext prismContext, OperationResult parentResult) throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, ExpressionEvaluationException {
S_AtomicFilterEntry q = QueryBuilder.queryFor(ShadowType.class, prismContext);
RefinedObjectClassDefinition objectClassDefinition = ctx.getObjectClassDefinition();
for (PrismProperty<?> identifier : identifiers) {
RefinedAttributeDefinition rAttrDef;
PrismPropertyValue<?> identifierValue = identifier.getValue();
if (objectClassDefinition == null) {
// If there is no specific object class definition then the identifier definition
// must be the same in all object classes and that means that we can use
// definition from any of them.
RefinedObjectClassDefinition anyDefinition = ctx.getRefinedSchema().getRefinedDefinitions().iterator().next();
rAttrDef = anyDefinition.findAttributeDefinition(identifier.getElementName());
if (primaryIdentifiersOnly && !anyDefinition.isPrimaryIdentifier(identifier.getElementName())) {
continue;
}
} else {
if (primaryIdentifiersOnly && !objectClassDefinition.isPrimaryIdentifier(identifier.getElementName())) {
continue;
}
rAttrDef = objectClassDefinition.findAttributeDefinition(identifier.getElementName());
}
String normalizedIdentifierValue = (String) getNormalizedAttributeValue(identifierValue, rAttrDef);
PrismPropertyDefinition<String> def = (PrismPropertyDefinition<String>) identifier.getDefinition();
q = q.itemWithDef(def, ShadowType.F_ATTRIBUTES, def.getName()).eq(normalizedIdentifierValue).and();
}
if (identifiers.size() < 1) {
throw new SchemaException("Identifier not specified. Cannot create search query by identifier.");
}
if (objectClassDefinition != null) {
q = q.item(ShadowType.F_OBJECT_CLASS).eq(objectClassDefinition.getTypeName()).and();
}
return q.item(ShadowType.F_RESOURCE_REF).ref(ctx.getResourceOid()).build();
}
use of com.evolveum.midpoint.prism.query.builder.S_AtomicFilterEntry in project midpoint by Evolveum.
the class PageAccounts method createObjectQuery.
private ObjectQuery createObjectQuery() {
AccountDetailsSearchDto dto = searchModel.getObject();
String searchText = dto.getText();
ShadowKindType kind = dto.getKind();
String intent = dto.getIntent();
String objectClass = dto.getObjectClass();
FailedOperationTypeType failedOperatonType = dto.getFailedOperationType();
S_AtomicFilterEntry q = QueryBuilder.queryFor(ShadowType.class, getPrismContext());
if (StringUtils.isNotEmpty(searchText)) {
PolyStringNormalizer normalizer = getPrismContext().getDefaultPolyStringNormalizer();
String normalized = normalizer.normalize(searchText);
q = q.item(ShadowType.F_NAME).contains(normalized).matchingNorm().and();
}
if (kind != null) {
q = q.item(ShadowType.F_KIND).eq(kind).and();
}
if (StringUtils.isNotEmpty(intent)) {
q = q.item(ShadowType.F_INTENT).eq(intent).and();
}
if (failedOperatonType != null) {
q = q.item(ShadowType.F_FAILED_OPERATION_TYPE).eq(failedOperatonType).and();
}
if (StringUtils.isNotEmpty(objectClass)) {
QName objClass = new QName(objectClass);
for (QName qn : dto.getObjectClassList()) {
if (objectClass.equals(qn.getLocalPart())) {
objClass = qn;
}
}
q = q.item(ShadowType.F_OBJECT_CLASS).eq(objClass).and();
}
return appendResourceQueryFilter(q);
}
Aggregations