protected String getType(FormAuthorityRef ref) { FormAuthorityRef.Type type = ref.getType(); if (type.equals(FormAuthorityRef.Type.TASK)) { return "task"; } if (type.equals(FormAuthorityRef.Type.PROCESS)) { return "process"; } throw new IllegalArgumentException("Unknown form authority type: " + ref.getType()); }
public URL getDispatchUrl(FormAuthorityRef ref) { StringBuffer sb = new StringBuffer(); Properties properties = new Properties(); try { properties.load(AbstractFormDispatcher.class.getResourceAsStream("/jbpm.console.properties")); } catch (IOException e) { throw new RuntimeException("Could not load jbpm.console.properties", e); } sb.append("http://"); sb.append(properties.get("jbpm.console.server.host")); sb.append(":").append(new Integer(properties.getProperty("jbpm.console.server.port"))); sb.append("/gwt-console-server/rs/form/" + getType(ref) + "/"); sb.append(ref.getReferenceId()); sb.append("/render"); try { return new URL(sb.toString()); } catch (MalformedURLException e) { throw new RuntimeException("Failed to resolve form dispatch url", e); } }