use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.
the class BPMFinderServiceImpl method scannProcessesForType.
protected void scannProcessesForType(final Path path, final String extension, final GenerationConfig generationConfig) {
List<org.uberfire.java.nio.file.Path> nioPaths = new ArrayList<>();
nioPaths.add(Paths.convert(path));
Collection<FileUtils.ScanResult> processes = fileUtils.scan(ioService, nioPaths, extension, true);
processes.stream().map(scanResult -> parse(scanResult)).filter(definitions -> definitions != null && generationConfig.getPredicate().test(definitions)).forEach(definitions -> {
BusinessProcessFormModel processFormModel = bpmnFormModelGenerator.generateProcessFormModel(definitions.get(), path);
List<TaskFormModel> taskModels = bpmnFormModelGenerator.generateTaskFormModels(definitions.get(), path);
generationConfig.getConsumer().accept(new JBPMProcessModel(processFormModel, taskModels));
});
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.
the class DMNEditBusinessKnowledgeModelToolboxAction method onMouseClick.
@Override
@SuppressWarnings("unchecked")
public ToolboxAction<AbstractCanvasHandler> onMouseClick(final AbstractCanvasHandler canvasHandler, final String uuid, final MouseClickEvent event) {
// Notice the toolbox factory ensure this action is only being included
// for BusinessKnowledgeModel definitions, next cast is safe.
final Node<View<? extends BusinessKnowledgeModel>, Edge> bkmNode = (Node<View<? extends BusinessKnowledgeModel>, Edge>) AbstractToolboxAction.getElement(canvasHandler, uuid).asNode();
final BusinessKnowledgeModel bkm = bkmNode.getContent().getDefinition();
editExpressionEvent.fire(new EditExpressionEvent(sessionManager.getCurrentSession(), uuid, bkm.getEncapsulatedLogic(), Optional.of(bkm)));
return this;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.
the class DMNEditDecisionToolboxAction method onMouseClick.
@Override
@SuppressWarnings("unchecked")
public ToolboxAction<AbstractCanvasHandler> onMouseClick(final AbstractCanvasHandler canvasHandler, final String uuid, final MouseClickEvent event) {
// Notice the toolbox factory ensure this action is only being included
// for Decision definitions, next cast is safe.
final Node<View<? extends Decision>, Edge> decisionNode = (Node<View<? extends Decision>, Edge>) AbstractToolboxAction.getElement(canvasHandler, uuid).asNode();
final Decision decision = decisionNode.getContent().getDefinition();
editExpressionEvent.fire(new EditExpressionEvent(sessionManager.getCurrentSession(), uuid, decision, Optional.of(decision)));
return this;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.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.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.
the class Bpmn2JsonUnmarshaller method applyBaseElementProperties.
protected void applyBaseElementProperties(BaseElement baseElement, Map<String, String> properties) {
if (properties.get("documentation") != null && !"".equals(properties.get("documentation"))) {
if (baseElement instanceof Definitions) {
this.processDocs = properties.get("documentation");
} else {
baseElement.getDocumentation().add(createDocumentation(wrapInCDATABlock(properties.get("documentation"))));
}
}
if (baseElement.getId() == null || baseElement.getId().length() < 1) {
baseElement.setId(properties.get("resourceId"));
}
if (properties.get("bgcolor") != null && properties.get("bgcolor").length() > 0) {
if (!(_elementColors.containsKey(baseElement.getId()))) {
List<String> colorsList = new ArrayList<String>();
colorsList.add("bgcolor:" + properties.get("bgcolor"));
_elementColors.put(baseElement.getId(), colorsList);
} else {
_elementColors.get(baseElement.getId()).add("bgcolor:" + properties.get("bgcolor"));
}
}
if (properties.get("isselectable") != null && properties.get("isselectable").length() > 0) {
ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature("http://www.jboss.org/drools", "selectable", false, false);
SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("isselectable"));
baseElement.getAnyAttribute().add(extensionEntry);
}
if (properties.get("bordercolor") != null && properties.get("bordercolor").length() > 0) {
if (!(_elementColors.containsKey(baseElement.getId()))) {
List<String> colorsList = new ArrayList<String>();
colorsList.add("bordercolor:" + properties.get("bordercolor"));
_elementColors.put(baseElement.getId(), colorsList);
} else {
_elementColors.get(baseElement.getId()).add("bordercolor:" + properties.get("bordercolor"));
}
}
if (properties.get("fontsize") != null && properties.get("fontsize").length() > 0) {
ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature("http://www.jboss.org/drools", "fontsize", false, false);
SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("fontsize"));
baseElement.getAnyAttribute().add(extensionEntry);
}
if (properties.get("fontcolor") != null && properties.get("fontcolor").length() > 0) {
if (!(_elementColors.containsKey(baseElement.getId()))) {
List<String> colorsList = new ArrayList<String>();
colorsList.add("fontcolor:" + properties.get("fontcolor"));
_elementColors.put(baseElement.getId(), colorsList);
} else {
_elementColors.get(baseElement.getId()).add("fontcolor:" + properties.get("fontcolor"));
}
}
}
Aggregations