Search in sources :

Example 1 with RuleLanguage

use of org.kie.workbench.common.stunner.bpmn.definition.property.task.RuleLanguage in project kie-wb-common by kiegroup.

the class TaskConverter method businessRuleTask.

private PropertyWriter businessRuleTask(Node<View<BusinessRuleTask>, ?> n) {
    org.eclipse.bpmn2.BusinessRuleTask task = bpmn2.createBusinessRuleTask();
    task.setId(n.getUUID());
    BusinessRuleTask definition = n.getContent().getDefinition();
    BusinessRuleTaskPropertyWriter p = propertyWriterFactory.of(task);
    TaskGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    BusinessRuleTaskExecutionSet executionSet = definition.getExecutionSet();
    p.setAsync(executionSet.getIsAsync().getValue());
    p.setOnEntryAction(executionSet.getOnEntryAction());
    p.setOnExitAction(executionSet.getOnExitAction());
    p.setAdHocAutostart(executionSet.getAdHocAutostart().getValue());
    p.setSlaDueDate(executionSet.getSlaDueDate().getValue());
    RuleLanguage ruleLanguage = executionSet.getRuleLanguage();
    p.setImplementation(ruleLanguage);
    if (ruleLanguage.getValue().equals(RuleLanguage.DRL)) {
        p.setRuleFlowGroup(executionSet.getRuleFlowGroup());
    } else if (ruleLanguage.getValue().equals(RuleLanguage.DMN)) {
        p.setNamespace(executionSet.getNamespace());
        p.setDecisionName(executionSet.getDecisionName());
        p.setDmnModelName(executionSet.getDmnModelName());
    }
    p.setAssignmentsInfo(definition.getDataIOSet().getAssignmentsinfo());
    p.setSimulationSet(definition.getSimulationSet());
    p.setMetaData(definition.getAdvancedData().getMetaDataAttributes());
    p.setAbsoluteBounds(n);
    return p;
}
Also used : RuleLanguage(org.kie.workbench.common.stunner.bpmn.definition.property.task.RuleLanguage) BusinessRuleTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.BusinessRuleTaskExecutionSet) BusinessRuleTask(org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask) TaskGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet) Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2) BusinessRuleTaskPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.BusinessRuleTaskPropertyWriter)

Example 2 with RuleLanguage

use of org.kie.workbench.common.stunner.bpmn.definition.property.task.RuleLanguage in project kie-wb-common by kiegroup.

the class RuleLanguageFilterProvider method provideFilters.

@Override
public Collection<FormElementFilter> provideFilters(String elementUUID, Object definition) {
    final BusinessRuleTask businessRuleTask = (BusinessRuleTask) definition;
    final RuleLanguage ruleLanguage = businessRuleTask.getExecutionSet().getRuleLanguage();
    final Predicate drlPredicate = t -> Objects.equals(ruleLanguage.getValue(), RuleLanguage.DRL);
    final Predicate dmnPredicate = t -> Objects.equals(ruleLanguage.getValue(), RuleLanguage.DMN);
    final FormElementFilter ruleFlowGroupFilter = new FormElementFilter(BusinessRuleTask.EXECUTION_SET + "." + BusinessRuleTaskExecutionSet.RULE_FLOW_GROUP, drlPredicate);
    final FormElementFilter namespaceFilter = new FormElementFilter(BusinessRuleTask.EXECUTION_SET + "." + BusinessRuleTaskExecutionSet.NAMESPACE, dmnPredicate);
    final FormElementFilter decisionNameFilter = new FormElementFilter(BusinessRuleTask.EXECUTION_SET + "." + BusinessRuleTaskExecutionSet.DECISON_NAME, dmnPredicate);
    final FormElementFilter dmnModelNameFilter = new FormElementFilter(BusinessRuleTask.EXECUTION_SET + "." + BusinessRuleTaskExecutionSet.DMN_MODEL_NAME, dmnPredicate);
    return Arrays.asList(ruleFlowGroupFilter, namespaceFilter, decisionNameFilter, dmnModelNameFilter);
}
Also used : Event(javax.enterprise.event.Event) Arrays(java.util.Arrays) StunnerFormElementFilterProvider(org.kie.workbench.common.stunner.forms.client.formFilters.StunnerFormElementFilterProvider) Predicate(java.util.function.Predicate) Collection(java.util.Collection) BusinessRuleTask(org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask) FormElementFilter(org.kie.workbench.common.forms.adf.engine.shared.FormElementFilter) Objects(java.util.Objects) Inject(javax.inject.Inject) RefreshFormPropertiesEvent(org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent) Dependent(javax.enterprise.context.Dependent) FormFieldChanged(org.kie.workbench.common.stunner.forms.client.event.FormFieldChanged) Observes(javax.enterprise.event.Observes) FieldChangeHandlerManager(org.kie.workbench.common.forms.processing.engine.handling.FieldChangeHandlerManager) RuleLanguage(org.kie.workbench.common.stunner.bpmn.definition.property.task.RuleLanguage) SessionManager(org.kie.workbench.common.stunner.core.client.api.SessionManager) BusinessRuleTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.BusinessRuleTaskExecutionSet) RuleLanguage(org.kie.workbench.common.stunner.bpmn.definition.property.task.RuleLanguage) BusinessRuleTask(org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask) FormElementFilter(org.kie.workbench.common.forms.adf.engine.shared.FormElementFilter) Predicate(java.util.function.Predicate)

