Search in sources :

Example 1 with ProcessObjectResult

use of com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult in project midpoint-studio by Evolveum.

the class CleanupFileTask method processObject.

@Override
public ProcessObjectResult processObject(MidPointObject object) throws Exception {
    String newContent = cleanupObject(object);
    MidPointObject newObject = MidPointObject.copy(object);
    newObject.setContent(newContent);
    return new ProcessObjectResult(null).object(newObject);
}
Also used : MidPointObject(com.evolveum.midpoint.studio.client.MidPointObject) ProcessObjectResult(com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult)

Example 2 with ProcessObjectResult

use of com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult in project midpoint-studio by Evolveum.

the class DeleteTask method processObjectOid.

@Override
public ProcessObjectResult processObjectOid(ObjectTypes type, String oid) throws Exception {
    DeleteOptions opts = new DeleteOptions().raw(raw);
    client.delete(type.getClassDefinition(), oid, opts);
    return new ProcessObjectResult(null);
}
Also used : DeleteOptions(com.evolveum.midpoint.studio.client.DeleteOptions) ProcessObjectResult(com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult)

Example 3 with ProcessObjectResult

use of com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult in project midpoint-studio by Evolveum.

the class UploadRecomputeTask method processObject.

@Override
public ProcessObjectResult processObject(MidPointObject obj) throws Exception {
    ProcessObjectResult por = super.processObject(obj);
    if (obj.isExecutable()) {
        return por;
    }
    OperationResult uploadResult = por.result();
    if (uploadResult != null && !uploadResult.isSuccess()) {
        printProblem("Skipping recomputation for " + obj.getName() + ", there was a problem with upload");
        return por;
    }
    if (obj.getType() == null || !AssignmentHolderType.class.isAssignableFrom(obj.getType().getClassDefinition())) {
        return por;
    }
    String requestString = buildExecuteScriptRequestBody(obj);
    ExecuteScriptResponseType response = client.execute(requestString);
    OperationResultType res = response.getResult();
    OperationResult executionResult = OperationResult.createOperationResult(res);
    return validateOperationResult("recompute", executionResult, obj.getName());
}
Also used : ExecuteScriptResponseType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ExecuteScriptResponseType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ProcessObjectResult(com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult)

Example 4 with ProcessObjectResult

use of com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult in project midpoint-studio by Evolveum.

the class UploadTestResourceTask method processObject.

@Override
public ProcessObjectResult processObject(MidPointObject obj) throws Exception {
    ProcessObjectResult por = super.processObject(obj);
    if (obj.isExecutable()) {
        return por;
    }
    OperationResult uploadResult = por.result();
    if (uploadResult != null && !uploadResult.isSuccess()) {
        printProblem("Skipping test connection for " + obj.getName() + ", there was a problem with upload");
        return por;
    }
    if (!ObjectTypes.RESOURCE.equals(obj.getType())) {
        printProblem("Can't test connection for " + obj.getName() + ", because it's not resource, it's " + obj.getType().getClassDefinition().getName());
        return por;
    }
    OperationResult testConnectionResult = client.testResource(obj.getOid());
    return validateOperationResult(OPERATION_TEST_CONNECTION, testConnectionResult, obj.getName());
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ProcessObjectResult(com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult)

Example 5 with ProcessObjectResult

use of com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult in project midpoint-studio by Evolveum.

the class UploadTestValidateResourceTask method processObject.

@Override
public ProcessObjectResult processObject(MidPointObject obj) throws Exception {
    ProcessObjectResult por = super.processObject(obj);
    OperationResult testConnectionResult = por.result();
    String name = obj.getName();
    if (testConnectionResult != null && !testConnectionResult.isSuccess()) {
        printProblem("Skipping resource validation for " + name + ", there was a problem with upload/test");
        return por;
    }
    if (!ObjectTypes.RESOURCE.equals(obj.getType())) {
        printProblem("Can't validate resource for " + name + ", because it's " + obj.getType().getClassDefinition().getName());
        return por;
    }
    GeneratorOptions genOptions = new GeneratorOptions();
    BulkActionGenerator gen = new BulkActionGenerator(BulkActionGenerator.Action.VALIDATE);
    String requestString = gen.generateFromSourceObject(obj, genOptions, getProject());
    ExecuteScriptResponseType response = client.execute(requestString);
    OperationResultType res = response.getResult();
    OperationResult executionResult = OperationResult.createOperationResult(res);
    return validateOperationResult("validate", executionResult, obj.getName());
}
Also used : ExecuteScriptResponseType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ExecuteScriptResponseType) GeneratorOptions(com.evolveum.midpoint.studio.impl.browse.GeneratorOptions) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) BulkActionGenerator(com.evolveum.midpoint.studio.impl.browse.BulkActionGenerator) ProcessObjectResult(com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult)

Aggregations

ProcessObjectResult (com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult)9 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 MidPointObject (com.evolveum.midpoint.studio.client.MidPointObject)3 IOException (java.io.IOException)3 ExecuteScriptResponseType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ExecuteScriptResponseType)2 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)2 ObjectTypes (com.evolveum.midpoint.schema.constants.ObjectTypes)1 DeleteOptions (com.evolveum.midpoint.studio.client.DeleteOptions)1 BulkActionGenerator (com.evolveum.midpoint.studio.impl.browse.BulkActionGenerator)1 GeneratorOptions (com.evolveum.midpoint.studio.impl.browse.GeneratorOptions)1 ArrayList (java.util.ArrayList)1