private void handleErrorHandlerException(ProvisioningContext ctx, ProvisioningOperationState<? extends AsynchronousOperationResult> opState, ObjectDelta<ShadowType> delta, Task task, OperationResult parentResult) throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, ObjectAlreadyExistsException, ExpressionEvaluationException { // Error handler had re-thrown the exception. We will throw the exception later. But first we need to record changes in opState. shadowManager.recordOperationException(ctx, opState, delta, parentResult); PrismObject<ShadowType> shadow = opState.getRepoShadow(); if (delta.isAdd()) { // This is more precise. Besides, there is no repo shadow in some cases (e.g. adding protected shadow). shadow = delta.getObjectToAdd(); } ResourceOperationDescription operationDescription = ProvisioningUtil.createResourceFailureDescription(shadow, ctx.getResource(), delta, parentResult); operationListener.notifyFailure(operationDescription, task, parentResult); }
public String addShadow(PrismObject<ShadowType> shadowToAdd, OperationProvisioningScriptsType scripts, ResourceType resource, ProvisioningOperationOptions options, Task task, OperationResult parentResult) throws CommunicationException, GenericFrameworkException, ObjectAlreadyExistsException, SchemaException, ObjectNotFoundException, ConfigurationException, SecurityViolationException, PolicyViolationException, ExpressionEvaluationException, EncryptionException { Validate.notNull(shadowToAdd, "Object to add must not be null."); InternalMonitor.recordCount(InternalCounters.SHADOW_CHANGE_OPERATION_COUNT); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Start adding shadow object{}:\n{}", getAdditionalOperationDesc(scripts, options), shadowToAdd.debugDump(1)); } ProvisioningContext ctx = ctxFactory.create(shadowToAdd, task, parentResult); try { ctx.assertDefinition(); } catch (SchemaException e) { parentResult.recordFatalError(e); ResourceOperationDescription operationDescription = ProvisioningUtil.createResourceFailureDescription( shadowToAdd, ctx.getResource(), shadowToAdd.createAddDelta(), parentResult); operationListener.notifyFailure(operationDescription, task, parentResult); throw e; } ProvisioningOperationState<AsynchronousOperationReturnValue<PrismObject<ShadowType>>> opState = new ProvisioningOperationState<>(); return addShadowAttempt(ctx, shadowToAdd, scripts, opState, options, task, parentResult); }
Task task = taskManager.createTaskInstance(); ResourceOperationDescription failureDescription = ProvisioningUtil.createResourceFailureDescription(conflictingShadow, ctx.getResource(), null, parentResult); changeNotificationDispatcher.notifyFailure(failureDescription, task, parentResult); shadowManager.deleteConflictedShadowFromRepo(conflictingShadow, parentResult);
ResourceOperationDescription operationDescription = ProvisioningUtil.createResourceFailureDescription( shadowToAdd, ctx.getResource(), shadowToAdd.createAddDelta(), parentResult); operationListener.notifyFailure(operationDescription, task, parentResult); throw e;