Search in sources :

Example 6 with Scene

use of com.evolveum.midpoint.model.api.visualizer.Scene in project midpoint by Evolveum.

the class TestVisualizer method test305UserAssignmentAdd.

@Test
public void test305UserAssignmentAdd() throws Exception {
    final String TEST_NAME = "test305UserAssignmentAdd";
    Task task = createTask(TEST_NAME);
    display("jack", getUser(USER_JACK_OID));
    AssignmentType ass1 = new AssignmentType();
    ass1.setConstruction(new ConstructionType());
    ass1.getConstruction().setResourceRef(createObjectRef(RESOURCE_DUMMY_OID, RESOURCE));
    ObjectDelta<UserType> delta = (ObjectDelta<UserType>) DeltaBuilder.deltaFor(UserType.class, prismContext).item(UserType.F_ASSIGNMENT).add(ass1).asObjectDelta(USER_JACK_OID);
    /// WHEN
    displayWhen(TEST_NAME);
    final Scene scene = visualizer.visualizeDelta(delta, task, task.getResult());
    modelService.executeChanges(Collections.<ObjectDelta<? extends ObjectType>>singletonList(delta), null, task, task.getResult());
    // THEN
    displayThen(TEST_NAME);
    display("scene", scene);
    display("jack with assignment", getUser(USER_JACK_OID));
// TODO some asserts
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta) Scene(com.evolveum.midpoint.model.api.visualizer.Scene) Test(org.testng.annotations.Test) AbstractInternalModelIntegrationTest(com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)

Example 7 with Scene

use of com.evolveum.midpoint.model.api.visualizer.Scene in project midpoint by Evolveum.

the class TestVisualizer method test330UserLinkRefReplaceNoOp.

@Test
public void test330UserLinkRefReplaceNoOp() throws Exception {
    final String TEST_NAME = "test330UserLinkRefReplaceNoOp";
    Task task = createTask(TEST_NAME);
    ObjectDelta<UserType> delta = (ObjectDelta<UserType>) DeltaBuilder.deltaFor(UserType.class, prismContext).item(UserType.F_LINK_REF).replace(createObjectRef(dummyAccountOid, SHADOW).asReferenceValue()).asObjectDelta(USER_JACK_OID);
    /// WHEN
    displayWhen(TEST_NAME);
    final Scene scene = visualizer.visualizeDelta(delta, task, task.getResult());
    // THEN
    displayThen(TEST_NAME);
    display("scene", scene);
// TODO some asserts
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta) Scene(com.evolveum.midpoint.model.api.visualizer.Scene) Test(org.testng.annotations.Test) AbstractInternalModelIntegrationTest(com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)

Example 8 with Scene

use of com.evolveum.midpoint.model.api.visualizer.Scene in project midpoint by Evolveum.

the class ScenePanel method isExistingViewableObject.

protected boolean isExistingViewableObject() {
    final Scene scene = getModelObject().getScene();
    final PrismContainerValue<?> value = scene.getSourceValue();
    return value != null && value.getParent() instanceof PrismObject && WebComponentUtil.hasDetailsPage((PrismObject) value.getParent()) && ((PrismObject) value.getParent()).getOid() != null && (scene.getSourceDelta() == null || !scene.getSourceDelta().isAdd());
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Scene(com.evolveum.midpoint.model.api.visualizer.Scene)

Example 9 with Scene

use of com.evolveum.midpoint.model.api.visualizer.Scene in project midpoint by Evolveum.

the class SceneUtil method visualizeObjectTreeDeltas.

public static Scene visualizeObjectTreeDeltas(ObjectTreeDeltasType deltas, String displayNameKey, PrismContext prismContext, ModelInteractionService modelInteractionService, Task task, OperationResult result) throws SchemaException, ExpressionEvaluationException {
    List<Scene> scenes = new ArrayList<>();
    if (deltas != null) {
        if (deltas.getFocusPrimaryDelta() != null) {
            ObjectDelta<? extends ObjectType> delta = DeltaConvertor.createObjectDelta(deltas.getFocusPrimaryDelta(), prismContext);
            scenes.add(modelInteractionService.visualizeDelta(delta, task, result));
        }
        for (ProjectionObjectDeltaType projectionObjectDelta : deltas.getProjectionPrimaryDelta()) {
            ObjectDelta<? extends ObjectType> delta = DeltaConvertor.createObjectDelta(projectionObjectDelta.getPrimaryDelta(), prismContext);
            scenes.add(modelInteractionService.visualizeDelta(delta, task, result));
        }
    }
    return new WrapperScene(scenes, displayNameKey);
}
Also used : ArrayList(java.util.ArrayList) Scene(com.evolveum.midpoint.model.api.visualizer.Scene) ProjectionObjectDeltaType(com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionObjectDeltaType)

Example 10 with Scene

use of com.evolveum.midpoint.model.api.visualizer.Scene in project midpoint by Evolveum.

the class WorkItemDto method prepareDeltaVisualization.

public void prepareDeltaVisualization(String sceneNameKey, PrismContext prismContext, ModelInteractionService modelInteractionService, Task opTask, OperationResult result) throws SchemaException, ExpressionEvaluationException {
    TaskType task = getTaskType();
    if (task == null || task.getWorkflowContext() == null) {
        return;
    }
    if (!(task.getWorkflowContext().getProcessorSpecificState() instanceof WfPrimaryChangeProcessorStateType)) {
        return;
    }
    WfPrimaryChangeProcessorStateType state = (WfPrimaryChangeProcessorStateType) task.getWorkflowContext().getProcessorSpecificState();
    Scene deltasScene = SceneUtil.visualizeObjectTreeDeltas(state.getDeltasToProcess(), sceneNameKey, prismContext, modelInteractionService, opTask, result);
    deltas = new SceneDto(deltasScene);
    ObjectTreeDeltas deltas = ObjectTreeDeltas.fromObjectTreeDeltasType(state.getDeltasToProcess(), prismContext);
    changes = TaskDto.createChangesToBeApproved(deltas, modelInteractionService, prismContext, opTask, result);
}
Also used : SceneDto(com.evolveum.midpoint.web.component.prism.show.SceneDto) Scene(com.evolveum.midpoint.model.api.visualizer.Scene) ObjectTreeDeltas(com.evolveum.midpoint.schema.ObjectTreeDeltas)

Aggregations

Scene (com.evolveum.midpoint.model.api.visualizer.Scene)18 AbstractInternalModelIntegrationTest (com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)11 Task (com.evolveum.midpoint.task.api.Task)11 Test (org.testng.annotations.Test)11 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)5 SceneDto (com.evolveum.midpoint.web.component.prism.show.SceneDto)5 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)2 ArrayList (java.util.ArrayList)2 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 ObjectTreeDeltas (com.evolveum.midpoint.schema.ObjectTreeDeltas)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 ProjectionObjectDeltaType (com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionObjectDeltaType)1 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)1