use of org.kie.kogito.process.GroupedNamedDataType in project kogito-runtimes by kiegroup.
the class WorkItemNodeInstance method getEventDescriptions.
@Override
public Set<EventDescription<?>> getEventDescriptions() {
List<NamedDataType> inputs = new ArrayList<>();
for (ParameterDefinition paramDef : getWorkItemNode().getWork().getParameterDefinitions()) {
inputs.add(new NamedDataType(paramDef.getName(), paramDef.getType()));
}
List<NamedDataType> outputs = new ArrayList<>();
VariableScope variableScope = (VariableScope) getProcessInstance().getContextContainer().getDefaultContext(VARIABLE_SCOPE);
getWorkItemNode().getOutAssociations().forEach(da -> da.getSources().forEach(s -> outputs.add(new NamedDataType(s.getLabel(), variableScope.findVariable(da.getTarget().getLabel()).getType()))));
GroupedNamedDataType dataTypes = new GroupedNamedDataType();
dataTypes.add("Input", inputs);
dataTypes.add("Output", outputs);
// return just the main completion type of an event
return Collections.singleton(new IOEventDescription("workItemCompleted", getNodeDefinitionId(), getNodeName(), "workItem", getWorkItemId(), getProcessInstance().getStringId(), dataTypes));
}
Aggregations