org.jbpm.process.workitem.WorkDefinitionImpl类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(21.3k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中org.jbpm.process.workitem.WorkDefinitionImpl类的一些代码示例,展示了WorkDefinitionImpl类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkDefinitionImpl类的具体详情如下:
包路径:org.jbpm.process.workitem.WorkDefinitionImpl
类名称:WorkDefinitionImpl

WorkDefinitionImpl介绍

暂无

代码示例

代码示例来源:origin: kiegroup/jbpm

for (Map<String, Object> workDefinitionMap : workDefinitionsMaps) {
  if (workDefinitionMap != null) {
    WorkDefinitionImpl workDefinition = new WorkDefinitionImpl();
    workDefinition.setName((String) workDefinitionMap.get("name"));
    workDefinition.setDisplayName((String) workDefinitionMap.get("displayName"));
    workDefinition.setIcon((String) workDefinitionMap.get("icon"));
    workDefinition.setCustomEditor((String) workDefinitionMap.get("customEditor"));
    workDefinition.setCategory((String) workDefinitionMap.get("category"));
    workDefinition.setPath((String) workDefinitionMap.get("path"));
    workDefinition.setFile((String) workDefinitionMap.get("file"));
    workDefinition.setDocumentation((String) workDefinitionMap.get("documentation"));
    Set<ParameterDefinition> parameters = new HashSet<ParameterDefinition>();
    Map<String, DataType> parameterMap = (Map<String, DataType>) workDefinitionMap.get("parameters");
    workDefinition.setParameters(parameters);
      workDefinition.setParameterValues( (Map<String, Object>) workDefinitionMap.get("parameterValues") );
    workDefinition.setResults(results);
    workDefinition.setDefaultHandler((String) workDefinitionMap.get("defaultHandler"));
      workDefinition.setDependencies(((List<String>) workDefinitionMap.get("dependencies")).toArray(new String[0]));
      workDefinition.setMavenDependencies(((List<String>) workDefinitionMap.get("mavenDependencies")).toArray(new String[0]));
      workDefinition.setVersion((String) workDefinitionMap.get("version"));
      workDefinition.setDescription((String) workDefinitionMap.get("description"));

代码示例来源:origin: kiegroup/jbpm

assertEquals("TestServiceOne", testServiceOne.getName());
assertEquals("TestServiceOne", testServiceOne.getDisplayName());
assertEquals("Test Service One", testServiceOne.getDescription());
assertEquals(3, testServiceOne.getParameters().size());
assertEquals("testserviceone.png", testServiceOne.getIcon());
assertEquals("MyTestServices", testServiceOne.getCategory());
assertEquals(0, testServiceOne.getDependencies().length);
assertEquals("MyTestServices", testServiceOne.getCategory());
assertEquals("mvel", testServiceOne.getWidType());
assertEquals(2, testServiceTwo.getResults().size());
assertTrue(testServiceTwo.getResult("result1").getType() instanceof StringDataType);
assertTrue(testServiceTwo.getResult("result2").getType() instanceof StringDataType);
assertEquals("mvel", testServiceTwo.getWidType());
assertEquals("1.0", testServiceThree.getVersion());
assertEquals("org.drools.eclipse.flow.common.editor.editpart.work.SampleCustomEditor", testServiceThree.getCustomEditor());
assertEquals("org.jbpm.process.workitem.MyHandler", testServiceThree.getDefaultHandler());
assertEquals(2, testServiceThree.getDependencies().length);
assertEquals(2, testServiceThree.getMavenDependencies().length);
assertEquals("mvel", testServiceThree.getWidType());
assertEquals("TestServiceFour", testServiceFour.getName());
assertEquals("TestServiceFour", testServiceFour.getDisplayName());
assertEquals("Test Service Four", testServiceFour.getDescription());
assertEquals(3, testServiceFour.getParameters().size());
assertEquals(0, testServiceFour.getResults().size());
assertEquals("1.0", testServiceFour.getVersion());
assertEquals(2, testServiceFour.getDependencies().length);

代码示例来源:origin: kiegroup/jbpm

@Test
public void testWorkDefinitionsPathAndFile() throws Exception {
  Map<String, WorkDefinitionImpl> repoResults = WorkItemRepository.getWorkDefinitions(getClass().getResource("repository").toURI().toString(),
                                            new String[]{"TestServiceOne"});
  assertNotNull(repoResults);
  assertFalse(repoResults.isEmpty());
  assertEquals(repoResults.size(), 1);
  assertNotNull(repoResults.get("TestServiceOne"));
  assertNotNull(repoResults.get("TestServiceOne").getPath());
  assertTrue(repoResults.get("TestServiceOne").getPath().endsWith("/repository/TestServiceOne"));
  assertNotNull(repoResults.get("TestServiceOne").getFile());
  assertTrue(repoResults.get("TestServiceOne").getFile().equals("TestServiceOne.wid"));
}

代码示例来源:origin: org.drools/drools-wb-workitems-editor-backend

final WorkDefinitionImpl workDefinition = new WorkDefinitionImpl();
workDefinition.setName((String) workDefinitionMap.get("name"));
workDefinition.setDisplayName((String) workDefinitionMap.get("displayName"));
workDefinition.setIcon((String) workDefinitionMap.get("icon"));
workDefinition.setCustomEditor((String) workDefinitionMap.get("customEditor"));
final Set<ParameterDefinition> parameters = new HashSet<ParameterDefinition>();
if (workDefinitionMap.get("parameters") != null) {
  workDefinition.setParameters(parameters);
  workDefinition.setParameterValues((Map<String, Object>) workDefinitionMap.get("parameterValues"));
  workDefinition.setResults(results);
  workDefinition.setDefaultHandler((String) workDefinitionMap.get("defaultHandler"));
  workDefinition.setDependencies(((List<String>) workDefinitionMap.get("dependencies")).toArray(new String[0]));
  workDefinition.setDocumentation((String) workDefinitionMap.get("documentation"));
  workDefinition.setVersion((String) workDefinitionMap.get("version"));
  workDefinition.setDescription((String) workDefinitionMap.get("description"));
  workDefinition.setMavenDependencies(((List<String>) workDefinitionMap.get("mavenDependencies")).toArray(new String[0]));
workDefinitions.put(workDefinition.getName(),
          workDefinition);

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-bpmn-backend

workItem.setName(workDefinition.getName());
workItem.setCategory(workDefinition.getCategory());
workItem.setDocumentation(workDefinition.getDocumentation());
workItem.setDescription(workDefinition.getDescription());
workItem.setDefaultHandler(workDefinition.getDefaultHandler());
workItem.setDisplayName(workDefinition.getDisplayName());
final String iconEncoded = workDefinition.getIconEncoded();
final String icon = workDefinition.getIcon();
String iconData = null;
if (null != iconEncoded && iconEncoded.trim().length() > 0) {
  iconData = iconEncoded;
} else if (null != icon && icon.trim().length() > 0) {
  final String iconUrl = workDefinition.getPath() + "/" + icon;
  iconData = dataUriProvider.apply(iconUrl);
workItem.setIconDefinition(iconDefinition);
workItem.setParameters(parseParameters(workDefinition.getParameters()));
workItem.setResults(parseParameters(workDefinition.getResults()));
final String[] dependencies = workDefinition.getMavenDependencies();
final List<Dependency> dependencyList = null == dependencies ?
    Collections.emptyList() :

代码示例来源:origin: org.kie.guvnor/guvnor-workitems-editor-backend

final WorkDefinitionImpl workDefinition = new WorkDefinitionImpl();
workDefinition.setName( (String) workDefinitionMap.get( "name" ) );
workDefinition.setDisplayName( (String) workDefinitionMap.get( "displayName" ) );
workDefinition.setIcon( (String) workDefinitionMap.get( "icon" ) );
workDefinition.setCustomEditor( (String) workDefinitionMap.get( "customEditor" ) );
final Set<ParameterDefinition> parameters = new HashSet<ParameterDefinition>();
if ( workDefinitionMap.get( "parameters" ) != null ) {
  workDefinition.setParameters( parameters );
  workDefinition.setResults( results );
  workDefinition.setDefaultHandler( (String) workDefinitionMap.get( "defaultHandler" ) );
  workDefinition.setDependencies( ( (List<String>) workDefinitionMap.get( "dependencies" ) ).toArray( new String[ 0 ] ) );
workDefinitions.put( workDefinition.getName(),
           workDefinition );

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-bpmn-backend

@Before
public void init() {
  when(jbpmWorkDefinition.getName()).thenReturn(NAME);
  when(jbpmWorkDefinition.getCategory()).thenReturn(CATWGORY);
  when(jbpmWorkDefinition.getDescription()).thenReturn(DESC);
  when(jbpmWorkDefinition.getDisplayName()).thenReturn(DISPLAY_NAME);
  when(jbpmWorkDefinition.getDocumentation()).thenReturn(DOC);
  when(jbpmWorkDefinition.getDefaultHandler()).thenReturn(HANDLER);
  when(jbpmWorkDefinition.getPath()).thenReturn(PATH);
  when(jbpmWorkDefinition.getIcon()).thenReturn(ICON);
  when(dataUriProvider.apply(eq(ICON_PATH))).thenReturn(ICON_DATA);
  when(param1.getName()).thenReturn("param1");
  when(param1.getType()).thenReturn(new StringDataType());
  when(param2.getName()).thenReturn("param2");
  when(param2.getType()).thenReturn(new StringDataType());
  Set<ParameterDefinition> parameters = new HashSet<ParameterDefinition>(2) {{
    add(param1);
    add(param2);
  }};
  when(jbpmWorkDefinition.getParameters()).thenReturn(parameters);
}

代码示例来源:origin: kiegroup/drools-wb

myTaskDef.getName());
assertNotNull(myTaskDef.getParameter("MyFirstParam"));
assertNotNull(myTaskDef.getParameter("MySecondParam"));
assertNotNull(myTaskDef.getParameter("MyThirdParam"));
assertNotNull(myTaskDef.getParameterValues());
assertEquals(2,
       myTaskDef.getParameterValues().size());
Map<String, Object> paramValues = myTaskDef.getParameterValues();
assertTrue(paramValues.containsKey("MyFirstParam"));
assertTrue(paramValues.containsKey("MySecondParam"));
assertNotNull(myTaskDef.getVersion());
assertEquals("1.0",
       myTaskDef.getVersion());
assertNotNull(myTaskDef.getDocumentation());
assertEquals("documentation for sample workitem",
       myTaskDef.getDocumentation());
assertNotNull(myTaskDef.getDescription());
assertEquals("this is a sample workitem",
       myTaskDef.getDescription());
assertNotNull(myTaskDef.getMavenDependencies());
assertEquals(1,
       myTaskDef.getMavenDependencies().length);
assertEquals("org.jboss:somemodule:3.2",
       myTaskDef.getMavenDependencies()[0]);

代码示例来源:origin: org.kie.guvnor/guvnor-workitems-editor-backend

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() ) );

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-bpmn-backend

final Function<String, String> dataUriProvider,
                             final String name) {
final WorkDefinitionImpl workDefinition = new WorkDefinitionImpl();
workDefinition.setName(name);
final String icon = workDefinition.getIcon();
if (nonEmpty(icon)) {
  final String iconData = dataUriProvider.apply(icon);
  workDefinition.setIcon(icon);
  workDefinition.setIconEncoded(iconData);
  workDefinition.setParameterValues(parameterValues);

代码示例来源:origin: org.jbpm/org.jbpm.eclipse

private void importWorkDefinition(WorkDefinitionImpl workDef, IFolder resources, IFolder metaInf, IFile workDefinitionsConfig) throws Exception {
  String defFile = workDef.getPath() + "/" + workDef.getFile();
  IFile file = metaInf.getFile(workDef.getFile());
  InputStream inputstream = new URL(defFile).openStream();
  if (!file.exists()) {
    file.setContents(inputstream, true, false, null);
  if (workDef.getIcon() != null) {
    String iconFile = workDef.getPath() + "/" + workDef.getIcon();
    IFile icon = resources.getFile(workDef.getIcon());
    inputstream = new URL(iconFile).openStream();
    if (!icon.exists()) {
    for (String s: ss) {
      if (!found && s.trim().startsWith("drools.workDefinitions")) {
        if (!s.contains(workDef.getFile())) {
          s += " " + workDef.getFile();
      output += EOL + "drools.workDefinitions = " + workDef.getFile(); 
  String[] dependencies = workDef.getDependencies();
  if (addLibraries.getSelection() && dependencies != null) {
    IFolder lib = project.getProject().getFolder("lib");
          inputstream = new URL(workDef.getPath() + "/" + dependency).openStream();
          if (!libFile.exists()) {
            libFile.create(inputstream, true, null);

代码示例来源:origin: org.jbpm/org.jbpm.eclipse

for (WorkDefinitionImpl workDef: ((Category) o).getWorkDefinitions()) {
  importWorkDefinition(workDef, folder, metaInf, workDefinitionsConfig);
  workDefs.put(workDef.getName(), workDef);
workDefs.put(((WorkDefinitionImpl) o).getName(), (WorkDefinitionImpl) o);
String content = "[";
for (WorkDefinitionImpl def: workDefs.values()) {
  if (def.getDefaultHandler() != null) {
    content += EOL + "  \"" + def.getName() + "\" : new "
      + def.getDefaultHandler().replaceFirst("[^()]+$", "$0()") + ",";
  if (def.getDefaultHandler() != null) {
    newContent += EOL + "  \"" + def.getName() + "\" : new "
        + def.getDefaultHandler().replaceFirst("[^()]+$", "$0()") + ",";

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-bpmn-backend

@Before
public void init() {
  wd1 = new WorkDefinitionImpl();
  wd1.setName(WD1_NAME);
  wd2 = new WorkDefinitionImpl();
  wd2.setName(WD2_NAME);
  when(lookupService.apply(eq(URL)))
      .thenReturn(new WorkItemsHolder(new HashMap<String, WorkDefinitionImpl>(2) {{
        put(WD1_NAME, wd1);
        put(WD2_NAME, wd2);
      }}));
  tested = new WorkItemDefinitionRemoteService(lookupService);
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-bpmn-backend

@SuppressWarnings("unchecked")
private static Map<String, WorkDefinitionImpl> parseJBPMWorkItemDefinitions(final String content,
                                      final Function<String, String> dataUriProvider) {
  final List<Map<String, Object>> workDefinitionsMaps = (List<Map<String, Object>>) WidMVELEvaluator.eval(content);
  final Map<String, WorkDefinitionImpl> result = new HashMap<>(workDefinitionsMaps.size());
  for (Map<String, Object> workDefinitionMap : workDefinitionsMaps) {
    if (workDefinitionMap != null) {
      String origWidName = ((String) workDefinitionMap.get("name")).replaceAll("\\s", "");
      Matcher widNameMatcher = UNICODE_WORDS_PATTERN.matcher(origWidName);
      if (widNameMatcher.matches()) {
        final WorkDefinitionImpl workDefinition = parseMVELWorkItemDefinition(workDefinitionMap,
                                           dataUriProvider,
                                           widNameMatcher.group());
        result.put(workDefinition.getName(),
              workDefinition);
      } else {
        LOG.error("The work item has an invalid name [ " +
                 workDefinitionMap.get("name") + "]." +
                 "It must contain words only, skipping it.");
      }
    }
  }
  return result;
}

代码示例来源:origin: org.jbpm/org.jbpm.eclipse

public void selectionChanged(SelectionChangedEvent event) {
    importButton.setEnabled(!event.getSelection().isEmpty());
    if (!event.getSelection().isEmpty()) {
      Object selected = ((StructuredSelection) event.getSelection()).getFirstElement();
      if (selected instanceof WorkDefinitionImpl) {
        String docs = ((WorkDefinitionImpl) selected).getDocumentation();
        if (docs != null) {
          if (documentation != null) {
            documentation.setUrl(((WorkDefinitionImpl) selected).getPath() + "/" + docs);
          }
        } else {
          if (documentation != null) {
            documentation.setText("");
          }
        }
      } else {
        if (documentation != null) {
          documentation.setText("");
        }
      }
    }
  }
});

代码示例来源:origin: org.jbpm/org.jbpm.eclipse

private void getWorkDefinitions() {
  Map<String, Category> categories = new HashMap<String, Category>();
  String url = urlText.getText();
  if (!url.startsWith("http") && !url.startsWith("file:")) {
    url = "file:///" + url;
  }
  Map<String, WorkDefinitionImpl> workDefinitions = 
    WorkItemRepository.getWorkDefinitions(url);
  for (WorkDefinitionImpl workDef: workDefinitions.values()) {
    String c = workDef.getCategory();
    if (c == null) {
      c = "Other";
    }
    Category category = categories.get(c);
    if (category == null) {
      category = new Category(c);
      categories.put(c, category);
    }
    category.addWorkDefinition(workDef);
  }
  treeViewer.setInput(categories.values());
}

代码示例来源:origin: kiegroup/drools-wb

final WorkDefinitionImpl workDefinition = new WorkDefinitionImpl();
workDefinition.setName((String) workDefinitionMap.get("name"));
workDefinition.setDisplayName((String) workDefinitionMap.get("displayName"));
workDefinition.setIcon((String) workDefinitionMap.get("icon"));
workDefinition.setCustomEditor((String) workDefinitionMap.get("customEditor"));
final Set<ParameterDefinition> parameters = new HashSet<ParameterDefinition>();
if (workDefinitionMap.get("parameters") != null) {
  workDefinition.setParameters(parameters);
  workDefinition.setParameterValues((Map<String, Object>) workDefinitionMap.get("parameterValues"));
  workDefinition.setResults(results);
  workDefinition.setDefaultHandler((String) workDefinitionMap.get("defaultHandler"));
  workDefinition.setDependencies(((List<String>) workDefinitionMap.get("dependencies")).toArray(new String[0]));
  workDefinition.setDocumentation((String) workDefinitionMap.get("documentation"));
  workDefinition.setVersion((String) workDefinitionMap.get("version"));
  workDefinition.setDescription((String) workDefinitionMap.get("description"));
  workDefinition.setMavenDependencies(((List<String>) workDefinitionMap.get("mavenDependencies")).toArray(new String[0]));
workDefinitions.put(workDefinition.getName(),
          workDefinition);

代码示例来源:origin: org.drools/drools-wb-workitems-editor-backend

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

代码示例来源:origin: org.jbpm/jbpm-flow-builder

for (Map<String, Object> workDefinitionMap : workDefinitionsMaps) {
  if (workDefinitionMap != null) {
    WorkDefinitionImpl workDefinition = new WorkDefinitionImpl();
    workDefinition.setName((String) workDefinitionMap.get("name"));
    workDefinition.setDisplayName((String) workDefinitionMap.get("displayName"));
    workDefinition.setIcon((String) workDefinitionMap.get("icon"));
    workDefinition.setCustomEditor((String) workDefinitionMap.get("customEditor"));
    workDefinition.setCategory((String) workDefinitionMap.get("category"));
    workDefinition.setPath((String) workDefinitionMap.get("path"));
    workDefinition.setFile((String) workDefinitionMap.get("file"));
    workDefinition.setDocumentation((String) workDefinitionMap.get("documentation"));
    Set<ParameterDefinition> parameters = new HashSet<ParameterDefinition>();
    Map<String, DataType> parameterMap = (Map<String, DataType>) workDefinitionMap.get("parameters");
    workDefinition.setParameters(parameters);
      workDefinition.setParameterValues( (Map<String, Object>) workDefinitionMap.get("parameterValues") );
    workDefinition.setResults(results);
    workDefinition.setDefaultHandler((String) workDefinitionMap.get("defaultHandler"));
      workDefinition.setDependencies(((List<String>) workDefinitionMap.get("dependencies")).toArray(new String[0]));
      workDefinition.setMavenDependencies(((List<String>) workDefinitionMap.get("mavenDependencies")).toArray(new String[0]));
      workDefinition.setVersion((String) workDefinitionMap.get("version"));
      workDefinition.setDescription((String) workDefinitionMap.get("description"));

代码示例来源:origin: kiegroup/drools-wb

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

相关文章