Example 3 with RuleLanguage

use of org.kie.workbench.common.stunner.bpmn.definition.property.task.RuleLanguage in project kie-wb-common by kiegroup.

the class BaseTaskConverter method businessRuleTask.

private BpmnNode businessRuleTask(org.eclipse.bpmn2.BusinessRuleTask task) {
    Node<View<BusinessRuleTask>, Edge> node = factoryManager.newNode(task.getId(), BusinessRuleTask.class);
    BusinessRuleTask definition = node.getContent().getDefinition();
    BusinessRuleTaskPropertyReader p = propertyReaderFactory.of(task);
    definition.setGeneral(new TaskGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    definition.setDataIOSet(new DataIOSet(p.getAssignmentsInfo()));
    RuleLanguage ruleLanguage = new RuleLanguage(p.getImplementation());
    RuleFlowGroup ruleFlowGroup = null;
    Namespace namespace = null;
    DecisionName decisionName = null;
    DmnModelName dmnModelName = null;
    if (ruleLanguage.getValue().equals(RuleLanguage.DRL)) {
        ruleFlowGroup = new RuleFlowGroup(p.getRuleFlowGroup());
        namespace = new Namespace();
        decisionName = new DecisionName();
        dmnModelName = new DmnModelName();
    } else if (ruleLanguage.getValue().equals(RuleLanguage.DMN)) {
        ruleFlowGroup = new RuleFlowGroup();
        namespace = new Namespace(p.getNamespace());
        decisionName = new DecisionName(p.getDecisionName());
        dmnModelName = new DmnModelName(p.getDmnModelName());
    }
    definition.setExecutionSet(new BusinessRuleTaskExecutionSet(new RuleLanguage(p.getImplementation()), ruleFlowGroup, namespace, decisionName, dmnModelName, new OnEntryAction(p.getOnEntryAction()), new OnExitAction(p.getOnExitAction()), new IsAsync(p.isAsync()), new AdHocAutostart(p.isAdHocAutoStart()), new SLADueDate(p.getSlaDueDate())));
    definition.setSimulationSet(p.getSimulationSet());
    definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
    node.getContent().setBounds(p.getBounds());
    definition.setDimensionsSet(p.getRectangleDimensionsSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    definition.setFontSet(p.getFontSet());
    return BpmnNode.of(node, p);
}
Also used : RuleFlowGroup(org.kie.workbench.common.stunner.bpmn.definition.property.task.RuleFlowGroup) RuleLanguage(org.kie.workbench.common.stunner.bpmn.definition.property.task.RuleLanguage) BusinessRuleTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.BusinessRuleTaskExecutionSet) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) BusinessRuleTask(org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask) TaskGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet) OnExitAction(org.kie.workbench.common.stunner.bpmn.definition.property.task.OnExitAction) OnEntryAction(org.kie.workbench.common.stunner.bpmn.definition.property.task.OnEntryAction) AdHocAutostart(org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocAutostart) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Namespace(org.kie.workbench.common.stunner.bpmn.definition.property.task.Namespace) DmnModelName(org.kie.workbench.common.stunner.bpmn.definition.property.task.DmnModelName) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) DecisionName(org.kie.workbench.common.stunner.bpmn.definition.property.task.DecisionName) TaskName(org.kie.workbench.common.stunner.bpmn.definition.property.task.TaskName) DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) SLADueDate(org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate) DecisionName(org.kie.workbench.common.stunner.bpmn.definition.property.task.DecisionName) AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) BusinessRuleTaskPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.BusinessRuleTaskPropertyReader) DmnModelName(org.kie.workbench.common.stunner.bpmn.definition.property.task.DmnModelName) IsAsync(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync) Edge(org.kie.workbench.common.stunner.core.graph.Edge)

Aggregations

BusinessRuleTask (org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask)3 BusinessRuleTaskExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.task.BusinessRuleTaskExecutionSet)3 RuleLanguage (org.kie.workbench.common.stunner.bpmn.definition.property.task.RuleLanguage)3 TaskGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet)2 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Objects (java.util.Objects)1 Predicate (java.util.function.Predicate)1 Dependent (javax.enterprise.context.Dependent)1 Event (javax.enterprise.event.Event)1 Observes (javax.enterprise.event.Observes)1 Inject (javax.inject.Inject)1 FormElementFilter (org.kie.workbench.common.forms.adf.engine.shared.FormElementFilter)1 FieldChangeHandlerManager (org.kie.workbench.common.forms.processing.engine.handling.FieldChangeHandlerManager)1 Factories.bpmn2 (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2)1 BusinessRuleTaskPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.BusinessRuleTaskPropertyWriter)1 BusinessRuleTaskPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.BusinessRuleTaskPropertyReader)1 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)1 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)1 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)1