use of com.evolveum.midpoint.repo.api.RepositoryService in project midpoint by Evolveum.
the class Utils method resolveReferences.
/**
* Resolves references contained in given PrismObject.
*
* @param object
* @param repository
* @param enforceReferentialIntegrity If true, missing reference causes fatal error when processing (if false, only warning is issued).
* @param forceFilterReevaluation If true, references are reevaluated even if OID is present. (Given that filter is present as well, of course.)
* @param prismContext
* @param result
*/
public static <T extends ObjectType> void resolveReferences(PrismObject<T> object, RepositoryService repository, boolean enforceReferentialIntegrity, boolean forceFilterReevaluation, EvaluationTimeType resolutionTime, boolean throwExceptionOnFailure, PrismContext prismContext, OperationResult result) {
Visitor visitor = visitable -> {
if (!(visitable instanceof PrismReferenceValue)) {
return;
}
resolveRef((PrismReferenceValue) visitable, repository, enforceReferentialIntegrity, forceFilterReevaluation, resolutionTime, prismContext, object.toString(), throwExceptionOnFailure, result);
};
object.accept(visitor);
}
use of com.evolveum.midpoint.repo.api.RepositoryService in project midpoint by Evolveum.
the class MidpointUtil method recordEventInTask.
// additional delta is a bit hack ... TODO refactor (but without splitting the modify operation!)
public static void recordEventInTask(CaseEventType event, ObjectDeltaType additionalDelta, String taskOid, OperationResult result) {
RepositoryService cacheRepositoryService = getCacheRepositoryService();
PrismContext prismContext = getPrismContext();
try {
S_ItemEntry deltaBuilder = DeltaBuilder.deltaFor(TaskType.class, getPrismContext()).item(F_WORKFLOW_CONTEXT, F_EVENT).add(event);
if (additionalDelta != null) {
PrismObject<TaskType> task = cacheRepositoryService.getObject(TaskType.class, taskOid, null, result);
WfPrimaryChangeProcessorStateType state = WfContextUtil.getPrimaryChangeProcessorState(task.asObjectable().getWorkflowContext());
ObjectTreeDeltasType updatedDelta = ObjectTreeDeltas.mergeDeltas(state.getDeltasToProcess(), additionalDelta, prismContext);
// assuming it already exists!
ItemPath deltasToProcessPath = new ItemPath(F_WORKFLOW_CONTEXT, F_PROCESSOR_SPECIFIC_STATE, WfPrimaryChangeProcessorStateType.F_DELTAS_TO_PROCESS);
ItemDefinition<?> deltasToProcessDefinition = getPrismContext().getSchemaRegistry().findContainerDefinitionByCompileTimeClass(WfPrimaryChangeProcessorStateType.class).findItemDefinition(WfPrimaryChangeProcessorStateType.F_DELTAS_TO_PROCESS);
deltaBuilder = deltaBuilder.item(deltasToProcessPath, deltasToProcessDefinition).replace(updatedDelta);
}
cacheRepositoryService.modifyObject(TaskType.class, taskOid, deltaBuilder.asItemDeltas(), result);
} catch (ObjectNotFoundException | SchemaException | ObjectAlreadyExistsException e) {
throw new SystemException("Couldn't record decision to the task " + taskOid + ": " + e.getMessage(), e);
}
}
Aggregations