use of com.evolveum.midpoint.schema.result.AsynchronousOperationQueryable in project midpoint by Evolveum.
the class ResourceObjectConverter method refreshOperationStatus.
public OperationResultStatus refreshOperationStatus(ProvisioningContext ctx, PrismObject<ShadowType> shadow, String asyncRef, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
OperationResult result = parentResult.createSubresult(OPERATION_REFRESH_OPERATION_STATUS);
ResourceType resource;
ConnectorInstance connector;
try {
resource = ctx.getResource();
// TODO: not really correct. But good enough for now.
connector = ctx.getConnector(UpdateCapabilityType.class, result);
} catch (ObjectNotFoundException | SchemaException | CommunicationException | ConfigurationException | ExpressionEvaluationException | RuntimeException | Error e) {
result.recordFatalError(e);
throw e;
}
OperationResultStatus status = null;
if (connector instanceof AsynchronousOperationQueryable) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("PROVISIONING REFRESH operation on {}, object: {}", resource, shadow);
}
try {
status = ((AsynchronousOperationQueryable) connector).queryOperationStatus(asyncRef, result);
} catch (ObjectNotFoundException | SchemaException e) {
result.recordFatalError(e);
throw e;
}
result.recordSuccess();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("PROVISIONING REFRESH successful, returned status: {}", status);
}
} else {
LOGGER.trace("Ignoring refresh of shadow {}, because the connector is not async");
result.recordNotApplicableIfUnknown();
}
return status;
}
Aggregations