Search in sources :

Example 1 with WfContextType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType in project midpoint by Evolveum.

the class TestParseWorkflowContext method assertPrismContainerValueLocal.

@Override
public void assertPrismContainerValueLocal(PrismContainerValue<WfContextType> value) throws SchemaException {
    WfContextType wfc = value.asContainerable();
    assertEquals("Wrong # of events", 1, wfc.getEvent().size());
    assertEquals("Wrong type of first event", WorkItemCompletionEventType.class, wfc.getEvent().get(0).getClass());
}
Also used : WfContextType(com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType)

Example 2 with WfContextType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType in project midpoint by Evolveum.

the class ItemApprovalHistoryPanel method initLayout.

private void initLayout(UserProfileStorage.TableId tableId, int pageSize) {
    add(new DecisionsPanel(ID_DECISIONS_DONE, new AbstractReadOnlyModel<List<DecisionDto>>() {

        @Override
        public List<DecisionDto> getObject() {
            List<DecisionDto> rv = new ArrayList<>();
            WfContextType wfContextType = getModelObject();
            if (wfContextType == null) {
                return rv;
            }
            if (!wfContextType.getEvent().isEmpty()) {
                wfContextType.getEvent().forEach(e -> addIgnoreNull(rv, DecisionDto.create(e, getPageBase())));
            } else {
                ItemApprovalProcessStateType instanceState = WfContextUtil.getItemApprovalProcessInfo(wfContextType);
                if (instanceState != null) {
                    instanceState.getDecisions().forEach(d -> addIgnoreNull(rv, DecisionDto.create(d)));
                }
            }
            return rv;
        }
    }, tableId, pageSize));
}
Also used : DecisionsPanel(com.evolveum.midpoint.web.component.wf.DecisionsPanel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ItemApprovalProcessStateType(com.evolveum.midpoint.xml.ns._public.common.common_3.ItemApprovalProcessStateType) DecisionDto(com.evolveum.midpoint.web.page.admin.workflow.dto.DecisionDto) ArrayList(java.util.ArrayList) WfContextType(com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType)

Example 3 with WfContextType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType in project midpoint by Evolveum.

the class TestUserChangeApprovalLegacy method checkTask.

private void checkTask(TaskType subtaskType, String subtaskName, String processName) {
    assertEquals("Unexpected fetch result in wf subtask: " + subtaskName, null, subtaskType.getFetchResult());
    WfContextType wfc = subtaskType.getWorkflowContext();
    assertNotNull("Missing workflow context in wf subtask: " + subtaskName, wfc);
    assertNotNull("No process ID in wf subtask: " + subtaskName, wfc.getProcessInstanceId());
    assertEquals("Wrong process ID name in subtask: " + subtaskName, processName, wfc.getProcessInstanceName());
    assertNotNull("Missing process start time in subtask: " + subtaskName, wfc.getStartTimestamp());
    assertNull("Unexpected process end time in subtask: " + subtaskName, wfc.getEndTimestamp());
    assertEquals("Wrong outcome", null, wfc.getOutcome());
//assertEquals("Wrong state", null, wfc.getState());
}
Also used : WfContextType(com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType)

Example 4 with WfContextType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType in project midpoint by Evolveum.

the class AbstractWfTestPolicy method checkTask.

private void checkTask(TaskType subtaskType, String subtaskName, ExpectedTask expectedTask) {
    assertNull("Unexpected fetch result in wf subtask: " + subtaskName, subtaskType.getFetchResult());
    WfContextType wfc = subtaskType.getWorkflowContext();
    assertNotNull("Missing workflow context in wf subtask: " + subtaskName, wfc);
    assertNotNull("No process ID in wf subtask: " + subtaskName, wfc.getProcessInstanceId());
    assertEquals("Wrong process ID name in subtask: " + subtaskName, expectedTask.processName, wfc.getProcessInstanceName());
    if (expectedTask.targetOid != null) {
        assertEquals("Wrong target OID in subtask: " + subtaskName, expectedTask.targetOid, wfc.getTargetRef().getOid());
    } else {
        assertNull("TargetRef in subtask: " + subtaskName + " present even if it shouldn't", wfc.getTargetRef());
    }
    assertNotNull("Missing process start time in subtask: " + subtaskName, wfc.getStartTimestamp());
    assertNull("Unexpected process end time in subtask: " + subtaskName, wfc.getEndTimestamp());
    assertEquals("Wrong outcome", null, wfc.getOutcome());
//assertEquals("Wrong state", null, wfc.getState());
}
Also used : WfContextType(com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType)

Example 5 with WfContextType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType in project midpoint by Evolveum.

the class WfTaskUtil method getPrimaryChangeAspect.

@NotNull
public PrimaryChangeAspect getPrimaryChangeAspect(Task task, Collection<PrimaryChangeAspect> aspects) {
    WfContextType wfc = getWorkflowContextChecked(task);
    WfProcessorSpecificStateType pss = wfc.getProcessorSpecificState();
    if (!(pss instanceof WfPrimaryChangeProcessorStateType)) {
        throw new IllegalStateException("Expected " + WfPrimaryChangeProcessorStateType.class + " but got " + pss + " in task " + task);
    }
    WfPrimaryChangeProcessorStateType pcps = ((WfPrimaryChangeProcessorStateType) pss);
    String aspectClassName = pcps.getChangeAspect();
    if (aspectClassName == null) {
        throw new IllegalStateException("No wf primary change aspect defined in task " + task);
    }
    for (PrimaryChangeAspect a : aspects) {
        if (aspectClassName.equals(a.getClass().getName())) {
            return a;
        }
    }
    throw new IllegalStateException("Primary change aspect " + aspectClassName + " is not registered.");
}
Also used : PrimaryChangeAspect(com.evolveum.midpoint.wf.impl.processors.primary.aspect.PrimaryChangeAspect) WfContextType(com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

WfContextType (com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType)8 Task (com.evolveum.midpoint.task.api.Task)2 PrismContext (com.evolveum.midpoint.prism.PrismContext)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)1 SchemaConstants (com.evolveum.midpoint.schema.constants.SchemaConstants)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 WfContextUtil (com.evolveum.midpoint.schema.util.WfContextUtil)1 QNameUtil (com.evolveum.midpoint.util.QNameUtil)1 Trace (com.evolveum.midpoint.util.logging.Trace)1 TraceManager (com.evolveum.midpoint.util.logging.TraceManager)1 DecisionsPanel (com.evolveum.midpoint.web.component.wf.DecisionsPanel)1 DecisionDto (com.evolveum.midpoint.web.page.admin.workflow.dto.DecisionDto)1 ActivitiUtil (com.evolveum.midpoint.wf.impl.processes.common.ActivitiUtil)1 CommonProcessVariableNames (com.evolveum.midpoint.wf.impl.processes.common.CommonProcessVariableNames)1 SpringApplicationContextHolder.getPrismContext (com.evolveum.midpoint.wf.impl.processes.common.SpringApplicationContextHolder.getPrismContext)1 PrimaryChangeAspect (com.evolveum.midpoint.wf.impl.processors.primary.aspect.PrimaryChangeAspect)1 ApprovalUtils (com.evolveum.midpoint.wf.util.ApprovalUtils)1 com.evolveum.midpoint.xml.ns._public.common.common_3 (com.evolveum.midpoint.xml.ns._public.common.common_3)1