@Test public void testEmailWorkItemDefinition() throws Exception { when(dataUriProvider.apply(eq("email.gif"))).thenReturn(ICON_DATA); String raw = loadStream(WID_EMAIL); Collection<WorkItemDefinition> workItemDefinitions = WorkItemDefinitionParser.parse(raw, w -> "uri", dataUriProvider); assertNotNull(workItemDefinitions); assertEquals(1, workItemDefinitions.size()); WorkItemDefinition workItemDefinition = workItemDefinitions.iterator().next(); assertNotNull(workItemDefinition); assertEquals("Email", workItemDefinition.getName()); assertEquals("Communication", workItemDefinition.getCategory()); assertEquals("Sending emails", workItemDefinition.getDescription()); assertEquals("Email", workItemDefinition.getDisplayName()); assertEquals("index.html", workItemDefinition.getDocumentation()); assertEquals("org.jbpm.process.workitem.email.EmailWorkItemHandler", workItemDefinition.getDefaultHandler()); assertEquals(ICON_DATA, workItemDefinition.getIconDefinition().getIconData()); assertEquals("|Body:String,From:String,Subject:String,To:String|", workItemDefinition.getParameters()); assertEquals("||", workItemDefinition.getResults()); }
public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); }
WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); } }
WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); }  }
WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); }  static Collection<WorkItemDefinition> parse(final String content,
                                                       final Function<WorkDefinitionImpl, String> uriProvider,
                                                       final Function<String, String> dataUriProvider); static WorkItemDefinition parse(final WorkDefinitionImpl workDefinition,
                                           final Function<WorkDefinitionImpl, String> uriProvider,
                                           final Function<String, String> dataUriProvider); static String buildDataURIFromURL(final String url); }
WorkItemDefinitionParser { public static Collection<WorkItemDefinition> parse(final String content, final Function<WorkDefinitionImpl, String> uriProvider, final Function<String, String> dataUriProvider) throws Exception { final Map<String, WorkDefinitionImpl> definitionMap = parseJBPMWorkItemDefinitions(content, dataUriProvider); return definitionMap.values().stream() .map(wid -> parse(wid, uriProvider, dataUriProvider)) .collect(Collectors.toList()); }  static Collection<WorkItemDefinition> parse(final String content,
                                                       final Function<WorkDefinitionImpl, String> uriProvider,
                                                       final Function<String, String> dataUriProvider); static WorkItemDefinition parse(final WorkDefinitionImpl workDefinition,
                                           final Function<WorkDefinitionImpl, String> uriProvider,
                                           final Function<String, String> dataUriProvider); static String buildDataURIFromURL(final String url); static final Map<Class<?>, Function<Object, String>> DATA_TYPE_FORMATTERS; static final String ENCODING; }