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());
}
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));
}
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());
}
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());
}
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.");
}
Aggregations