Search in sources :

Example 1 with AsynchronousOperationQueryable

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;
}
Also used : UpdateCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.UpdateCapabilityType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AsynchronousOperationResult(com.evolveum.midpoint.schema.result.AsynchronousOperationResult) OperationResultStatus(com.evolveum.midpoint.schema.result.OperationResultStatus) AsynchronousOperationQueryable(com.evolveum.midpoint.schema.result.AsynchronousOperationQueryable)

Aggregations

AsynchronousOperationQueryable (com.evolveum.midpoint.schema.result.AsynchronousOperationQueryable)1 AsynchronousOperationResult (com.evolveum.midpoint.schema.result.AsynchronousOperationResult)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 OperationResultStatus (com.evolveum.midpoint.schema.result.OperationResultStatus)1 UpdateCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.UpdateCapabilityType)1