@Override public boolean match(PrismContainerValue value, MatchingRuleRegistry matchingRuleRegistry) throws SchemaException { return !getFilter().match(value, matchingRuleRegistry); }
@Override public boolean match(PrismContainerValue value, MatchingRuleRegistry matchingRuleRegistry) throws SchemaException { for (ObjectFilter filter : getConditions()){ if (filter.match(value, matchingRuleRegistry)){ return true; } } return false; }
@Override public boolean match(PrismContainerValue value, MatchingRuleRegistry matchingRuleRegistry) throws SchemaException { for (ObjectFilter filter : getConditions()){ if (!filter.match(value, matchingRuleRegistry)) { return false; } } return true; }
static <T extends Objectable> boolean match( PrismObject<T> object, ObjectFilter filter, MatchingRuleRegistry matchingRuleRegistry) throws SchemaException { return filter.match(object.getValue(), matchingRuleRegistry); }
static boolean match(Containerable object, ObjectFilter filter, MatchingRuleRegistry matchingRuleRegistry) throws SchemaException{ return filter.match(object.asPrismContainerValue(), matchingRuleRegistry); }
private <T> List<T> doFiltering(ObjectQuery query, List<T> allObjects, Function<T, PrismContainerValue> pcvExtractor) throws SchemaException { ObjectFilter filter = query.getFilter(); if (filter == null) { return allObjects; } List<T> filtered = new ArrayList<>(); for (T object : allObjects) { if (filter.match(pcvExtractor.apply(object), matchingRuleRegistry)) { filtered.add(object); } } return filtered; }
@Override public boolean match(PrismContainerValue value, MatchingRuleRegistry matchingRuleRegistry) throws SchemaException { Item itemToFind = value.findItem(fullPath); if (itemToFind == null || itemToFind.getValues().isEmpty()) { return false; } if (!(itemToFind instanceof PrismContainer)) { throw new SchemaException("Couldn't use exists query to search for items other than containers: " + itemToFind); } if (filter == null) { return true; } for (PrismContainerValue<?> pcv : ((PrismContainer<?>) itemToFind).getValues()) { if (filter.match(pcv, matchingRuleRegistry)) { return true; } } return false; }
private <R extends AbstractRoleType> boolean matchVirtualAssignment(Collection<R> forcedRoles, AssignmentPathSegmentImpl segment, EvaluationContext ctx) { for (R forcedRole : forcedRoles) { ObjectFilter filterTargetRef = prismContext.queryFor(AssignmentType.class) .item(AssignmentType.F_TARGET_REF).ref(forcedRole.getOid()).buildFilter(); AssignmentType assignmentType = getAssignmentType(segment, ctx); try { if (filterTargetRef.match(assignmentType.asPrismContainerValue(), null)) { return true; } } catch (SchemaException e) { LoggingUtils.logUnexpectedException(LOGGER, "Cannot evaluate filter {} for assignment {}", e, filterTargetRef, assignmentType); } } return false; }
if (!filter.match(object.getValue(), matchingRuleRegistry)) { return null;
static boolean oidMatches(ObjectReferenceType targetRef, EvaluatedAssignmentTargetImpl assignmentTarget, PrismContext prismContext, MatchingRuleRegistry matchingRuleRegistry, String context) throws SchemaException { if (targetRef == null) { return true; // this means we rely on comparing relations } if (assignmentTarget.getOid() == null) { return false; // shouldn't occur } if (targetRef.getOid() != null) { return assignmentTarget.getOid().equals(targetRef.getOid()); } if (targetRef.getResolutionTime() == EvaluationTimeType.RUN) { SearchFilterType filterType = targetRef.getFilter(); if (filterType == null) { throw new SchemaException("No filter in " + context); } QName typeQName = targetRef.getType(); @SuppressWarnings("rawtypes") PrismObjectDefinition objDef = prismContext.getSchemaRegistry().findObjectDefinitionByType(typeQName); ObjectFilter filter = prismContext.getQueryConverter().parseFilter(filterType, objDef); PrismObject<? extends AssignmentHolderType> target = assignmentTarget.getTarget(); return filter.match(target.getValue(), matchingRuleRegistry); } else { throw new SchemaException("No OID in " + context); } }
@Override public boolean match(PrismContainerValue value, MatchingRuleRegistry matchingRuleRegistry) throws SchemaException { if (value == null) { return false; // just for safety } ComplexTypeDefinition definition = value.getComplexTypeDefinition(); if (definition == null) { if (!(value.getParent() instanceof PrismContainer)) { LOGGER.trace("Parent of {} is not a PrismContainer, returning false; it is {}", value, value.getParent()); return false; } PrismContainer container = (PrismContainer) value.getParent(); PrismContainerDefinition pcd = container.getDefinition(); if (pcd == null) { LOGGER.trace("Parent of {} has no definition, returning false", value); return false; } definition = pcd.getComplexTypeDefinition(); } // TODO TODO TODO subtypes!!!!!!!! if (!QNameUtil.match(definition.getTypeName(), type)) { return false; } if (filter == null) { return true; } else { return filter.match(value, matchingRuleRegistry); } }