use of com.evolveum.midpoint.provisioning.ucf.api.ConnectorOperationOptions in project midpoint by Evolveum.
the class DeleteHelper method deleteShadowDirectly.
private OperationResultStatus deleteShadowDirectly(ProvisioningContext ctx, ProvisioningOperationOptions options, OperationProvisioningScriptsType scripts, ProvisioningOperationState<AsynchronousOperationResult> opState, ShadowLifecycleStateType shadowState, Task task, OperationResult result) throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, ExpressionEvaluationException, GenericFrameworkException, SecurityViolationException, PolicyViolationException {
PrismObject<ShadowType> repoShadow = opState.getRepoShadow();
if (shadowState == ShadowLifecycleStateType.TOMBSTONE) {
// Do not even try to delete resource object for tombstone shadows.
// There may be dead shadow and live shadow for the resource object with the same identifiers.
// If we try to delete dead shadow then we might delete existing object by mistake
LOGGER.trace("DELETE {}: skipping resource deletion on tombstone shadow", repoShadow);
opState.setExecutionStatus(PendingOperationExecutionStatusType.COMPLETED);
result.createSubresult(OP_RESOURCE_OPERATION).recordNotApplicable();
return null;
}
ConnectorOperationOptions connOptions = commonHelper.createConnectorOperationOptions(ctx, options, result);
LOGGER.trace("DELETE {}: resource deletion, execution starting", repoShadow);
try {
ctx.checkNotInMaintenance();
AsynchronousOperationResult asyncReturnValue = resourceObjectConverter.deleteResourceObject(ctx, repoShadow, scripts, connOptions, result);
opState.processAsyncResult(asyncReturnValue);
resourceManager.modifyResourceAvailabilityStatus(ctx.getResourceOid(), AvailabilityStatusType.UP, "deleting " + repoShadow + " finished successfully.", task, result, false);
return null;
} catch (Exception ex) {
try {
return handleDeleteError(ctx, repoShadow, options, opState, ex, result.getLastSubresult(), task, result);
} catch (ObjectAlreadyExistsException e) {
result.recordFatalError(e);
throw new SystemException(e.getMessage(), e);
}
} finally {
LOGGER.debug("DELETE {}: resource operation executed, operation state: {}", repoShadow, opState.shortDumpLazily());
}
}
Aggregations