use of com.evolveum.midpoint.model.api.ModelExecuteOptions in project midpoint by Evolveum.
the class SynchronizationServiceImpl method createOptions.
@NotNull
private <F extends FocusType> ModelExecuteOptions createOptions(SynchronizationContext<F> syncCtx, ResourceObjectShadowChangeDescription change) {
ModelExecuteOptionsType explicitOptions = syncCtx.getExecuteOptions();
ModelExecuteOptions options = explicitOptions != null ? ModelExecuteOptions.fromModelExecutionOptionsType(explicitOptions) : ModelExecuteOptions.create(prismContext);
if (options.getReconcile() == null) {
Boolean doReconciliation = syncCtx.isDoReconciliation();
if (doReconciliation != null) {
options.reconcile(doReconciliation);
} else {
// There is no other good way how to reflect the changes from the shadow.
if (change.getObjectDelta() == null) {
options.reconcile();
}
}
}
if (options.getLimitPropagation() == null) {
options.limitPropagation(syncCtx.isLimitPropagation());
}
return options;
}
use of com.evolveum.midpoint.model.api.ModelExecuteOptions in project midpoint by Evolveum.
the class RecomputeExecutor method execute.
@Override
public PipelineData execute(ActionExpressionType action, PipelineData input, ExecutionContext context, OperationResult globalResult) throws ScriptExecutionException, SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
boolean dryRun = operationsHelper.getDryRun(action, input, context, globalResult);
ModelExecuteOptions options = operationsHelper.getOptions(action, input, context, globalResult);
options.reconcile(true);
TriggerCreationType triggerCreation = action instanceof RecomputeActionExpressionType ? ((RecomputeActionExpressionType) action).getTriggered() : null;
iterateOverObjects(input, context, globalResult, (object, item, result) -> recompute(object, dryRun, options, triggerCreation, context, result), (object, exception) -> context.println("Failed to recompute " + object + drySuffix(dryRun) + exceptionSuffix(exception)));
return input;
}
use of com.evolveum.midpoint.model.api.ModelExecuteOptions in project midpoint by Evolveum.
the class ModifyExecutor method execute.
@Override
public PipelineData execute(ActionExpressionType action, PipelineData input, ExecutionContext context, OperationResult globalResult) throws ScriptExecutionException, SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
ModelExecuteOptions options = operationsHelper.getOptions(action, input, context, globalResult);
boolean dryRun = operationsHelper.getDryRun(action, input, context, globalResult);
ObjectDeltaType deltaBean = expressionHelper.getActionArgument(ObjectDeltaType.class, action, ModifyActionExpressionType.F_DELTA, PARAM_DELTA, input, context, null, PARAM_DELTA, globalResult);
if (deltaBean == null) {
Throwable ex = new SchemaException("Found no delta to be applied");
// TODO value for error reporting (3rd parameter)
processActionException(ex, NAME, null, context);
context.println("Found no delta to be applied");
return input;
}
iterateOverObjects(input, context, globalResult, (object, item, result) -> modify(object, dryRun, options, deltaBean, context, result), (object, exception) -> context.println("Failed to modify " + object + drySuffix(dryRun) + exceptionSuffix(exception)));
return input;
}
use of com.evolveum.midpoint.model.api.ModelExecuteOptions in project midpoint by Evolveum.
the class TestConnectorDummyFake method test450DowngradeRawReplace.
@Test
public void test450DowngradeRawReplace() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
PrismObject<ResourceType> dummyResourceModelBefore = modelService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, null, task, result);
ObjectDelta<ResourceType> resourceDelta = prismContext.deltaFactory().object().createEmptyModifyDelta(ResourceType.class, RESOURCE_DUMMY_FAKE_OID);
ReferenceDelta connectorRefDeltaReplace = prismContext.deltaFactory().reference().createModificationReplace(ResourceType.F_CONNECTOR_REF, getResourceDefinition(), connectorDummyFakeOid);
resourceDelta.addModification(connectorRefDeltaReplace);
ModelExecuteOptions options = executeOptions().raw();
// WHEN
executeChanges(resourceDelta, options, task, result);
// THEN
assertSuccess(result);
assertDowngrade(dummyResourceModelBefore);
}
use of com.evolveum.midpoint.model.api.ModelExecuteOptions in project midpoint by Evolveum.
the class TestConnectorDummyFake method test300UpgradeRawAddDelete.
@Test
public void test300UpgradeRawAddDelete() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
PrismObject<ResourceType> dummyResourceModelBefore = modelService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, null, task, result);
ObjectDelta<ResourceType> resourceDelta = prismContext.deltaFactory().object().createEmptyModifyDelta(ResourceType.class, RESOURCE_DUMMY_FAKE_OID);
ReferenceDelta connectorRefDeltaDel = prismContext.deltaFactory().reference().createModificationDelete(ResourceType.F_CONNECTOR_REF, getResourceDefinition(), connectorDummyFakeOid);
resourceDelta.addModification(connectorRefDeltaDel);
ReferenceDelta connectorRefDeltaAdd = prismContext.deltaFactory().reference().createModificationAdd(ResourceType.F_CONNECTOR_REF, getResourceDefinition(), connectorDummyOid);
resourceDelta.addModification(connectorRefDeltaAdd);
ModelExecuteOptions options = executeOptions().raw();
// WHEN
executeChanges(resourceDelta, options, task, result);
// THEN
assertSuccess(result);
assertUpgrade(dummyResourceModelBefore);
}
Aggregations