use of com.evolveum.midpoint.repo.sqale.qmodel.object.MObjectType in project midpoint by Evolveum.
the class ExtensionItemFilterProcessor method processSingleReferenceValue.
private Predicate processSingleReferenceValue(MExtItem extItem, RefFilter filter, PrismReferenceValue ref) {
// So if we ask for OID IS NULL or for target type IS NULL we actually ask "item IS NULL".
if (ref.getOid() == null && !filter.isOidNullAsAny() || ref.getTargetType() == null && !filter.isTargetTypeNullAsAny()) {
return extItemIsNull(extItem);
}
Map<String, Object> json = new HashMap<>();
if (ref.getOid() != null) {
json.put("o", ref.getOid());
}
if (ref.getTargetType() != null) {
MObjectType objectType = MObjectType.fromTypeQName(ref.getTargetType());
json.put("t", objectType);
}
if (ref.getRelation() == null || !ref.getRelation().equals(PrismConstants.Q_ANY)) {
Integer relationId = ((SqaleQueryContext<?, ?, ?>) context).searchCachedRelationId(ref.getRelation());
json.put("r", relationId);
}
return predicateWithNotTreated(path, booleanTemplate("{0} @> {1}", path, jsonbValue(extItem, json)));
}
use of com.evolveum.midpoint.repo.sqale.qmodel.object.MObjectType in project midpoint by Evolveum.
the class RefItemFilterProcessor method processSingleValue.
private Predicate processSingleValue(RefFilter filter, PrismReferenceValue ref) {
Predicate predicate = null;
if (ref.getOid() != null) {
predicate = predicateWithNotTreated(oidPath, oidPath.eq(UUID.fromString(ref.getOid())));
} else if (!filter.isOidNullAsAny()) {
predicate = oidPath.isNull();
}
// Audit sometimes does not use target type path
if (typePath != null) {
if (ref.getTargetType() != null) {
MObjectType objectType = MObjectType.fromTypeQName(ref.getTargetType());
predicate = ExpressionUtils.and(predicate, predicateWithNotTreated(typePath, typePath.eq(objectType)));
} else if (!filter.isTargetTypeNullAsAny()) {
predicate = ExpressionUtils.and(predicate, typePath.isNull());
}
}
// Audit tables do not use relation paths
if (relationIdPath != null) {
if (ref.getRelation() == null || !ref.getRelation().equals(PrismConstants.Q_ANY)) {
Integer relationId = ((SqaleQueryContext<?, ?, ?>) context).searchCachedRelationId(ref.getRelation());
predicate = ExpressionUtils.and(predicate, predicateWithNotTreated(relationIdPath, relationIdPath.eq(relationId)));
}
// else relation == Q_ANY, no additional predicate needed
}
if (targetNamePath != null && ref.getTargetName() != null) {
predicate = ExpressionUtils.and(predicate, predicateWithNotTreated(targetNamePath, targetNamePath.eq(ref.getTargetName().getOrig())));
}
return predicate;
}
Aggregations