Skip to content

Commit

Permalink
Better discovery operation names.
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Jun 6, 2016
1 parent a3d278d commit 61c9ab1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
Expand Up @@ -76,6 +76,7 @@ public class OperationResult implements Serializable, DebugDumpable, Cloneable {
public static final String CONTEXT_OBJECT = "object";
public static final String CONTEXT_ITEM = "item";
public static final String CONTEXT_TASK = "task";
public static final String CONTEXT_RESOURCE = "resource";

public static final String PARAM_OID = "oid";
public static final String PARAM_TYPE = "type";
Expand Down
Expand Up @@ -138,7 +138,8 @@ public <T extends ShadowType> T handleError(T shadow, FailedOperation op, Except
case MODIFY:
LOGGER.debug("DISCOVERY: cannot find object {}. The operation in progress is MODIFY, therefore initiating synchronization", shadow);
LOGGER.trace("Starting discovery to find out if the object should exist or not.");
OperationResult handleErrorResult = result.createSubresult("Discovery for situation: Object not found on the " + ObjectTypeUtil.toShortString(shadow.getResource()));
OperationResult handleErrorResult = result.createSubresult("com.evolveum.midpoint.provisioning.consistency.impl.ObjectNotFoundHandler.handleError.discovery");
handleErrorResult.addContext(OperationResult.CONTEXT_RESOURCE, shadow.getResource());

ObjectDeltaType shadowModifications = shadow.getObjectChange();
Collection<? extends ItemDelta> modifications = DeltaConvertor.toModifications(
Expand All @@ -158,9 +159,16 @@ public <T extends ShadowType> T handleError(T shadow, FailedOperation op, Except
// the model to decide, if the account will be revived or unlinked
// form the user
// TODO: task initialication
// Task task = taskManager.createTaskInstance();
// task.setChannel(QNameUtil.qNameToUri(SchemaConstants.CHANGE_CHANNEL_DISCOVERY));
changeNotificationDispatcher.notifyChange(change, task, handleErrorResult);

try {

changeNotificationDispatcher.notifyChange(change, task, handleErrorResult);

} catch (RuntimeException e) {
handleErrorResult.recordFatalError(e);
result.computeStatus();
throw e;
}
handleErrorResult.computeStatus();
String oidVal = null;
findReturnedValue(handleErrorResult, oidVal);
Expand Down Expand Up @@ -209,7 +217,8 @@ public <T extends ShadowType> T handleError(T shadow, FailedOperation op, Except
throw new ObjectNotFoundException(ex.getMessage(), ex);
}
LOGGER.debug("DISCOVERY: cannot find object {}. The operation in progress is GET, therefore initiating synchronization", shadow);
OperationResult handleGetErrorResult = result.createSubresult("Discovery for situation: Object not found on the " + ObjectTypeUtil.toShortString(shadow.getResource()));
OperationResult handleGetErrorResult = result.createSubresult("com.evolveum.midpoint.provisioning.consistency.impl.ObjectNotFoundHandler.handleError.discovery");
handleGetErrorResult.addContext(OperationResult.CONTEXT_RESOURCE, shadow.getResource());

Collection<? extends ItemDelta> deadModification = PropertyDelta.createModificationReplacePropertyCollection(ShadowType.F_DEAD, shadow.asPrismObject().getDefinition(), true);
ConstraintsChecker.onShadowModifyOperation(deadModification);
Expand All @@ -230,11 +239,19 @@ public <T extends ShadowType> T handleError(T shadow, FailedOperation op, Except
// the model to decide, if the account will be revived or unlinked
// form the user
// TODO: task initialication
// Task getTask = taskManager.createTaskInstance();

if (task == null){
task = taskManager.createTaskInstance();
}
changeNotificationDispatcher.notifyChange(getChange, task, handleGetErrorResult);
try {

changeNotificationDispatcher.notifyChange(getChange, task, handleGetErrorResult);

} catch (RuntimeException e) {
handleGetErrorResult.recordFatalError(e);
result.computeStatus();
throw e;
}
// String oidVal = null;
handleGetErrorResult.computeStatus();
findReturnedValue(handleGetErrorResult, null);
Expand Down

0 comments on commit 61c9ab1

Please sign in to comment.