use of org.eclipse.bpmn2.Definitions in project kie-wb-common by kiegroup.
the class BPMNFormModelGeneratorImpl method generateProcessFormModel.
@Override
public BusinessProcessFormModel generateProcessFormModel(Definitions source, Path path) {
Process process = getProcess(source);
if (process != null) {
final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path));
List<ModelProperty> properties = process.getProperties().stream().map(property -> {
String varName = property.getId();
String varType = BPMNVariableUtils.getRealTypeForInput(property.getItemSubjectRef().getStructureRef());
Variable variable = new Variable(varName, varType);
variable.setInput(true);
variable.setOutput(true);
return createModelProperty(variable, projectClassLoader);
}).sorted((property1, property2) -> property1.getName().compareToIgnoreCase(property2.getName())).collect(Collectors.toList());
return new BusinessProcessFormModel(process.getId(), process.getName(), properties);
}
return null;
}
use of org.eclipse.bpmn2.Definitions in project kie-wb-common by kiegroup.
the class Bpmn2JsonUnmarshaller method revisitAssociationsIoSpec.
public void revisitAssociationsIoSpec(Definitions def) {
List<RootElement> rootElements = def.getRootElements();
List<ItemDefinition> toAddItemDefinitions = new ArrayList<ItemDefinition>();
for (RootElement root : rootElements) {
if (root instanceof Process) {
setItemDefinitionsForActivitiesIoSpec((Process) root, def, toAddItemDefinitions);
}
}
for (ItemDefinition itemDef : toAddItemDefinitions) {
def.getRootElements().add(itemDef);
}
}
use of org.eclipse.bpmn2.Definitions in project kie-wb-common by kiegroup.
the class Bpmn2JsonUnmarshaller method revisitBoundaryEventsPositions.
protected void revisitBoundaryEventsPositions(Definitions def) {
for (RootElement root : def.getRootElements()) {
if (root instanceof Process) {
Process process = (Process) root;
List<BoundaryEvent> toRemove = new ArrayList();
for (FlowElement fe : process.getFlowElements()) {
if (fe instanceof BoundaryEvent) {
BoundaryEvent be = (BoundaryEvent) fe;
FlowElementsContainer container = findContainerForBoundaryEvent(process, be);
if (container != null && !(container instanceof Process)) {
BoundaryEvent beCopy = copyBoundaryEvent(be);
container.getFlowElements().add(beCopy);
_outgoingFlows.put(beCopy, _outgoingFlows.get(be));
toRemove.add(be);
_outgoingFlows.remove(be);
}
}
}
for (BoundaryEvent be : toRemove) {
process.getFlowElements().remove(be);
}
}
}
reconnectFlows();
}
use of org.eclipse.bpmn2.Definitions in project kie-wb-common by kiegroup.
the class Bpmn2JsonUnmarshaller method revisitSignalRef.
/**
* Updates the signal ref on catch and throw event definitions (including boundary)
* @param def Definitions
*/
public void revisitSignalRef(Definitions def) {
revisitSignalIds(def);
List<RootElement> rootElements = def.getRootElements();
for (RootElement root : rootElements) {
if (root instanceof Process) {
setSignalRefForCatchEvents((Process) root, def);
setSignalRefForThrowEvents((Process) root, def);
setSignalRefForBoundaryEvents((Process) root, def);
}
}
}
use of org.eclipse.bpmn2.Definitions in project kie-wb-common by kiegroup.
the class Bpmn2JsonUnmarshaller method updateIDs.
public void updateIDs(Definitions def) {
// data object id update
List<RootElement> rootElements = def.getRootElements();
for (RootElement root : rootElements) {
if (root instanceof Process) {
Process process = (Process) root;
if (process.getId() != null) {
String processId = process.getId().trim();
processId = processId.replaceAll("\\s", "");
process.setId(processId);
}
List<FlowElement> flowElements = process.getFlowElements();
for (FlowElement fe : flowElements) {
if (fe instanceof DataObject) {
DataObject da = (DataObject) fe;
if (da.getName() != null) {
String daId = da.getName().trim();
daId = daId.replaceAll("\\W", "");
da.setId(daId);
}
}
}
}
}
}
Aggregations