Search in sources :

Example 6 with OperationResultStatus

use of com.evolveum.midpoint.schema.result.OperationResultStatus in project midpoint by Evolveum.

the class ManualConnectorInstance method queryOperationStatus.

@Override
public OperationResultStatus queryOperationStatus(String asyncronousOperationReference, OperationResult parentResult) throws ObjectNotFoundException, SchemaException {
    OperationResult result = parentResult.createMinorSubresult(OPERATION_QUERY_CASE);
    PrismObject<CaseType> acase;
    try {
        acase = repositoryService.getObject(CaseType.class, asyncronousOperationReference, null, result);
    } catch (ObjectNotFoundException | SchemaException e) {
        result.recordFatalError(e);
        throw e;
    }
    CaseType caseType = acase.asObjectable();
    String state = caseType.getState();
    if (QNameUtil.matchWithUri(SchemaConstants.CASE_STATE_OPEN_QNAME, state)) {
        result.recordSuccess();
        return OperationResultStatus.IN_PROGRESS;
    } else if (QNameUtil.matchWithUri(SchemaConstants.CASE_STATE_CLOSED_QNAME, state)) {
        String outcome = caseType.getOutcome();
        OperationResultStatus status = translateOutcome(outcome);
        result.recordSuccess();
        return status;
    } else {
        SchemaException e = new SchemaException("Unknown case state " + state);
        result.recordFatalError(e);
        throw e;
    }
}
Also used : OperationResultStatus(com.evolveum.midpoint.schema.result.OperationResultStatus) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) CaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 7 with OperationResultStatus

use of com.evolveum.midpoint.schema.result.OperationResultStatus in project midpoint by Evolveum.

the class OrgClosureManager method compareOrgClosureTables.

private void compareOrgClosureTables(List existingEntries, List recomputedEntries, boolean rebuild, OperationResult result) {
    Set<List> existing = convertEntries(existingEntries);
    Set<List> recomputed = convertEntries(recomputedEntries);
    if (!existing.equals(recomputed)) {
        String addendum;
        OperationResultStatus status;
        if (rebuild) {
            status = OperationResultStatus.HANDLED_ERROR;
            addendum = " The table has been recomputed and now it is OK.";
        } else {
            status = OperationResultStatus.FATAL_ERROR;
            addendum = " Please recompute the table as soon as possible.";
        }
        String m = "Closure table is not consistent with the repository. Expected size: " + recomputed.size() + " actual size: " + existing.size() + "." + addendum;
        result.recordStatus(status, m);
        LOGGER.info(m);
    } else {
        String m = "Closure table is OK (" + existing.size() + " entries)";
        result.recordStatus(OperationResultStatus.SUCCESS, m);
        LOGGER.info(m);
    }
}
Also used : OperationResultStatus(com.evolveum.midpoint.schema.result.OperationResultStatus)

Example 8 with OperationResultStatus

use of com.evolveum.midpoint.schema.result.OperationResultStatus in project midpoint by Evolveum.

the class ResourceController method getStatusFromResultType.

private static OperationResultStatus getStatusFromResultType(ConnectorTestOperation operation, List<OperationResult> results) {
    OperationResultStatus status = OperationResultStatus.UNKNOWN;
    OperationResult resultFound = null;
    for (OperationResult result : results) {
        try {
            if (operation.getOperation().equals(result.getOperation())) {
                resultFound = result;
                break;
            }
        } catch (IllegalArgumentException ex) {
        //result.recordFatalError("Result operation name " + result.getOperation() + " returned from test connection is not type of " + ConnectorTestOperation.class + ".", ex);
        }
    }
    if (resultFound == null) {
        return status;
    }
    switch(resultFound.getStatus()) {
        case UNKNOWN:
            status = OperationResultStatus.UNKNOWN;
            break;
        case SUCCESS:
            status = OperationResultStatus.SUCCESS;
            break;
        case WARNING:
            status = OperationResultStatus.WARNING;
            break;
        case FATAL_ERROR:
            status = OperationResultStatus.FATAL_ERROR;
            break;
        case PARTIAL_ERROR:
            status = OperationResultStatus.PARTIAL_ERROR;
            break;
        case HANDLED_ERROR:
            status = OperationResultStatus.HANDLED_ERROR;
            break;
        case IN_PROGRESS:
            status = OperationResultStatus.IN_PROGRESS;
            break;
        default:
            status = OperationResultStatus.UNKNOWN;
    }
    return status;
}
Also used : OperationResultStatus(com.evolveum.midpoint.schema.result.OperationResultStatus) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 9 with OperationResultStatus

use of com.evolveum.midpoint.schema.result.OperationResultStatus in project midpoint by Evolveum.

the class ResourceState method updateOverallStatus.

private OperationResultStatus updateOverallStatus() {
    OperationResultStatus overall = OperationResultStatus.UNKNOWN;
    overall = getOverallBasedOnPartialStatus(overall, getConConnection());
    overall = getOverallBasedOnPartialStatus(overall, getConfValidation());
    overall = getOverallBasedOnPartialStatus(overall, getConInitialization());
    overall = getOverallBasedOnPartialStatus(overall, getConSanity());
    overall = getOverallBasedOnPartialStatus(overall, getConSchema());
    overall = getOverallBasedOnPartialStatus(overall, getExtra());
    return overall;
}
Also used : OperationResultStatus(com.evolveum.midpoint.schema.result.OperationResultStatus)

Example 10 with OperationResultStatus

use of com.evolveum.midpoint.schema.result.OperationResultStatus in project midpoint by Evolveum.

the class WebComponentUtil method createErrorIcon.

public static String createErrorIcon(OperationResult result) {
    OperationResultStatus status = result.getStatus();
    OperationResultStatusPresentationProperties icon = OperationResultStatusPresentationProperties.parseOperationalResultStatus(status);
    return icon.getIcon() + " fa-lg";
}
Also used : OperationResultStatus(com.evolveum.midpoint.schema.result.OperationResultStatus) OperationResultStatusPresentationProperties(com.evolveum.midpoint.web.page.admin.server.dto.OperationResultStatusPresentationProperties)

Aggregations

OperationResultStatus (com.evolveum.midpoint.schema.result.OperationResultStatus)14 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)9 AsynchronousOperationResult (com.evolveum.midpoint.schema.result.AsynchronousOperationResult)2 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 ArrayList (java.util.ArrayList)2 ShadowDiscriminatorObjectDelta (com.evolveum.midpoint.common.refinery.ShadowDiscriminatorObjectDelta)1 ModelProjectionContext (com.evolveum.midpoint.model.api.context.ModelProjectionContext)1 TestRbac (com.evolveum.midpoint.model.intest.rbac.TestRbac)1 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)1 ObjectDeltaOperation (com.evolveum.midpoint.schema.ObjectDeltaOperation)1 ResourceAttribute (com.evolveum.midpoint.schema.processor.ResourceAttribute)1 AsynchronousOperationQueryable (com.evolveum.midpoint.schema.result.AsynchronousOperationQueryable)1 Task (com.evolveum.midpoint.task.api.Task)1 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)1 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)1 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)1