Search in sources :

Example 46 with PortableWorkDefinition

use of org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition in project drools-wb by kiegroup.

the class ActionWorkItemPluginTest method testFindWorkItemDefinition.

@Test
public void testFindWorkItemDefinition() {
    final PortableWorkDefinition workItem1 = getMock("workItem1");
    final PortableWorkDefinition workItem2 = getMock("workItem2");
    final HashSet<PortableWorkDefinition> fakeDefinitions = new HashSet<PortableWorkDefinition>() {

        {
            add(workItem1);
            add(workItem2);
        }
    };
    when(presenter.getWorkItemDefinitions()).thenReturn(fakeDefinitions);
    final PortableWorkDefinition workItem = plugin.findWorkItemDefinition("workItem1");
    assertEquals(workItem1, workItem);
}
Also used : PortableWorkDefinition(org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 47 with PortableWorkDefinition

use of org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition in project drools-wb by kiegroup.

the class ActionWorkItemSetFieldPluginTest method secondFakeWorkItem.

private ActionWorkItemCol52 secondFakeWorkItem() {
    final ActionWorkItemCol52 workItemCol52 = new ActionWorkItemCol52();
    final PortableWorkDefinition portableWorkDefinition = new PortableWorkDefinition();
    final PortableParameterDefinition portableFloatParameterDefinition = new PortableFloatParameterDefinition();
    portableFloatParameterDefinition.setName("FloatResult");
    portableWorkDefinition.setResults(Collections.singleton(portableFloatParameterDefinition));
    portableWorkDefinition.setName("FloatWorkItemName");
    portableWorkDefinition.setDisplayName("FloatWorkItemDisplayName");
    workItemCol52.setWorkItemDefinition(portableWorkDefinition);
    return workItemCol52;
}
Also used : PortableFloatParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableFloatParameterDefinition) ActionWorkItemCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52) PortableWorkDefinition(org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition) PortableParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableParameterDefinition)

Example 48 with PortableWorkDefinition

use of org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition in project drools-wb by kiegroup.

the class WorkItemsEditorServiceImpl method loadWorkItemDefinitions.

@Override
public Set<PortableWorkDefinition> loadWorkItemDefinitions(final Path path) {
    final Map<String, WorkDefinition> workDefinitions = new HashMap<String, WorkDefinition>();
    try {
        // Load WorkItemDefinitions from VFS
        final Path projectRoot = moduleService.resolveModule(path).getRootPath();
        workDefinitions.putAll(resourceWorkDefinitionsLoader.loadWorkDefinitions(projectRoot));
        // Load WorkItemDefinitions from ConfigurationService
        workDefinitions.putAll(configWorkDefinitionsLoader.loadWorkDefinitions());
        // Copy the Work Items into Structures suitable for GWT
        final Set<PortableWorkDefinition> workItems = new HashSet<PortableWorkDefinition>();
        for (Map.Entry<String, WorkDefinition> entry : workDefinitions.entrySet()) {
            final PortableWorkDefinition wid = new PortableWorkDefinition();
            final WorkDefinitionImpl wd = (WorkDefinitionImpl) entry.getValue();
            wid.setName(wd.getName());
            wid.setDisplayName(wd.getDisplayName());
            wid.setParameters(convertWorkItemParameters(entry.getValue().getParameters()));
            wid.setResults(convertWorkItemParameters(entry.getValue().getResults()));
            workItems.add(wid);
        }
        return workItems;
    } catch (Exception e) {
        throw ExceptionUtilities.handleException(e);
    }
}
Also used : Path(org.uberfire.backend.vfs.Path) WorkDefinitionImpl(org.jbpm.process.workitem.WorkDefinitionImpl) HashMap(java.util.HashMap) PortableWorkDefinition(org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition) WorkDefinition(org.jbpm.process.core.WorkDefinition) PortableWorkDefinition(org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition) Map(java.util.Map) HashMap(java.util.HashMap) FileAlreadyExistsException(org.uberfire.java.nio.file.FileAlreadyExistsException) HashSet(java.util.HashSet)

Aggregations

PortableWorkDefinition (org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition)48 Test (org.junit.Test)30 ActionWorkItemCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52)17 PortableStringParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableStringParameterDefinition)16 ActionExecuteWorkItem (org.drools.workbench.models.datamodel.rule.ActionExecuteWorkItem)14 PortableFloatParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableFloatParameterDefinition)14 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)13 PortableBooleanParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableBooleanParameterDefinition)13 ArrayList (java.util.ArrayList)11 PortableIntegerParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableIntegerParameterDefinition)11 HashSet (java.util.HashSet)7 HashMap (java.util.HashMap)6 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)6 CompositeFactPattern (org.drools.workbench.models.datamodel.rule.CompositeFactPattern)6 FactPattern (org.drools.workbench.models.datamodel.rule.FactPattern)6 FromAccumulateCompositeFactPattern (org.drools.workbench.models.datamodel.rule.FromAccumulateCompositeFactPattern)6 FromCollectCompositeFactPattern (org.drools.workbench.models.datamodel.rule.FromCollectCompositeFactPattern)6 FromCompositeFactPattern (org.drools.workbench.models.datamodel.rule.FromCompositeFactPattern)6 FromEntryPointFactPattern (org.drools.workbench.models.datamodel.rule.FromEntryPointFactPattern)6 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)6