Search in sources :

Example 61 with Process

use of org.eclipse.bpmn2.Process in project kie-wb-common by kiegroup.

the class BPMFinderServiceImpl method getModelForProcess.

@Override
public JBPMProcessModel getModelForProcess(final String processId, final Path path) {
    GenerationConfig<Optional<JBPMProcessModel>> operations = new GenerationConfig<>(Optional.empty());
    operations.setPredicate(definitions -> {
        if (definitions.isPresent()) {
            if (!operations.getValue().isPresent()) {
                Optional<Process> optional = Optional.of(bpmnFormModelGenerator.getProcess(definitions.get()));
                return optional.isPresent() && optional.get().getId().equals(processId);
            }
        }
        return false;
    });
    operations.setConsumer(processModel -> operations.setValue(Optional.ofNullable(processModel)));
    Path rootPath = moduleService.resolveModule(path).getRootPath();
    scannProcessesForType(rootPath, "bpmn2", operations);
    if (!operations.getValue().isPresent()) {
        scannProcessesForType(rootPath, "bpmn", operations);
    }
    return operations.getValue().orElse(null);
}
Also used : Path(org.uberfire.backend.vfs.Path) Optional(java.util.Optional) Process(org.eclipse.bpmn2.Process)

Example 62 with Process

use of org.eclipse.bpmn2.Process in project kie-wb-common by kiegroup.

the class BPMNFormModelGeneratorImpl method generateTaskFormModels.

@Override
public List<TaskFormModel> generateTaskFormModels(Definitions source, Path path) {
    Process process = getProcess(source);
    final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path));
    if (process != null) {
        ProcessTaskFormsGenerationResult result = readUserTaskFormVariables(process);
        return result.getAllTaskFormVariables().stream().filter(taskFormVariables -> {
            if (!taskFormVariables.isValid()) {
                logger.warn(generateErrorMessage(taskFormVariables));
                return false;
            }
            return true;
        }).map(taskFormVariables -> taskFormVariables.toFormModel(variable -> createModelProperty(variable, projectClassLoader))).collect(Collectors.toList());
    }
    return Collections.emptyList();
}
Also used : RootElement(org.eclipse.bpmn2.RootElement) FormalExpression(org.eclipse.bpmn2.FormalExpression) ItemDefinition(org.eclipse.bpmn2.ItemDefinition) ModuleClassLoaderHelper(org.kie.workbench.common.services.backend.project.ModuleClassLoaderHelper) LoggerFactory(org.slf4j.LoggerFactory) FieldReadOnlyEntry(org.kie.workbench.common.forms.model.impl.meta.entries.FieldReadOnlyEntry) StringUtils(org.apache.commons.lang3.StringUtils) Parser(org.jsoup.parser.Parser) Inject(javax.inject.Inject) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) FieldTypeEntry(org.kie.workbench.common.forms.model.impl.meta.entries.FieldTypeEntry) DataInput(org.eclipse.bpmn2.DataInput) FlowElementsContainer(org.eclipse.bpmn2.FlowElementsContainer) KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) DataOutput(org.eclipse.bpmn2.DataOutput) Path(org.uberfire.backend.vfs.Path) Definitions(org.eclipse.bpmn2.Definitions) Process(org.eclipse.bpmn2.Process) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) ModelProperty(org.kie.workbench.common.forms.model.ModelProperty) BPMNVariableUtils(org.kie.workbench.common.forms.jbpm.service.bpmn.util.BPMNVariableUtils) BusinessProcessFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel) Collectors(java.util.stream.Collectors) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel) List(java.util.List) Dependent(javax.enterprise.context.Dependent) Assignment(org.eclipse.bpmn2.Assignment) ModelPropertiesGenerator(org.kie.workbench.common.forms.service.backend.util.ModelPropertiesGenerator) Optional(java.util.Optional) FormModelPropertiesUtil(org.kie.workbench.common.forms.model.util.formModel.FormModelPropertiesUtil) Collections(java.util.Collections) BPMNFormModelGenerator(org.kie.workbench.common.forms.jbpm.server.service.BPMNFormModelGenerator) UserTask(org.eclipse.bpmn2.UserTask) TextAreaFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition) Process(org.eclipse.bpmn2.Process)

Example 63 with Process

use of org.eclipse.bpmn2.Process in project kie-wb-common by kiegroup.

the class SubProcessConverter method convertEmbeddedSubprocessNode.

private SubProcessPropertyWriter convertEmbeddedSubprocessNode(Node<View<EmbeddedSubprocess>, ?> n) {
    SubProcess process = bpmn2.createSubProcess();
    process.setId(n.getUUID());
    SubProcessPropertyWriter p = propertyWriterFactory.of(process);
    EmbeddedSubprocess definition = n.getContent().getDefinition();
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    p.setOnEntryAction(definition.getOnEntryAction());
    p.setOnExitAction(definition.getOnExitAction());
    p.setAsync(definition.getIsAsync().getValue());
    ProcessData processData = definition.getProcessData();
    p.setProcessVariables(processData.getProcessVariables());
    p.setSimulationSet(definition.getSimulationSet());
    p.setBounds(n.getContent().getBounds());
    return p;
}
Also used : SubProcess(org.eclipse.bpmn2.SubProcess) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) SubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SubProcessPropertyWriter) AdHocSubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)

Example 64 with Process

use of org.eclipse.bpmn2.Process in project kie-wb-common by kiegroup.

the class BPMNAnalyzer method read.

public BPMNProcess read(InputStream inputStream) {
    Definitions definitions = BPMN2Utils.getDefinitions(inputStream);
    Optional<Process> processOptional = findProcess(definitions);
    if (!processOptional.isPresent()) {
        throw new RuntimeException("Cannot find Process on definitions");
    }
    Process process = processOptional.get();
    BusinessProcessFormModel formModel = new BusinessProcessFormModel(process.getId(), process.getName(), new ArrayList<>());
    BPMNProcess bpmmProcess = new BPMNProcess(formModel);
    readContainerUserTasks(process, bpmmProcess::addTaskFormModel);
    return bpmmProcess;
}
Also used : Definitions(org.eclipse.bpmn2.Definitions) Process(org.eclipse.bpmn2.Process) BusinessProcessFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel)

Aggregations

Process (org.eclipse.bpmn2.Process)46 SubProcess (org.eclipse.bpmn2.SubProcess)33 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)31 RootElement (org.eclipse.bpmn2.RootElement)31 ArrayList (java.util.ArrayList)24 FlowElement (org.eclipse.bpmn2.FlowElement)19 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)15 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)15 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)14 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)14 List (java.util.List)13 Definitions (org.eclipse.bpmn2.Definitions)13 Entry (java.util.Map.Entry)12 ItemDefinition (org.eclipse.bpmn2.ItemDefinition)12 DataInput (org.eclipse.bpmn2.DataInput)11 DataObject (org.eclipse.bpmn2.DataObject)11 DataOutput (org.eclipse.bpmn2.DataOutput)11 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)11 Artifact (org.eclipse.bpmn2.Artifact)10 FlowElementsContainer (org.eclipse.bpmn2.FlowElementsContainer)10