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);
}
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;
}
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);
}
}
Aggregations