use of com.evolveum.midpoint.schema.RelationRegistry in project midpoint by Evolveum.
the class AccCertReviewersHelper method getMembers.
private List<ObjectReferenceType> getMembers(ObjectReferenceType abstractRoleRef, OperationResult result) throws SchemaException {
Collection<PrismReferenceValue> references = ObjectQueryUtil.createReferences(abstractRoleRef.getOid(), RelationKindType.MEMBER, relationRegistry);
ObjectQuery query = references.isEmpty() ? prismContext.queryFor(UserType.class).none().build() : prismContext.queryFor(UserType.class).item(UserType.F_ROLE_MEMBERSHIP_REF).ref(references).build();
return repositoryService.searchObjects(UserType.class, query, null, result).stream().map(obj -> ObjectTypeUtil.createObjectRef(obj, prismContext)).collect(Collectors.toList());
}
use of com.evolveum.midpoint.schema.RelationRegistry in project midpoint by Evolveum.
the class AbstractWfTest method checkVisibleWorkItem.
protected void checkVisibleWorkItem(ExpectedWorkItem expectedWorkItem, int count, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException, CommunicationException {
S_AtomicFilterExit q = QueryUtils.filterForAssignees(prismContext.queryFor(CaseWorkItemType.class), SecurityUtil.getPrincipal(), OtherPrivilegesLimitationType.F_APPROVAL_WORK_ITEMS, relationRegistry);
q = q.and().item(CaseWorkItemType.F_CLOSE_TIMESTAMP).isNull();
List<CaseWorkItemType> currentWorkItems = modelService.searchContainers(CaseWorkItemType.class, q.build(), null, task, result);
long found = currentWorkItems.stream().filter(wi -> expectedWorkItem == null || expectedWorkItem.matches(wi)).count();
assertEquals("Wrong # of matching work items", count, found);
}
use of com.evolveum.midpoint.schema.RelationRegistry in project midpoint by Evolveum.
the class ObjectDeltaUpdater method handleObjectTextInfoChanges.
private void handleObjectTextInfoChanges(Class<? extends ObjectType> type, Collection<? extends ItemDelta<?, ?>> modifications, PrismObject<?> prismObject, RObject object) {
FullTextSearchConfigurationType config = repositoryService.getFullTextSearchConfiguration();
if (!FullTextSearchUtil.isObjectTextInfoRecomputationNeeded(config, type, modifications)) {
return;
}
Set<RObjectTextInfo> newInfos = RObjectTextInfo.createItemsSet((ObjectType) prismObject.asObjectable(), object, new RepositoryContext(repositoryService, prismContext, relationRegistry, extItemDictionary, repositoryConfiguration));
if (newInfos == null || newInfos.isEmpty()) {
object.getTextInfoItems().clear();
} else {
Set<String> existingTexts = object.getTextInfoItems().stream().map(info -> info.getText()).collect(Collectors.toSet());
Set<String> newTexts = newInfos.stream().map(info -> info.getText()).collect(Collectors.toSet());
object.getTextInfoItems().removeIf(existingInfo -> !newTexts.contains(existingInfo.getText()));
for (RObjectTextInfo newInfo : newInfos) {
if (!existingTexts.contains(newInfo.getText())) {
object.getTextInfoItems().add(newInfo);
}
}
}
}
Aggregations