JBoss JBPM SVN: r3005 - jbpm3/trunk/hudson.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-20 02:13:02 -0500 (Thu, 20 Nov 2008)
New Revision: 3005
Modified:
jbpm3/trunk/hudson/ant.properties.example
Log:
update workspace, hudson.host
Modified: jbpm3/trunk/hudson/ant.properties.example
===================================================================
--- jbpm3/trunk/hudson/ant.properties.example 2008-11-20 07:08:25 UTC (rev 3004)
+++ jbpm3/trunk/hudson/ant.properties.example 2008-11-20 07:13:02 UTC (rev 3005)
@@ -20,8 +20,8 @@
hudson.maven.path=/usr/java/apache-maven-2.0.9
-hudson.root=/usr/share/java/workspace
-hudson.host=jbws.dyndns.org
+hudson.root=/home/hudson/workspace
+hudson.host=jbpm.dyndns.org
hudson.admin.port=8150
hudson.http.port=8180
17 years, 5 months
JBoss JBPM SVN: r3004 - jbpm3/trunk/hudson.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-20 02:08:25 -0500 (Thu, 20 Nov 2008)
New Revision: 3004
Modified:
jbpm3/trunk/hudson/build.xml
Log:
Fix hudson-update
Modified: jbpm3/trunk/hudson/build.xml
===================================================================
--- jbpm3/trunk/hudson/build.xml 2008-11-20 07:00:06 UTC (rev 3003)
+++ jbpm3/trunk/hudson/build.xml 2008-11-20 07:08:25 UTC (rev 3004)
@@ -116,8 +116,8 @@
<!--
Update the Hudson version
-->
- <target name="hudson-update" depends="init-hudson">
- <get src="${jboss.repository}/sun-hudson/${sun-hudson}/lib/hudson.war" dest="${thirdparty.dir}/hudson.war" usetimestamp="false" verbose="true"/>
+ <target name="hudson-update" depends="init-thirdparty">
+ <get src="https://hudson.dev.java.net/files/documents/${sun-hudson}/hudson.war" dest="${thirdparty.dir}/hudson.war" usetimestamp="false" verbose="true"/>
<delete dir="${hudson.tomcat}/webapps/hudson"/>
<copy todir="${hudson.tomcat}/webapps" file="${thirdparty.dir}/hudson.war"/>
</target>
17 years, 5 months
JBoss JBPM SVN: r3003 - jbpm3/trunk/hudson.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-20 02:00:06 -0500 (Thu, 20 Nov 2008)
New Revision: 3003
Modified:
jbpm3/trunk/hudson/ant.properties.example
Log:
Update to Hudson 1.262
Modified: jbpm3/trunk/hudson/ant.properties.example
===================================================================
--- jbpm3/trunk/hudson/ant.properties.example 2008-11-19 21:28:10 UTC (rev 3002)
+++ jbpm3/trunk/hudson/ant.properties.example 2008-11-20 07:00:06 UTC (rev 3003)
@@ -32,6 +32,6 @@
hudson.mail.recipients=
hudson.smtp.host=localhost
-# Hudson (1.252)
+# Hudson (1.262)
apache-tomcat=5.5.20
-sun-hudson=2402/109746
+sun-hudson=2402/117036
17 years, 5 months
JBoss JBPM SVN: r3002 - jbpm3/branches.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-19 16:28:10 -0500 (Wed, 19 Nov 2008)
New Revision: 3002
Added:
jbpm3/branches/tdiesler/
Log:
recreate userbranch
Copied: jbpm3/branches/tdiesler (from rev 3001, jbpm3/trunk)
17 years, 5 months
JBoss JBPM SVN: r3001 - jbpm3/branches.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-19 16:27:52 -0500 (Wed, 19 Nov 2008)
New Revision: 3001
Removed:
jbpm3/branches/tdiesler/
Log:
recreate userbranch
17 years, 5 months
JBoss JBPM SVN: r3000 - in jbpm3/trunk/modules/core/src: test/java/org/jbpm/mail and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-19 12:25:42 -0500 (Wed, 19 Nov 2008)
New Revision: 3000
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail/Mail.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/mail/MailTest.java
Log:
Use one mail server for all tests
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail/Mail.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail/Mail.java 2008-11-19 16:16:01 UTC (rev 2999)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail/Mail.java 2008-11-19 17:25:42 UTC (rev 3000)
@@ -209,14 +209,6 @@
System.out.println("Cannot send mail, now retrying: " + msgex);
log.error("Cannot send mail, now retrying: " + msgex);
Thread.sleep(1000);
-
- // Increment the smtp port
- String smtpPort = mailServerProperties.getProperty("mail.smtp.port");
- if (smtpPort != null)
- {
- Integer retryPort = new Integer(smtpPort) + 1;
- mailServerProperties.setProperty("mail.smtp.port", retryPort.toString());
- }
}
}
}
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/mail/MailTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/mail/MailTest.java 2008-11-19 16:16:01 UTC (rev 2999)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/mail/MailTest.java 2008-11-19 17:25:42 UTC (rev 3000)
@@ -3,6 +3,10 @@
import java.util.Arrays;
import java.util.Iterator;
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.AbstractJbpmTestCase;
@@ -20,20 +24,11 @@
{
private static Log log = LogFactory.getLog(MailTest.class);
- public static class TestAddressResolver implements AddressResolver
- {
- private static final long serialVersionUID = 1L;
+ private static final int SMTP_PORT = 23583;
- public Object resolveAddress(String actorId)
- {
- if ("ghost".equals(actorId))
- {
- return null;
- }
- return actorId + "@example.domain";
- }
- }
-
+ private static SimpleSmtpServer server;
+ JbpmContext jbpmContext;
+
static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
"<jbpm-configuration>" +
" <jbpm-context />" +
@@ -42,16 +37,34 @@
"</jbpm-configuration>"
);
- SimpleSmtpServer server = null;
- JbpmContext jbpmContext = null;
+ public static Test suite()
+ {
+ return new TestSetup(new TestSuite(MailTest.class))
+ {
+ protected void setUp() throws Exception
+ {
+ server = startSmtpServer(SMTP_PORT);
+ }
+ protected void tearDown() throws Exception
+ {
+ server.stop();
+ }
+ };
+ }
+
protected void setUp() throws Exception
{
super.setUp();
- server = startSmtpServer(23583);
jbpmContext = jbpmConfiguration.createJbpmContext();
}
+ protected void tearDown() throws Exception
+ {
+ jbpmContext.close();
+ super.tearDown();
+ }
+
static SimpleSmtpServer startSmtpServer(int port)
{
/*
@@ -83,21 +96,6 @@
return server;
}
- protected void tearDown() throws Exception
- {
- jbpmContext.close();
- try
- {
- server.stop();
- }
- catch (RuntimeException rte)
- {
- // This is an intermittent issue that we can safely ignore
- log.error("Cannot stop server: " + rte);
- }
- super.tearDown();
- }
-
public void testWithoutAddressResolving()
{
String to = "sample.shipper(a)example.domain";
@@ -110,6 +108,8 @@
assertTrue(server.getReceivedEmailSize() == 1);
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
assertEquals("latest news", email.getHeaderValue("Subject"));
assertEquals("roy is assurancetourix", email.getBody());
assertEquals("sample.shipper(a)example.domain", email.getHeaderValue("To"));
@@ -127,6 +127,8 @@
assertTrue(server.getReceivedEmailSize() == 1);
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
assertEquals("latest news", email.getHeaderValue("Subject"));
assertEquals("roy is assurancetourix", email.getBody());
assertEquals("manager(a)example.domain", email.getHeaderValue("To"));
@@ -143,10 +145,12 @@
assertEquals(1, server.getReceivedEmailSize());
Iterator emailIter = server.getReceivedEmail();
- SmtpMessage email1 = (SmtpMessage)emailIter.next();
- assertEquals("latest news", email1.getHeaderValue("Subject"));
- assertEquals("roy is assurancetourix", email1.getBody());
- assertNull(email1.getHeaderValue("To"));
+ SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
+ assertEquals("latest news", email.getHeaderValue("Subject"));
+ assertEquals("roy is assurancetourix", email.getBody());
+ assertNull(email.getHeaderValue("To"));
}
public void testMailNodeAttributes()
@@ -168,6 +172,8 @@
assertTrue(server.getReceivedEmailSize() == 1);
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
assertEquals("readmylips", email.getHeaderValue("Subject"));
assertEquals("nomoretaxes", email.getBody());
assertEquals("george(a)example.domain", email.getHeaderValue("To"));
@@ -194,6 +200,8 @@
assertTrue(server.getReceivedEmailSize() == 1);
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
assertEquals("readmylips", email.getHeaderValue("Subject"));
assertEquals("nomoretaxes", email.getBody());
assertEquals("george(a)example.domain", email.getHeaderValue("To"));
@@ -217,6 +225,8 @@
assertTrue(server.getReceivedEmailSize() == 1);
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
assertEquals("readmylips", email.getHeaderValue("Subject"));
assertEquals("nomoretaxes", email.getBody());
assertEquals("george(a)example.domain", email.getHeaderValue("To"));
@@ -244,6 +254,8 @@
assertTrue(server.getReceivedEmailSize() == 1);
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
assertEquals("readmylips", email.getHeaderValue("Subject"));
assertEquals("nomoretaxes", email.getBody());
assertEquals("george(a)example.domain", email.getHeaderValue("To"));
@@ -267,6 +279,8 @@
assertEquals(1, server.getReceivedEmailSize());
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
assertEquals("readmylips", email.getHeaderValue("Subject"));
assertEquals("nomoretaxes", email.getBody());
assertEquals(Arrays.asList(new String[] { "george(a)example.domain", "barbara(a)example.domain", "suzy(a)example.domain" }), Arrays.asList(email
@@ -291,24 +305,11 @@
assertEquals(1, server.getReceivedEmailSize());
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
assertEquals(Arrays.asList(new String[] { "george(a)humpydumpy.gov", "spiderman(a)hollywood.ca.us" }), Arrays.asList(email.getHeaderValues("To")));
}
- public static class User
- {
- String email;
-
- public User(String email)
- {
- this.email = email;
- }
-
- public String getEmail()
- {
- return email;
- }
- }
-
public void testToVariableExpression()
{
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
@@ -331,6 +332,8 @@
assertEquals(1, server.getReceivedEmailSize());
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
assertEquals("hucklebuck(a)example.domain", email.getHeaderValue("To"));
}
@@ -357,6 +360,8 @@
assertEquals(1, server.getReceivedEmailSize());
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
assertEquals("huckelberry(a)example.domain", email.getHeaderValue("To"));
}
@@ -380,6 +385,8 @@
assertEquals(1, server.getReceivedEmailSize());
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
assertEquals("your cookies order", email.getHeaderValue("Subject"));
}
@@ -403,6 +410,37 @@
assertEquals(1, server.getReceivedEmailSize());
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage)emailIter.next();
+ emailIter.remove();
+
assertEquals("your cookies order", email.getBody());
}
+
+ public static class User
+ {
+ String email;
+
+ public User(String email)
+ {
+ this.email = email;
+ }
+
+ public String getEmail()
+ {
+ return email;
+ }
+ }
+
+ public static class TestAddressResolver implements AddressResolver
+ {
+ private static final long serialVersionUID = 1L;
+
+ public Object resolveAddress(String actorId)
+ {
+ if ("ghost".equals(actorId))
+ {
+ return null;
+ }
+ return actorId + "@example.domain";
+ }
+ }
}
17 years, 5 months
JBoss JBPM SVN: r2999 - in jbpm3/trunk/modules: db and 2 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-19 11:16:01 -0500 (Wed, 19 Nov 2008)
New Revision: 2999
Added:
jbpm3/trunk/modules/db/src/main/resources/mysql.properties
jbpm3/trunk/modules/db/src/main/resources/sybase.properties
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/ant/AntHelper.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/ant/JbpmSchemaTask.java
jbpm3/trunk/modules/db/pom.xml
jbpm3/trunk/modules/db/scripts/antrun-jbpmschema.xml
Log:
Restore SchemaUpdate functionality
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/ant/AntHelper.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/ant/AntHelper.java 2008-11-19 13:05:33 UTC (rev 2998)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/ant/AntHelper.java 2008-11-19 16:16:01 UTC (rev 2999)
@@ -37,43 +37,60 @@
/**
* common strategy for jbpm ant tasks to obtain a hibernate SessionFactory.
*/
-public abstract class AntHelper {
-
+public abstract class AntHelper
+{
+
final static Map configurations = new HashMap();
final static Map jbpmConfigurations = new HashMap();
- public static Configuration getConfiguration(String hibernateCfgResource, String hibernatePropertiesResource) {
- Object key = getKey(hibernateCfgResource,hibernatePropertiesResource);
- Configuration configuration = (Configuration) configurations.get(key);
- if (configuration==null) {
- log.debug("creating hibernate configuration from cfg '"+hibernateCfgResource+"' and properties '"+hibernatePropertiesResource+"'");
+ public static Configuration getConfiguration(String hibernateCfgResource, String hibernatePropertiesResource)
+ {
+ Object key = getKey(hibernateCfgResource, hibernatePropertiesResource);
+ Configuration configuration = (Configuration)configurations.get(key);
+ if (configuration == null)
+ {
+ log.debug("creating hibernate configuration from cfg '" + hibernateCfgResource + "' and properties '" + hibernatePropertiesResource + "'");
configuration = new Configuration();
configuration.configure(hibernateCfgResource);
- if (hibernatePropertiesResource!=null) {
- try {
- InputStream propertiesInputStream = AntHelper.class.getClassLoader().getResourceAsStream(hibernatePropertiesResource);
- log.debug("properties input stream: "+propertiesInputStream);
+ if (hibernatePropertiesResource != null)
+ {
+ try
+ {
+ InputStream propertiesInputStream = AntHelper.class.getResourceAsStream(hibernatePropertiesResource);
+ if (propertiesInputStream == null)
+ throw new IllegalArgumentException("Cannot read properties: " + hibernatePropertiesResource);
+
Properties properties = new Properties();
properties.load(propertiesInputStream);
configuration.setProperties(properties);
- } catch (Exception e) {
- throw new JbpmException("couldn't set properties '"+hibernatePropertiesResource+"'", e);
}
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ throw new JbpmException("couldn't set properties '" + hibernatePropertiesResource + "'", ex);
+ }
}
configurations.put(key, configuration);
- } else {
- log.debug("got hibernate configuration from cfg '"+hibernateCfgResource+"' and properties '"+hibernatePropertiesResource+"' from the cache");
}
+ else
+ {
+ log.debug("got hibernate configuration from cfg '" + hibernateCfgResource + "' and properties '" + hibernatePropertiesResource + "' from the cache");
+ }
return configuration;
}
- public static JbpmConfiguration getJbpmConfiguration(String jbpmCfg) {
- JbpmConfiguration jbpmConfiguration = (JbpmConfiguration) jbpmConfigurations.get(jbpmCfg);
- if (jbpmConfiguration==null) {
- if (jbpmCfg==null) {
+ public static JbpmConfiguration getJbpmConfiguration(String jbpmCfg)
+ {
+ JbpmConfiguration jbpmConfiguration = (JbpmConfiguration)jbpmConfigurations.get(jbpmCfg);
+ if (jbpmConfiguration == null)
+ {
+ if (jbpmCfg == null)
+ {
jbpmConfiguration = JbpmConfiguration.getInstance();
- } else {
+ }
+ else
+ {
jbpmConfiguration = JbpmConfiguration.getInstance(jbpmCfg);
}
@@ -82,7 +99,8 @@
return jbpmConfiguration;
}
- static Object getKey(String cfg, String properties) {
+ static Object getKey(String cfg, String properties)
+ {
List key = new ArrayList();
key.add(cfg);
key.add(properties);
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/ant/JbpmSchemaTask.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/ant/JbpmSchemaTask.java 2008-11-19 13:05:33 UTC (rev 2998)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/ant/JbpmSchemaTask.java 2008-11-19 16:16:01 UTC (rev 2999)
@@ -21,31 +21,107 @@
*/
package org.jbpm.ant;
-import java.util.StringTokenizer;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.util.List;
+import java.util.Properties;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
+import org.hibernate.tool.hbm2ddl.SchemaUpdate;
+import org.hibernate.util.ConfigHelper;
public class JbpmSchemaTask extends Task
{
- String hibernateCfg;
+ String config;
+ String properties;
+ String action;
String output;
String delimiter;
- String action;
public void execute() throws BuildException
{
if (action == null)
action = "create";
- if (hibernateCfg == null)
- hibernateCfg = "hibernate.cfg.xml";
+ if (config == null)
+ config = "hibernate.cfg.xml";
- log("using hibernate configuration " + hibernateCfg);
- Configuration configuration = AntHelper.getConfiguration(hibernateCfg, null);
+ List<Exception> exceptions = null;
+ try
+ {
+ Configuration configuration = getConfiguration();
+ if ("drop".equalsIgnoreCase(action))
+ {
+ SchemaExport schemaExport = getSchemaExport(configuration);
+ schemaExport.execute(false, false, true, false);
+ exceptions = schemaExport.getExceptions();
+ }
+ else if ("create".equalsIgnoreCase(action))
+ {
+ SchemaExport schemaExport = getSchemaExport(configuration);
+ schemaExport.execute(false, false, false, true);
+ exceptions = schemaExport.getExceptions();
+ }
+ else if ("update".equalsIgnoreCase(action))
+ {
+ PrintStream sysout = System.out;
+ try
+ {
+ if (output != null)
+ {
+ PrintStream prstr = new PrintStream(new FileOutputStream(output));
+ System.setOut(prstr);
+ }
+ SchemaUpdate schemaUpdate = getSchemaUpdate(configuration);
+ schemaUpdate.execute(true, false);
+ exceptions = schemaUpdate.getExceptions();
+ }
+ finally
+ {
+ System.setOut(sysout);
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unsupported action: " + action);
+ }
+ }
+ catch (IOException ex)
+ {
+ throw new BuildException(ex);
+ }
+ // Print the exceptions if there are any
+ for (Exception ex : exceptions)
+ log(ex.toString());
+ }
+
+ private Configuration getConfiguration() throws IOException
+ {
+ log("Action '" + action + "' using " + config + "," + properties);
+ Configuration configuration = new Configuration();
+ configuration.configure(config);
+
+ if (properties != null)
+ {
+ InputStream inStream = ConfigHelper.getResourceAsStream(properties);
+ if (inStream == null)
+ throw new IllegalArgumentException("Cannot read properties: " + properties);
+
+ Properties properties = new Properties();
+ properties.load(inStream);
+ configuration.setProperties(properties);
+ }
+ return configuration;
+ }
+
+ private SchemaExport getSchemaExport(Configuration configuration)
+ {
SchemaExport schemaExport = new SchemaExport(configuration);
if (output != null)
@@ -55,15 +131,13 @@
schemaExport.setDelimiter(delimiter);
schemaExport.setFormat(false);
+ return schemaExport;
+ }
- if ("drop".equalsIgnoreCase(action))
- {
- schemaExport.execute(false, false, true, false);
- }
- else if ("create".equalsIgnoreCase(action))
- {
- schemaExport.execute(false, false, false, true);
- }
+ private SchemaUpdate getSchemaUpdate(Configuration configuration)
+ {
+ SchemaUpdate schemaUpdate = new SchemaUpdate(configuration);
+ return schemaUpdate;
}
public void setAction(String action)
@@ -71,11 +145,16 @@
this.action = action;
}
- public void setHibernateCfg(String hibernateCfg)
+ public void setConfig(String config)
{
- this.hibernateCfg = hibernateCfg;
+ this.config = config;
}
+ public void setProperties(String properties)
+ {
+ this.properties = properties;
+ }
+
public void setDelimiter(String delimiter)
{
this.delimiter = delimiter;
Modified: jbpm3/trunk/modules/db/pom.xml
===================================================================
--- jbpm3/trunk/modules/db/pom.xml 2008-11-19 13:05:33 UTC (rev 2998)
+++ jbpm3/trunk/modules/db/pom.xml 2008-11-19 16:16:01 UTC (rev 2999)
@@ -53,11 +53,22 @@
<classifier>config</classifier>
<version>${version}</version>
</dependency>
+
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.jtds</groupId>
+ <artifactId>jtds</artifactId>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
<!-- Plugins -->
@@ -75,7 +86,8 @@
<configuration>
<tasks>
<property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
- <ant antfile="scripts/antrun-jbpmschema.xml" target="jbpmschema" />
+ <ant antfile="scripts/antrun-jbpmschema.xml" target="create-schema" />
+ <ant antfile="scripts/antrun-jbpmschema.xml" target="update-schema" />
</tasks>
</configuration>
</execution>
Modified: jbpm3/trunk/modules/db/scripts/antrun-jbpmschema.xml
===================================================================
--- jbpm3/trunk/modules/db/scripts/antrun-jbpmschema.xml 2008-11-19 13:05:33 UTC (rev 2998)
+++ jbpm3/trunk/modules/db/scripts/antrun-jbpmschema.xml 2008-11-19 16:16:01 UTC (rev 2999)
@@ -14,36 +14,47 @@
<!-- jBPM Database schema -->
<!-- ================================================================== -->
- <target name="jbpmschema" description="Generate jBPM Database schemas">
+ <target name="setup-schema">
- <!--echo message="${maven.runtime.classpath}"/-->
+ <!-- echo message="${maven.runtime.classpath}"/ -->
<taskdef name="jbpmschema" classname="org.jbpm.ant.JbpmSchemaTask">
- <classpath path="${maven.runtime.classpath}" />
+ <classpath path="${maven.runtime.classpath}"/>
</taskdef>
- <property name="scriptsdir" value="${basedir}/target/classes" />
- <mkdir dir="${scriptsdir}" />
+ <property name="scriptsdir" value="${basedir}/target/classes"/>
+ <mkdir dir="${scriptsdir}"/>
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.db2.sql" hibernateCfg="hibernate.cfg.db2.xml" action="create" />
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.derby.sql" hibernateCfg="hibernate.cfg.derby.xml" action="create" />
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.firebird.sql" hibernateCfg="hibernate.cfg.firebird.xml" action="create" />
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.hsqldb.sql" hibernateCfg="hibernate.cfg.hsqldb.xml" action="create" />
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.ingres.sql" hibernateCfg="hibernate.cfg.ingres.xml" action="create" />
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.interbase.sql" hibernateCfg="hibernate.cfg.interbase.xml" action="create" />
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.mckoi.sql" hibernateCfg="hibernate.cfg.mckoi.xml" action="create" />
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.mssql.sql" hibernateCfg="hibernate.cfg.mssql.xml" action="create" />
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.mysql.sql" hibernateCfg="hibernate.cfg.mysql.xml" action="create" delimiter=";"/>
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.oracle.sql" hibernateCfg="hibernate.cfg.oracle.xml" delimiter=";" action="create" />
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.postgresql.sql" hibernateCfg="hibernate.cfg.postgresql.xml" action="create" />
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.sapdb.sql" hibernateCfg="hibernate.cfg.sapdb.xml" action="create" />
- <jbpmschema output="${scriptsdir}/jbpm.jpdl.sybase.sql" hibernateCfg="hibernate.cfg.sybase.xml" action="create" />
-
- <!--[JBPM-1813] Fix create schema generation -->
- <!--jbpmschema output="${scriptsdir}/jbpm.jpdl.informix.sql" hibernateCfg="hibernate.cfg.informix.xml" action="create"/-->
- <!--jbpmschema output="${scriptsdir}/jbpm.jpdl.pointbase.sql" hibernateCfg="hibernate.cfg.pointbase.xml" action="create"/-->
- <!--jbpmschema output="${scriptsdir}/jbpm.jpdl.progress.sql" hibernateCfg="hibernate.cfg.progress.xml" action="create"/-->
-
</target>
+ <target name="create-schema" depends="setup-schema" description="Generate jBPM Database Schemas">
+
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.db2.sql" config="hibernate.cfg.db2.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.derby.sql" config="hibernate.cfg.derby.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.firebird.sql" config="hibernate.cfg.firebird.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.hsqldb.sql" config="hibernate.cfg.hsqldb.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.ingres.sql" config="hibernate.cfg.ingres.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.interbase.sql" config="hibernate.cfg.interbase.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.mckoi.sql" config="hibernate.cfg.mckoi.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.mssql.sql" config="hibernate.cfg.mssql.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.mysql.sql" config="hibernate.cfg.mysql.xml" action="create" delimiter=";"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.oracle.sql" config="hibernate.cfg.oracle.xml" action="create" delimiter=";"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.postgresql.sql" config="hibernate.cfg.postgresql.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.sapdb.sql" config="hibernate.cfg.sapdb.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.sybase.sql" config="hibernate.cfg.sybase.xml" action="create"/>
+
+ <!--[JBPM-1813] Fix create schema generation -->
+ <!--jbpmschema output="${scriptsdir}/jbpm.jpdl.informix.sql" config="hibernate.cfg.informix.xml" action="create"/-->
+ <!--jbpmschema output="${scriptsdir}/jbpm.jpdl.pointbase.sql" config="hibernate.cfg.pointbase.xml" action="create"/-->
+ <!--jbpmschema output="${scriptsdir}/jbpm.jpdl.progress.sql" config="hibernate.cfg.progress.xml" action="create"/-->
+
+ </target>
+
+ <target name="update-schema" depends="setup-schema" description="Generate jBPM Database Update Scripts">
+
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.mysql.update322.sql" config="hibernate.cfg.mysql.xml" properties="mysql.properties" action="update" delimiter=";"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.sybase.update322.sql" config="hibernate.cfg.sybase.xml" properties="sybase.properties" action="update" delimiter=";"/>
+
+ </target>
+
</project>
Added: jbpm3/trunk/modules/db/src/main/resources/mysql.properties
===================================================================
--- jbpm3/trunk/modules/db/src/main/resources/mysql.properties (rev 0)
+++ jbpm3/trunk/modules/db/src/main/resources/mysql.properties 2008-11-19 16:16:01 UTC (rev 2999)
@@ -0,0 +1,6 @@
+hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
+hibernate.connection.driver_class=com.mysql.jdbc.Driver
+hibernate.connection.url=jdbc:mysql://localhost:3306/jbpm322
+hibernate.connection.username=jbpmtest
+hibernate.connection.password=
+hibernate.query.substitutions=true 1, false 0
\ No newline at end of file
Added: jbpm3/trunk/modules/db/src/main/resources/sybase.properties
===================================================================
--- jbpm3/trunk/modules/db/src/main/resources/sybase.properties (rev 0)
+++ jbpm3/trunk/modules/db/src/main/resources/sybase.properties 2008-11-19 16:16:01 UTC (rev 2999)
@@ -0,0 +1,5 @@
+hibernate.dialect=org.hibernate.dialect.SybaseDialect
+hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver
+hibernate.connection.url=jdbc:jtds:sybase://localhost:5000/jbpm322
+hibernate.connection.username=jbpmtest
+hibernate.connection.password=jbpmtest
17 years, 5 months
JBoss JBPM SVN: r2998 - in projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client: widgets and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-19 08:05:33 -0500 (Wed, 19 Nov 2008)
New Revision: 2998
Added:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenForm.java
Removed:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java
Modified:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
Log:
Move token editor and form to process package
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-11-19 13:05:19 UTC (rev 2997)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-11-19 13:05:33 UTC (rev 2998)
@@ -24,7 +24,6 @@
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.http.client.*;
import com.gwtext.client.core.EventObject;
-import com.gwtext.client.core.Position;
import com.gwtext.client.data.Record;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.PaddedPanel;
Copied: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenEditor.java (from rev 2996, projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java)
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenEditor.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenEditor.java 2008-11-19 13:05:33 UTC (rev 2998)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.process;
+
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.data.Node;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.layout.ColumnLayout;
+import com.gwtext.client.widgets.layout.ColumnLayoutData;
+import com.gwtext.client.widgets.tree.TreeNode;
+import com.gwtext.client.widgets.tree.TreePanel;
+import com.gwtext.client.widgets.tree.event.TreeNodeListenerAdapter;
+import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class TokenEditor extends Panel
+{
+
+ private TokenForm tokenForm;
+ private TokenTree tokenTree;
+
+ public TokenEditor(final ProcessInstance instance, final SignalCallback callback)
+ {
+ super();
+
+ this.setHeader(false);
+ this.setBorder(false);
+ this.setFrame(false);
+
+ this.setLayout(new ColumnLayout());
+
+ // ----------------
+
+ tokenTree = new TokenTree(instance.getRootToken(),
+ new TokenSelectionCallback()
+ {
+ public void onSelectedToken(TokenReference tok)
+ {
+ // update form
+ tokenForm.display(instance, tok);
+ }
+ }
+ );
+
+ tokenTree.expandAll();
+
+ // ----------------
+
+ tokenForm = new TokenForm(callback);
+
+ // ----------------
+
+ this.add(tokenTree, new ColumnLayoutData(0.3));
+ this.add(tokenForm, new ColumnLayoutData(0.7));
+ }
+
+ public void resetEditor()
+ {
+ tokenForm.resetForm();
+ }
+
+ class TokenTree extends TreePanel
+ {
+ private TokenSelectionCallback callback;
+
+ public TokenTree(final TokenReference rootToken,
+ final TokenSelectionCallback callback)
+ {
+ this.callback = callback;
+
+ this.setBorder(false);
+
+ TreeNode outermost = new TreeNode("Tokens");
+ TreeNode rootNode = buildTreeNode(rootToken);
+ outermost.appendChild(rootNode);
+
+ buildChildNodes(rootNode, rootToken);
+
+ setRootVisible(true);
+ setRootNode(outermost);
+ outermost.setExpanded(true);
+ }
+
+ private void buildChildNodes(TreeNode parent, TokenReference rootToken)
+ {
+ for(final TokenReference childToken : rootToken.getChildren())
+ {
+ TreeNode child = buildTreeNode(childToken);
+ buildChildNodes(child, childToken); // recursive
+ parent.appendChild(child);
+ }
+ }
+
+ private TreeNode buildTreeNode(final TokenReference tok)
+ {
+ TreeNode treeNode = new TreeNode("Token " +tok.getId());
+ treeNode.setExpanded(true);
+ treeNode.addListener(
+ new TreeNodeListenerAdapter()
+ {
+ public void onClick(Node node, EventObject eventObject)
+ {
+ callback.onSelectedToken(tok);
+ }
+ }
+ );
+
+ if(!tok.canBeSignaled())
+ treeNode.setIcon("images/icons/lock.png");
+ return treeNode;
+ }
+ }
+
+ interface TokenSelectionCallback
+ {
+ void onSelectedToken(TokenReference tok);
+ }
+
+ public interface SignalCallback
+ {
+ void onSignalToken(TokenReference tok, String signal);
+ }
+}
+
Copied: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenForm.java (from rev 2996, projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java)
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenForm.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenForm.java 2008-11-19 13:05:33 UTC (rev 2998)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.process;
+
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.core.Position;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.MessageBox;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.form.ComboBox;
+import com.gwtext.client.widgets.form.Form;
+import com.gwtext.client.widgets.form.FormPanel;
+import com.gwtext.client.widgets.form.TextField;
+import org.jboss.bpm.console.client.UIConstants;
+import org.jboss.bpm.console.client.widgets.RefreshableComboBox;
+import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class TokenForm extends Panel
+{
+ private final FormPanel tokenForm;
+ private final Button signalButton;
+ private TokenReference lastSelectedToken;
+
+ public TokenForm(final TokenEditor.SignalCallback callback)
+ {
+ super();
+
+ this.setHeader(false);
+ this.setBorder(false);
+ this.setFrame(false);
+
+ tokenForm = new FormPanel();
+ tokenForm.setLabelAlign(Position.LEFT);
+ tokenForm.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
+ tokenForm.setHeader(false);
+ tokenForm.setFrame(false);
+ tokenForm.setBorder(false);
+ tokenForm.setPaddings(5, 5, 5, 0);
+ tokenForm.setLabelWidth(50);
+
+ // ----------
+
+ TextField idField = new TextField("Id", "id", 230);
+ idField.setReadOnly(true);
+ tokenForm.add(idField);
+
+ //tokenForm.add(new TextField("Token Name", "name", 230));
+ TextField nameField = new TextField("Node Name", "nodeName", 230);
+ nameField.setReadOnly(true);
+ tokenForm.add(nameField);
+
+
+ // ----------
+ RefreshableComboBox cb = new RefreshableComboBox("signal", "Signal");
+ tokenForm.add(cb);
+
+ final ButtonListenerAdapter listenerAdapter = new ButtonListenerAdapter()
+ {
+ public void onClick(Button button, EventObject eventObject)
+ {
+ ComboBox cb = (ComboBox)tokenForm.getForm().findField("signal");
+
+ String signalValue = cb.getValueAsString();
+ if(signalValue.equals(""))
+ MessageBox.alert("Please select a signal");
+ else
+ callback.onSignalToken(lastSelectedToken, signalValue);
+ }
+
+ };
+ signalButton = new Button("Signal", listenerAdapter);
+
+
+ tokenForm.addButton(signalButton);
+
+ // -------------------
+
+ this.add(tokenForm);
+
+ }
+
+ /**
+ * display the root token
+ */
+ void display(ProcessInstance processInstance)
+ {
+ display(processInstance, processInstance.getRootToken());
+ }
+
+ /**
+ * display a particular token
+ */
+ void display(final ProcessInstance processInstance, final TokenReference tok)
+ {
+ Form form = tokenForm.getForm();
+
+ if(form.findField("id")!=null) // TODO: the fields are not initialized on first callback?
+ {
+ form.findField("id").setRawValue(tok.getId()+"");
+ form.findField("nodeName").setRawValue(tok.getCurrentNodeName());
+
+ // display combo box
+ RefreshableComboBox cb = (RefreshableComboBox)form.findField("signal");
+ cb.reset();
+ cb.display( tok.getAvailableSignals());
+
+ // suspended instances cannot be signaled
+ if(processInstance.isSuspended() || !tok.canBeSignaled())
+ {
+ signalButton.disable();
+ cb.disable();
+ }
+ else
+ {
+ signalButton.enable();
+ cb.enable();
+ }
+ }
+
+ // -----------
+
+
+ lastSelectedToken = tok;
+ }
+
+ public void resetForm()
+ {
+ tokenForm.getForm().reset();
+ }
+}
Deleted: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java 2008-11-19 13:05:19 UTC (rev 2997)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java 2008-11-19 13:05:33 UTC (rev 2998)
@@ -1,146 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.client.widgets;
-
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.data.Node;
-import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.layout.ColumnLayout;
-import com.gwtext.client.widgets.layout.ColumnLayoutData;
-import com.gwtext.client.widgets.tree.TreeNode;
-import com.gwtext.client.widgets.tree.TreePanel;
-import com.gwtext.client.widgets.tree.event.TreeNodeListenerAdapter;
-import org.jboss.bpm.console.client.model.ProcessInstance;
-import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class TokenEditor extends Panel
-{
-
- private TokenForm tokenForm;
- private TokenTree tokenTree;
-
- public TokenEditor(final ProcessInstance instance, final SignalCallback callback)
- {
- super();
-
- this.setHeader(false);
- this.setBorder(false);
- this.setFrame(false);
-
- this.setLayout(new ColumnLayout());
-
- // ----------------
-
- tokenTree = new TokenTree(instance.getRootToken(),
- new TokenSelectionCallback()
- {
- public void onSelectedToken(TokenReference tok)
- {
- // update form
- tokenForm.display(instance, tok);
- }
- }
- );
-
- tokenTree.expandAll();
-
- // ----------------
-
- tokenForm = new TokenForm(callback);
-
- // ----------------
-
- this.add(tokenTree, new ColumnLayoutData(0.3));
- this.add(tokenForm, new ColumnLayoutData(0.7));
- }
-
- public void resetEditor()
- {
- tokenForm.resetForm();
- }
-
- class TokenTree extends TreePanel
- {
- private TokenSelectionCallback callback;
-
- public TokenTree(final TokenReference rootToken,
- final TokenSelectionCallback callback)
- {
- this.callback = callback;
-
- this.setBorder(false);
-
- TreeNode outermost = new TreeNode("Tokens");
- TreeNode rootNode = buildTreeNode(rootToken);
- outermost.appendChild(rootNode);
-
- buildChildNodes(rootNode, rootToken);
-
- setRootVisible(true);
- setRootNode(outermost);
- outermost.setExpanded(true);
- }
-
- private void buildChildNodes(TreeNode parent, TokenReference rootToken)
- {
- for(final TokenReference childToken : rootToken.getChildren())
- {
- TreeNode child = buildTreeNode(childToken);
- buildChildNodes(child, childToken); // recursive
- parent.appendChild(child);
- }
- }
-
- private TreeNode buildTreeNode(final TokenReference tok)
- {
- TreeNode treeNode = new TreeNode("Token " +tok.getId());
- treeNode.setExpanded(true);
- treeNode.addListener(
- new TreeNodeListenerAdapter()
- {
- public void onClick(Node node, EventObject eventObject)
- {
- callback.onSelectedToken(tok);
- }
- }
- );
-
- if(!tok.canBeSignaled())
- treeNode.setIcon("images/icons/lock.png");
- return treeNode;
- }
- }
-
- interface TokenSelectionCallback
- {
- void onSelectedToken(TokenReference tok);
- }
-
- public interface SignalCallback
- {
- void onSignalToken(TokenReference tok, String signal);
- }
-}
-
Deleted: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java 2008-11-19 13:05:19 UTC (rev 2997)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java 2008-11-19 13:05:33 UTC (rev 2998)
@@ -1,153 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.client.widgets;
-
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.core.Position;
-import com.gwtext.client.widgets.Button;
-import com.gwtext.client.widgets.MessageBox;
-import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-import com.gwtext.client.widgets.form.ComboBox;
-import com.gwtext.client.widgets.form.Form;
-import com.gwtext.client.widgets.form.FormPanel;
-import com.gwtext.client.widgets.form.TextField;
-import org.jboss.bpm.console.client.UIConstants;
-import org.jboss.bpm.console.client.model.ProcessInstance;
-import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class TokenForm extends Panel
-{
- private final FormPanel tokenForm;
- private final Button signalButton;
- private TokenReference lastSelectedToken;
-
- public TokenForm(final TokenEditor.SignalCallback callback)
- {
- super();
-
- this.setHeader(false);
- this.setBorder(false);
- this.setFrame(false);
-
- tokenForm = new FormPanel();
- tokenForm.setLabelAlign(Position.LEFT);
- tokenForm.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
- tokenForm.setHeader(false);
- tokenForm.setFrame(false);
- tokenForm.setBorder(false);
- tokenForm.setPaddings(5, 5, 5, 0);
- tokenForm.setLabelWidth(50);
-
- // ----------
-
- TextField idField = new TextField("Id", "id", 230);
- idField.setReadOnly(true);
- tokenForm.add(idField);
-
- //tokenForm.add(new TextField("Token Name", "name", 230));
- TextField nameField = new TextField("Node Name", "nodeName", 230);
- nameField.setReadOnly(true);
- tokenForm.add(nameField);
-
-
- // ----------
- RefreshableComboBox cb = new RefreshableComboBox("signal", "Signal");
- tokenForm.add(cb);
-
- final ButtonListenerAdapter listenerAdapter = new ButtonListenerAdapter()
- {
- public void onClick(Button button, EventObject eventObject)
- {
- ComboBox cb = (ComboBox)tokenForm.getForm().findField("signal");
-
- String signalValue = cb.getValueAsString();
- if(signalValue.equals(""))
- MessageBox.alert("Please select a signal");
- else
- callback.onSignalToken(lastSelectedToken, signalValue);
- }
-
- };
- signalButton = new Button("Signal", listenerAdapter);
-
-
- tokenForm.addButton(signalButton);
-
- // -------------------
-
- this.add(tokenForm);
-
- }
-
- /**
- * display the root token
- */
- void display(ProcessInstance processInstance)
- {
- display(processInstance, processInstance.getRootToken());
- }
-
- /**
- * display a particular token
- */
- void display(final ProcessInstance processInstance, final TokenReference tok)
- {
- Form form = tokenForm.getForm();
-
- if(form.findField("id")!=null) // TODO: the fields are not initialized on first callback?
- {
- form.findField("id").setRawValue(tok.getId()+"");
- form.findField("nodeName").setRawValue(tok.getCurrentNodeName());
-
- // display combo box
- RefreshableComboBox cb = (RefreshableComboBox)form.findField("signal");
- cb.reset();
- cb.display( tok.getAvailableSignals());
-
- // suspended instances cannot be signaled
- if(processInstance.isSuspended() || !tok.canBeSignaled())
- {
- signalButton.disable();
- cb.disable();
- }
- else
- {
- signalButton.enable();
- cb.enable();
- }
- }
-
- // -----------
-
-
- lastSelectedToken = tok;
- }
-
- public void resetForm()
- {
- tokenForm.getForm().reset();
- }
-}
17 years, 5 months
JBoss JBPM SVN: r2997 - jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-19 08:05:19 -0500 (Wed, 19 Nov 2008)
New Revision: 2997
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail/Mail.java
Log:
Increment the smtp port on retry
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail/Mail.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail/Mail.java 2008-11-19 13:04:27 UTC (rev 2996)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail/Mail.java 2008-11-19 13:05:19 UTC (rev 2997)
@@ -206,8 +206,17 @@
if (retries == 0)
throw msgex;
+ System.out.println("Cannot send mail, now retrying: " + msgex);
log.error("Cannot send mail, now retrying: " + msgex);
Thread.sleep(1000);
+
+ // Increment the smtp port
+ String smtpPort = mailServerProperties.getProperty("mail.smtp.port");
+ if (smtpPort != null)
+ {
+ Integer retryPort = new Integer(smtpPort) + 1;
+ mailServerProperties.setProperty("mail.smtp.port", retryPort.toString());
+ }
}
}
}
17 years, 5 months
JBoss JBPM SVN: r2996 - in projects/gwt-console/trunk: server/src/main/java/org/jboss/bpm/console/server/dao and 9 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-19 08:04:27 -0500 (Wed, 19 Nov 2008)
New Revision: 2996
Added:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/InvocationProxy.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/JBPM3Extension.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ManagementFactory.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/UserManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementExtension.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementFactory.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3UserManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetGroupMembershipCommand.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetUsersForGroupCommand.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/BufferedResponseWrapper.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/FilterServletOutputStream.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/GWTJsonFilter.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentCallback.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/DetailsFormPanel.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/FormWidgets.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelChangeListener.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelListenerRegistry.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RefreshableComboBox.java
Removed:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/BufferedResponseWrapper.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/FilterServletOutputStream.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/GWTJsonFilter.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOProxy.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ExtensionDAO.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessDAO.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskDAO.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DAOFactory.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ExtensionDAO.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessDAO.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskDAO.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetGroupMemershipCommand.java
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3CommandDelegate.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3FormParser.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/Transform.java
projects/gwt-console/trunk/server/src/main/webapp/WEB-INF/web.xml
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/UIConstants.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java
Log:
Refactor TaskManagement to support model listener. Change DAO interfaces to Management interfaces
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/BufferedResponseWrapper.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/BufferedResponseWrapper.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/BufferedResponseWrapper.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server;
-
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintWriter;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@SuppressWarnings("deprecation")
-public class BufferedResponseWrapper extends HttpServletResponseWrapper
-{
- private ByteArrayOutputStream output;
- private int contentLength;
- private String contentType = "";
-
- public BufferedResponseWrapper(HttpServletResponse httpServletResponse)
- {
- super(httpServletResponse);
- output=new ByteArrayOutputStream();
- }
-
- public byte[] getData() {
- return output.toByteArray();
- }
-
- public ServletOutputStream getOutputStream() {
- return new FilterServletOutputStream(output);
- }
-
- public PrintWriter getWriter() {
- return new PrintWriter(getOutputStream(),true);
- }
-
- public void setContentLength(int length) {
- this.contentLength = length;
- super.setContentLength(length);
- }
-
- public int getContentLength() {
- return contentLength;
- }
-
- public void setContentType(String type) {
- this.contentType = type;
- super.setContentType(type);
- }
-
- public String getContentType() {
- return contentType;
- }
-}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -21,7 +21,7 @@
*/
package org.jboss.bpm.console.server;
-import org.jboss.bpm.console.server.JBPM3Management;
+import org.jboss.bpm.console.server.JBPM3MgmtFacade;
import javax.ws.rs.core.Application;
import java.util.HashSet;
@@ -36,10 +36,10 @@
public ConsoleServerApplication()
{
- singletons.add(new ProcessManagement());
- singletons.add(new TaskManagement());
- singletons.add(new UserManagement());
- singletons.add(new JBPM3Management());
+ singletons.add(new ProcessMgmtFacade());
+ singletons.add(new TaskMgmtFacade());
+ singletons.add(new UserMgmtFacade());
+ singletons.add(new JBPM3MgmtFacade());
}
@Override
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/FilterServletOutputStream.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/FilterServletOutputStream.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/FilterServletOutputStream.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server;
-
-import javax.servlet.ServletOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class FilterServletOutputStream extends ServletOutputStream
-{
-
- private DataOutputStream stream;
-
- public FilterServletOutputStream(OutputStream output) {
- stream = new DataOutputStream(output);
- }
-
- public void write(int b) throws IOException {
- stream.write(b);
- }
-
- public void write(byte[] b) throws IOException {
- stream.write(b);
- }
-
- public void write(byte[] b, int off, int len) throws IOException
- {
- stream.write(b,off,len);
- }
-
-}
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/GWTJsonFilter.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/GWTJsonFilter.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/GWTJsonFilter.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,112 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server;
-
-import javax.servlet.*;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class GWTJsonFilter implements Filter
-{
-
- public FilterConfig filterConfig;
- private static final String COLLECTION_PREFIX = "{\"wrapper\":";
- private static final String COLLECTION_SUFFIX = "}";
-
- public void init(FilterConfig filterConfig) throws ServletException
- {
- this.filterConfig = filterConfig;
- }
-
- public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
- throws IOException, ServletException
- {
-
- boolean isSOPCallback = false;
-
- // identify GWT json requests
- if(request.getParameter("callback")!=null)
- isSOPCallback = true;
-
- // sneak in repsonse wrapper
- OutputStream out = response.getOutputStream();
- BufferedResponseWrapper wrapper = new BufferedResponseWrapper((HttpServletResponse) response);
-
- // proceed chain
- chain.doFilter(request, wrapper);
-
- // add callback std. json output
- String contentType = response.getContentType() != null ? response.getContentType() : "application/octet-stream";
- boolean isJSONEncoding = contentType.equals("application/json");
- StringBuffer sb = null;
- if(isJSONEncoding)
- {
- String payload = new String(wrapper.getData());
- String gwtextFriendly = trimPayload(payload);
-
- sb = new StringBuffer();
-
- if(isSOPCallback)
- {
- sb.append(request.getParameter("callback"));
- sb.append("(");
- }
-
- // Strip wrapper when JSONRequest
- sb.append(gwtextFriendly);
-
- if(isSOPCallback)
- {
- sb.append(");");
- }
-
- }
-
- // flush
- if(sb!=null)
- out.write(sb.toString().getBytes());
- else
- out.write(wrapper.getData());
-
- out.flush();
- out.close();
- }
-
- private String trimPayload(String payload)
- {
- String s = payload;
- if(s.startsWith(COLLECTION_PREFIX))
- {
- s = payload.substring( COLLECTION_PREFIX.length(), payload.lastIndexOf(COLLECTION_SUFFIX));
- }
- return s;
- }
-
- public void destroy()
- {
-
- }
-}
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,200 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server;
-
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.FileItemFactory;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
-import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
-import org.jboss.bpm.console.server.dao.DAOFactory;
-import org.jboss.bpm.console.server.dao.ExtensionDAO;
-import org.jboss.bpm.console.server.dao.ProcessDAO;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.*;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@Path("jbpm3")
-public class JBPM3Management
-{
- private static final Log log = LogFactory.getLog(JBPM3Management.class);
-
- private ExtensionDAO extensionDAO = null;
- private ProcessDAO processDAO = null;
-
- private ProcessDAO getProcessDAO()
- {
- if(null==this.processDAO)
- {
- DAOFactory factory = DAOFactory.newInstance();
- this.processDAO = factory.createProcessDAO();
- log.debug("Using DAOFactory impl:" + factory.getClass().getName());
- }
-
- return this.processDAO;
-
- }
-
- private ExtensionDAO getExtensionDAO()
- {
- if(null==this.extensionDAO)
- {
- DAOFactory factory = DAOFactory.newInstance();
- this.extensionDAO = factory.createDiagramDAO();
- }
-
- return this.extensionDAO;
-
- }
-
- @POST
- @Path("definitions/new")
- @Produces("application/json")
- @Consumes("multipart/form-data")
- public Response postNewDefinition(
- @Context
- HttpServletRequest request
- )
- {
- try
- {
- FileItemFactory factory = new DiskFileItemFactory();
- ServletFileUpload upload = new ServletFileUpload(factory);
- List items = upload.parseRequest(request);
-
- Iterator iter = items.iterator();
- while (iter.hasNext())
- {
- FileItem item = (FileItem) iter.next();
-
- if (item.isFormField())
- {
- // ignore
- log.debug("Caught form field on file upload: " + item.getName());
- }
- else
- {
- String fieldName = item.getFieldName();
- String fileName = item.getName();
- String contentType = item.getContentType();
- boolean isInMemory = item.isInMemory();
- long sizeInBytes = item.getSize();
-
- // Process a file upload in memory
- byte[] data = item.get();
-
- getProcessDAO().deployNewDefinition(data);
-
- // Process stream
- //InputStream uploadedStream = item.getInputStream();
- //uploadedStream.close();
-
- }
-
-
- }
- } catch (Throwable e)
- {
- throw new WebApplicationException(e);
- }
-
- return Response.ok().build();
-
- }
-
- @GET
- @Path("definitions/{id}/image")
- @Produces("image/jpeg")
- public Response getProcessImage(
- @PathParam("id")
- long id
- )
- {
- byte[] image = getExtensionDAO().getProcessImage(id);
- if(null==image)
- return Response.serverError().build();
- else
- return Response.ok(image).type("image/jpeg").build();
- }
-
- @GET
- @Path("definitions/{id}/diagramInfo")
- @Produces("application/json")
- public DiagramInfo getDiagramInfo(
- @PathParam("id")
- long id
- )
- {
- return getExtensionDAO().getDiagramInfo(id);
- }
-
- @GET
- @Path("instances/{id}/activeNodeInfo")
- @Produces("application/json")
- public ActiveNodeInfo getActiveNodeInfo(
- @PathParam("id")
- long id
- )
- {
- ActiveNodeInfo activNodeInfo = getExtensionDAO().getActivNodeInfo(id);
- return activNodeInfo;
- }
-
- @POST
- @Path("tokens/{id}/transition")
- @Produces("application/json")
- public Response signalToken(
- @PathParam("id")
- long id,
- @QueryParam("signal")
- String signalName)
- {
- log.debug("Signal token " + id + " -> " + signalName);
-
- getExtensionDAO().signalToken(id, signalName);
- return Response.ok().type("application/json").build();
- }
-
- @POST
- @Path("tokens/{id}/transition/default")
- @Produces("application/json")
- public Response signalTokenDefault(
- @PathParam("id")
- long id)
- {
- log.debug("Signal token " + id);
-
- getExtensionDAO().signalToken(id, null);
- return Response.ok().type("application/json").build();
- }
-
-}
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java (from rev 2909, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,200 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
+import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
+import org.jboss.bpm.console.server.dao.ManagementFactory;
+import org.jboss.bpm.console.server.dao.JBPM3Extension;
+import org.jboss.bpm.console.server.dao.ProcessManagement;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@Path("jbpm3")
+public class JBPM3MgmtFacade
+{
+ private static final Log log = LogFactory.getLog(JBPM3MgmtFacade.class);
+
+ private JBPM3Extension JBPM3Extension = null;
+ private ProcessManagement processManagement = null;
+
+ private ProcessManagement getProcessDAO()
+ {
+ if(null==this.processManagement)
+ {
+ ManagementFactory factory = ManagementFactory.newInstance();
+ this.processManagement = factory.createProcessManagement();
+ log.debug("Using ManagementFactory impl:" + factory.getClass().getName());
+ }
+
+ return this.processManagement;
+
+ }
+
+ private JBPM3Extension getExtensionDAO()
+ {
+ if(null==this.JBPM3Extension)
+ {
+ ManagementFactory factory = ManagementFactory.newInstance();
+ this.JBPM3Extension = factory.createExtensionManagement();
+ }
+
+ return this.JBPM3Extension;
+
+ }
+
+ @POST
+ @Path("definitions/new")
+ @Produces("application/json")
+ @Consumes("multipart/form-data")
+ public Response postNewDefinition(
+ @Context
+ HttpServletRequest request
+ )
+ {
+ try
+ {
+ FileItemFactory factory = new DiskFileItemFactory();
+ ServletFileUpload upload = new ServletFileUpload(factory);
+ List items = upload.parseRequest(request);
+
+ Iterator iter = items.iterator();
+ while (iter.hasNext())
+ {
+ FileItem item = (FileItem) iter.next();
+
+ if (item.isFormField())
+ {
+ // ignore
+ log.debug("Caught form field on file upload: " + item.getName());
+ }
+ else
+ {
+ String fieldName = item.getFieldName();
+ String fileName = item.getName();
+ String contentType = item.getContentType();
+ boolean isInMemory = item.isInMemory();
+ long sizeInBytes = item.getSize();
+
+ // Process a file upload in memory
+ byte[] data = item.get();
+
+ getProcessDAO().deployNewDefinition(data);
+
+ // Process stream
+ //InputStream uploadedStream = item.getInputStream();
+ //uploadedStream.close();
+
+ }
+
+
+ }
+ } catch (Throwable e)
+ {
+ throw new WebApplicationException(e);
+ }
+
+ return Response.ok().build();
+
+ }
+
+ @GET
+ @Path("definitions/{id}/image")
+ @Produces("image/jpeg")
+ public Response getProcessImage(
+ @PathParam("id")
+ long id
+ )
+ {
+ byte[] image = getExtensionDAO().getProcessImage(id);
+ if(null==image)
+ return Response.serverError().build();
+ else
+ return Response.ok(image).type("image/jpeg").build();
+ }
+
+ @GET
+ @Path("definitions/{id}/diagramInfo")
+ @Produces("application/json")
+ public DiagramInfo getDiagramInfo(
+ @PathParam("id")
+ long id
+ )
+ {
+ return getExtensionDAO().getDiagramInfo(id);
+ }
+
+ @GET
+ @Path("instances/{id}/activeNodeInfo")
+ @Produces("application/json")
+ public ActiveNodeInfo getActiveNodeInfo(
+ @PathParam("id")
+ long id
+ )
+ {
+ ActiveNodeInfo activNodeInfo = getExtensionDAO().getActivNodeInfo(id);
+ return activNodeInfo;
+ }
+
+ @POST
+ @Path("tokens/{id}/transition")
+ @Produces("application/json")
+ public Response signalToken(
+ @PathParam("id")
+ long id,
+ @QueryParam("signal")
+ String signalName)
+ {
+ log.debug("Signal token " + id + " -> " + signalName);
+
+ getExtensionDAO().signalToken(id, signalName);
+ return Response.ok().type("application/json").build();
+ }
+
+ @POST
+ @Path("tokens/{id}/transition/default")
+ @Produces("application/json")
+ public Response signalTokenDefault(
+ @PathParam("id")
+ long id)
+ {
+ log.debug("Signal token " + id);
+
+ getExtensionDAO().signalToken(id, null);
+ return Response.ok().type("application/json").build();
+ }
+
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,137 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.jboss.bpm.console.client.model.ProcessDefinitionWrapper;
-import org.jboss.bpm.console.client.model.ProcessInstanceWrapper;
-import org.jboss.bpm.console.client.model.ProcessInstance;
-import org.jboss.bpm.console.server.dao.DAOFactory;
-import org.jboss.bpm.console.server.dao.ProcessDAO;
-import org.jboss.bpm.console.server.gson.GsonFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.*;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-
-/**
- * REST server module for accessing process related data.
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@Path("process")
-public class ProcessManagement
-{
-
- private static final Log log = LogFactory.getLog(ProcessManagement.class);
-
- private ProcessDAO processDAO;
-
- /**
- * Lazy load the {@link org.jboss.bpm.console.server.dao.ProcessDAO}
- */
- private ProcessDAO getProcessDAO()
- {
- if(null==this.processDAO)
- {
- DAOFactory factory = DAOFactory.newInstance();
- this.processDAO = factory.createProcessDAO();
- log.debug("Using DAOFactory impl:" + factory.getClass().getName());
- }
-
- return this.processDAO;
- }
-
- @GET
- @Path("definitions")
- @Produces("application/json")
- public Response getDefinitionsJSON()
- {
- ProcessDefinitionWrapper wrapper =
- new ProcessDefinitionWrapper(getProcessDAO().getAllDefinitions());
- return createJsonResponse(wrapper);
- }
-
- @POST
- @Path("definitions/{id}/remove")
- @Produces("application/json")
- public Response removeDefinitionsJSON(
- @PathParam("id")
- long processId
- )
- {
- ProcessDefinitionWrapper wrapper =
- new ProcessDefinitionWrapper( getProcessDAO().removeDefinition(processId));
- return createJsonResponse(wrapper);
- }
-
- @GET
- @Path("definitions/{id}/instances")
- @Produces("application/json")
- public Response getInstancesJSON(
- @PathParam("id")
- long processId
- )
- {
-
- ProcessInstanceWrapper wrapper =
- new ProcessInstanceWrapper(getProcessDAO().getInstancesByProcessId(processId));
- return createJsonResponse(wrapper);
- }
-
- @POST
- @Path("definitions/{id}/instances/new")
- @Produces("application/json")
- public Response newInstance(
- @PathParam("id")
- long processId)
- {
-
- ProcessInstance instance = getProcessDAO().newInstance(processId);
- return createJsonResponse(instance);
- }
-
- @POST
- @Path("instances/{id}/state/{next}")
- @Produces("application/json")
- public Response changeState(
- @PathParam("id")
- long instanceId,
- @PathParam("next")
- String next)
- {
- log.debug("Change instance (ID "+instanceId+") to state " +next);
- getProcessDAO().changeState(instanceId, next);
- return Response.ok().type("application/json").build();
- }
-
- private Response createJsonResponse(Object wrapper)
- {
- Gson gson = GsonFactory.createInstance();
- String json = gson.toJson(wrapper);
- return Response.ok(json).type("application/json").build();
- }
-}
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java (from rev 2905, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server;
+
+import com.google.gson.Gson;
+import org.jboss.bpm.console.client.model.ProcessDefinitionWrapper;
+import org.jboss.bpm.console.client.model.ProcessInstanceWrapper;
+import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.server.dao.ManagementFactory;
+import org.jboss.bpm.console.server.dao.ProcessManagement;
+import org.jboss.bpm.console.server.gson.GsonFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
+
+/**
+ * REST server module for accessing process related data.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@Path("process")
+public class ProcessMgmtFacade
+{
+
+ private static final Log log = LogFactory.getLog(ProcessMgmtFacade.class);
+
+ private ProcessManagement processManagement;
+
+ /**
+ * Lazy load the {@link org.jboss.bpm.console.server.dao.ProcessManagement}
+ */
+ private ProcessManagement getProcessDAO()
+ {
+ if(null==this.processManagement)
+ {
+ ManagementFactory factory = ManagementFactory.newInstance();
+ this.processManagement = factory.createProcessManagement();
+ log.debug("Using ManagementFactory impl:" + factory.getClass().getName());
+ }
+
+ return this.processManagement;
+ }
+
+ @GET
+ @Path("definitions")
+ @Produces("application/json")
+ public Response getDefinitionsJSON()
+ {
+ ProcessDefinitionWrapper wrapper =
+ new ProcessDefinitionWrapper(getProcessDAO().getAllDefinitions());
+ return createJsonResponse(wrapper);
+ }
+
+ @POST
+ @Path("definitions/{id}/remove")
+ @Produces("application/json")
+ public Response removeDefinitionsJSON(
+ @PathParam("id")
+ long processId
+ )
+ {
+ ProcessDefinitionWrapper wrapper =
+ new ProcessDefinitionWrapper( getProcessDAO().removeDefinition(processId));
+ return createJsonResponse(wrapper);
+ }
+
+ @GET
+ @Path("definitions/{id}/instances")
+ @Produces("application/json")
+ public Response getInstancesJSON(
+ @PathParam("id")
+ long processId
+ )
+ {
+
+ ProcessInstanceWrapper wrapper =
+ new ProcessInstanceWrapper(getProcessDAO().getInstancesByProcessId(processId));
+ return createJsonResponse(wrapper);
+ }
+
+ @POST
+ @Path("definitions/{id}/instances/new")
+ @Produces("application/json")
+ public Response newInstance(
+ @PathParam("id")
+ long processId)
+ {
+
+ ProcessInstance instance = getProcessDAO().newInstance(processId);
+ return createJsonResponse(instance);
+ }
+
+ @POST
+ @Path("instances/{id}/state/{next}")
+ @Produces("application/json")
+ public Response changeState(
+ @PathParam("id")
+ long instanceId,
+ @PathParam("next")
+ String next)
+ {
+ log.debug("Change instance (ID "+instanceId+") to state " +next);
+ getProcessDAO().changeState(instanceId, next);
+ return Response.ok().type("application/json").build();
+ }
+
+ private Response createJsonResponse(Object wrapper)
+ {
+ Gson gson = GsonFactory.createInstance();
+ String json = gson.toJson(wrapper);
+ return Response.ok(json).type("application/json").build();
+ }
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskManagement.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskManagement.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,207 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server;
-
-import com.google.gson.Gson;
-import org.jboss.bpm.console.client.model.TaskReferenceWrapper;
-import org.jboss.bpm.console.client.model.TaskReference;
-import org.jboss.bpm.console.client.model.forms.FieldDef;
-import org.jboss.bpm.console.client.model.forms.FormDef;
-import org.jboss.bpm.console.client.model.util.MapEntry;
-import org.jboss.bpm.console.server.dao.DAOFactory;
-import org.jboss.bpm.console.server.dao.TaskDAO;
-import org.jboss.bpm.console.server.dao.internal.JBPM3FormParser;
-import org.jboss.bpm.console.server.gson.GsonFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.Response;
-import java.io.ByteArrayInputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * REST server module for accessing task related data.
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@Path("tasks")
-public class TaskManagement
-{
- private static final Log log = LogFactory.getLog(TaskManagement.class);
-
- private TaskDAO taskDAO;
-
- /**
- * Lazy load the {@link org.jboss.bpm.console.server.dao.ProcessDAO}
- */
- private TaskDAO getTaskDAO()
- {
- if(null==this.taskDAO)
- {
- DAOFactory factory = DAOFactory.newInstance();
- this.taskDAO = factory.createTaskDAO();
- log.debug("Using DAOFactory impl:" + factory.getClass().getName());
- }
-
- return this.taskDAO;
- }
-
- @GET
- @Path("actor/{actorName}")
- @Produces("application/json")
- public Response getTasksForActor(
- @PathParam("actorName")
- String actorName
- )
- {
- TaskReferenceWrapper wrapper =
- new TaskReferenceWrapper(getTaskDAO().getTasksByActor(actorName));
- return createJsonResponse(wrapper);
- }
-
- @GET
- @Path("forms/{processId}")
- @Produces("application/json")
- public Response getTasksForms(
- @PathParam("processId")
- long processId
- )
- {
- Map<String,String> formMapping =
- getTaskDAO().getAvailableTaskForms(processId);
-
- List<MapEntry> entries = new ArrayList<MapEntry>();
- for(String s : formMapping.keySet())
- {
- entries.add( new MapEntry(s, formMapping.get(s)) );
- }
-
- return createJsonResponse( entries );
- }
-
- @POST
- @Path("{taskId}/assignment/{actorId}")
- @Produces("application/json")
- public Response assignTask(
- @PathParam("taskId")
- long taskId,
- @PathParam("actorId")
- String actorId
- )
- {
- log.debug("Reassign task " + taskId + " to '" + actorId +"'");
- getTaskDAO().reassignTask(taskId, actorId);
- return Response.ok().build();
- }
-
- @POST
- @Path("{taskId}/assignment")
- @Produces("application/json")
- public Response releaseTask(
- @PathParam("taskId")
- long taskId
- )
- {
- log.debug("Release task " + taskId);
- getTaskDAO().reassignTask(taskId, null);
- return Response.ok().build();
- }
-
- @POST
- @Path("{taskId}/close/transition/default")
- @Produces("application/json")
- public Response closeTask(
- @PathParam("taskId")
- long taskId
- )
- {
- return closeTaskWithSignal(taskId, null);
- }
-
- @POST
- @Path("{taskId}/close/transition")
- @Produces("application/json")
- public Response closeTaskWithSignal(
- @PathParam("taskId")
- long taskId,
- @QueryParam("signal")
- String signalName
- )
- {
- log.debug("Close task " + taskId);
- getTaskDAO().closeTask(taskId, signalName);
- return Response.ok().build();
- }
-
-
- @GET
- @Path("forms/{processId}/{taskId}")
- @Produces("application/json")
- public Response getTasksFormByTaskId(
- @PathParam("processId")
- long processId,
- @PathParam("taskId")
- long taskId
-
- )
- {
- byte[] form = getTaskDAO().getTaskFormByTaskName(processId, taskId);
- JBPM3FormParser parser = new JBPM3FormParser();
- final FormDef formDef = new FormDef("taskform-"+taskId);
- try
- {
- parser.parse( new ByteArrayInputStream(form));
-
- parser.visitResults(
- new JBPM3FormParser.ParseResultVisitor()
- {
-
- public void onInputField(FieldDef field)
- {
- formDef.getFields().add(field);
- }
-
- public void onInputButton(JBPM3FormParser.InputButton btn)
- {
- // TODO: parse buttons
- }
- }
- );
- }
- catch (Exception e)
- {
- throw new RuntimeException("Failed to parse form data", e);
- }
-
- return createJsonResponse(formDef);
- }
-
- private Response createJsonResponse(Object wrapper)
- {
- Gson gson = GsonFactory.createInstance();
- String json = gson.toJson(wrapper);
- return Response.ok(json).type("application/json").build();
- }
-}
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java (from rev 2962, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskManagement.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,220 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server;
+
+import com.google.gson.Gson;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.console.client.model.TaskReferenceWrapper;
+import org.jboss.bpm.console.client.model.forms.FieldDef;
+import org.jboss.bpm.console.client.model.forms.FormDef;
+import org.jboss.bpm.console.client.model.util.MapEntry;
+import org.jboss.bpm.console.server.dao.ManagementFactory;
+import org.jboss.bpm.console.server.dao.JBPM3Extension;
+import org.jboss.bpm.console.server.dao.TaskManagement;
+import org.jboss.bpm.console.server.dao.internal.JBPM3FormParser;
+import org.jboss.bpm.console.server.gson.GsonFactory;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
+import java.io.ByteArrayInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * REST server module for accessing task related data.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@Path("tasks")
+public class TaskMgmtFacade
+{
+ private static final Log log = LogFactory.getLog(TaskMgmtFacade.class);
+
+ private TaskManagement taskManagement;
+ private JBPM3Extension JBPM3Extension;
+
+ /**
+ * Lazy load the {@link org.jboss.bpm.console.server.dao.ProcessManagement}
+ */
+ private TaskManagement getTaskDAO()
+ {
+ if(null==this.taskManagement)
+ {
+ ManagementFactory factory = ManagementFactory.newInstance();
+ this.taskManagement = factory.createTaskManagement();
+ log.debug("Using ManagementFactory impl:" + factory.getClass().getName());
+ }
+
+ return this.taskManagement;
+ }
+
+ private JBPM3Extension getExtensionDAO()
+ {
+ if(null==this.JBPM3Extension)
+ {
+ ManagementFactory factory = ManagementFactory.newInstance();
+ this.JBPM3Extension = factory.createExtensionManagement();
+ }
+
+ return this.JBPM3Extension;
+
+ }
+
+ @GET
+ @Path("actor/{actorName}")
+ @Produces("application/json")
+ public Response getTasksForActor(
+ @PathParam("actorName")
+ String actorName
+ )
+ {
+ TaskReferenceWrapper wrapper =
+ new TaskReferenceWrapper(getTaskDAO().getTasksByActor(actorName));
+ return createJsonResponse(wrapper);
+ }
+
+ @GET
+ @Path("forms/{processId}")
+ @Produces("application/json")
+ public Response getTasksForms(
+ @PathParam("processId")
+ long processId
+ )
+ {
+ Map<String,String> formMapping =
+ getExtensionDAO().getAvailableTaskForms(processId);
+
+ List<MapEntry> entries = new ArrayList<MapEntry>();
+ for(String s : formMapping.keySet())
+ {
+ entries.add( new MapEntry(s, formMapping.get(s)) );
+ }
+
+ return createJsonResponse( entries );
+ }
+
+ @POST
+ @Path("{taskId}/assignment/{actorId}")
+ @Produces("application/json")
+ public Response assignTask(
+ @PathParam("taskId")
+ long taskId,
+ @PathParam("actorId")
+ String actorId
+ )
+ {
+ log.debug("Reassign task " + taskId + " to '" + actorId +"'");
+ getTaskDAO().reassignTask(taskId, actorId);
+ return Response.ok().build();
+ }
+
+ @POST
+ @Path("{taskId}/assignment")
+ @Produces("application/json")
+ public Response releaseTask(
+ @PathParam("taskId")
+ long taskId
+ )
+ {
+ log.debug("Release task " + taskId);
+ getTaskDAO().reassignTask(taskId, null);
+ return Response.ok().build();
+ }
+
+ @POST
+ @Path("{taskId}/close/transition/default")
+ @Produces("application/json")
+ public Response closeTask(
+ @PathParam("taskId")
+ long taskId
+ )
+ {
+ return closeTaskWithSignal(taskId, null);
+ }
+
+ @POST
+ @Path("{taskId}/close/transition")
+ @Produces("application/json")
+ public Response closeTaskWithSignal(
+ @PathParam("taskId")
+ long taskId,
+ @QueryParam("signal")
+ String signalName
+ )
+ {
+ log.debug("Close task " + taskId);
+ getTaskDAO().closeTask(taskId, signalName);
+ return Response.ok().build();
+ }
+
+
+ @GET
+ @Path("forms/{processId}/{taskId}")
+ @Produces("application/json")
+ public Response getTasksFormByTaskId(
+ @PathParam("processId")
+ long processId,
+ @PathParam("taskId")
+ long taskId
+
+ )
+ {
+ byte[] form = getExtensionDAO().getTaskFormByTaskName(processId, taskId);
+ JBPM3FormParser parser = new JBPM3FormParser();
+ final FormDef formDef = new FormDef("taskform-"+taskId);
+ try
+ {
+ parser.parse( new ByteArrayInputStream(form));
+
+ parser.visitResults(
+ new JBPM3FormParser.ParseResultVisitor()
+ {
+
+ public void onInputField(FieldDef field)
+ {
+ formDef.getFields().add(field);
+ }
+
+ public void onInputButton(JBPM3FormParser.InputButton btn)
+ {
+ // TODO: parse buttons
+ }
+ }
+ );
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Failed to parse form data", e);
+ }
+
+ return createJsonResponse(formDef);
+ }
+
+ private Response createJsonResponse(Object wrapper)
+ {
+ Gson gson = GsonFactory.createInstance();
+ String json = gson.toJson(wrapper);
+ return Response.ok(json).type("application/json").build();
+ }
+}
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserManagement.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserManagement.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server;
-
-import org.jboss.bpm.console.client.model.RoleAssignment;
-import org.jboss.bpm.console.client.model.RoleAssignmentWrapper;
-import org.jboss.bpm.console.server.gson.GsonFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.*;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import com.google.gson.Gson;
-
-/**
- * REST server module for accessing user related data.
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@Path("user")
-public class UserManagement
-{
-
- private static final Log log = LogFactory.getLog(UserManagement.class);
-
- @GET
- @Path("roles")
- @Produces("application/json")
- public Response getAssignedRoles(
- @Context
- HttpServletRequest request,
- @QueryParam("roleCheck")
- String roleCheck
- )
- {
- if(null==roleCheck)
- throw new WebApplicationException( new IllegalArgumentException("Missing parameter 'roleCheck'") );
-
- log.debug("Role check user: " + request.getRemoteUser() + ", actualRoles requested: " + roleCheck);
-
- List<RoleAssignment> actualRoles = new ArrayList<RoleAssignment>();
-
- StringTokenizer tok = new StringTokenizer(roleCheck, ",");
- while(tok.hasMoreTokens())
- {
- String possibleRole = tok.nextToken();
- actualRoles.add( new RoleAssignment(possibleRole, request.isUserInRole(possibleRole)));
- }
- return createJsonResponse( new RoleAssignmentWrapper(actualRoles));
- }
-
- private Response createJsonResponse(Object wrapper)
- {
- Gson gson = GsonFactory.createInstance();
- String json = gson.toJson(wrapper);
- return Response.ok(json).type("application/json").build();
- }
-}
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java (from rev 2799, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserManagement.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server;
+
+import org.jboss.bpm.console.client.model.RoleAssignment;
+import org.jboss.bpm.console.client.model.RoleAssignmentWrapper;
+import org.jboss.bpm.console.server.gson.GsonFactory;
+import org.jboss.bpm.console.server.dao.UserManagement;
+import org.jboss.bpm.console.server.dao.ManagementFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import com.google.gson.Gson;
+
+/**
+ * REST server module for accessing user related data.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@Path("identity")
+public class UserMgmtFacade
+{
+
+ private static final Log log = LogFactory.getLog(UserMgmtFacade.class);
+
+ private UserManagement userManagement;
+
+ private UserManagement getUserManagement()
+ {
+ if(null==userManagement)
+ {
+ ManagementFactory factory = ManagementFactory.newInstance();
+ this.userManagement = factory.createUsermanagement();
+ }
+
+ return this.userManagement;
+ }
+
+ @GET
+ @Path("/user/roles")
+ @Produces("application/json")
+ public Response getRolesForJAASPrincipal(
+ @Context
+ HttpServletRequest request,
+ @QueryParam("roleCheck")
+ String roleCheck
+ )
+ {
+ // TODO: Why not use the identity DB right away?
+ // These roles are security roles
+ if(null==roleCheck)
+ throw new WebApplicationException( new IllegalArgumentException("Missing parameter 'roleCheck'") );
+
+ log.debug("Role check user: " + request.getRemoteUser() + ", actualRoles requested: " + roleCheck);
+
+ List<RoleAssignment> actualRoles = new ArrayList<RoleAssignment>();
+
+ StringTokenizer tok = new StringTokenizer(roleCheck, ",");
+ while(tok.hasMoreTokens())
+ {
+ String possibleRole = tok.nextToken();
+ actualRoles.add( new RoleAssignment(possibleRole, request.isUserInRole(possibleRole)));
+ }
+ return createJsonResponse( new RoleAssignmentWrapper(actualRoles));
+ }
+
+ @GET
+ @Path("/user/{actorId}/groups/")
+ @Produces("application/json")
+ public Response getGroupsForActor(
+ @PathParam("actorId")
+ String actorId
+ )
+ {
+ List<String> groups = getUserManagement().getGroupsForActor(actorId);
+ return createJsonResponse(groups);
+ }
+
+ @GET
+ @Path("/group/{groupName}/members")
+ @Produces("application/json")
+ public Response getActorsForGroup(
+ @PathParam("groupName")
+ String groupName
+ )
+ {
+ List<String> groups = getUserManagement().getActorsForGroup(groupName);
+ return createJsonResponse(groups);
+ }
+
+ private Response createJsonResponse(Object wrapper)
+ {
+ Gson gson = GsonFactory.createInstance();
+ String json = gson.toJson(wrapper);
+ return Response.ok(json).type("application/json").build();
+ }
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.dao;
-
-import org.jboss.bpm.console.server.util.ServiceLoader;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public abstract class DAOFactory
-{
- public abstract ProcessDAO createProcessDAO();
-
- public abstract ExtensionDAO createDiagramDAO();
-
- public abstract TaskDAO createTaskDAO();
-
- /**
- * Load a DAOFactory through {@link org.jboss.bpm.console.server.util.ServiceLoader}
- * @return a DAOFactory implementation
- */
- public static DAOFactory newInstance()
- {
- DAOFactory factory = (DAOFactory)
- ServiceLoader.loadFromServices(DAOFactory.class.getName(), "org.jboss.bpm.console.server.dao.internal.JBPM3DAOFactory");
- if(null==factory)
- throw new RuntimeException("Failed to load DAOFactory.");
-
- return factory;
- }
-
-}
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOProxy.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOProxy.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOProxy.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,96 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.dao;
-
-import org.jboss.bpm.console.server.util.ServiceLocator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.transaction.SystemException;
-import javax.transaction.UserTransaction;
-import java.lang.reflect.Method;
-
-/**
- * Decorates DAO invocations with common system aspects, i.e. transaction demarcation.
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class DAOProxy implements java.lang.reflect.InvocationHandler
-{
- private static final Log log = LogFactory.getLog(DAOProxy.class);
-
- private Object obj;
-
- public static Object newInstance(Object obj) {
- return java.lang.reflect.Proxy.newProxyInstance(
- obj.getClass().getClassLoader(),
- obj.getClass().getInterfaces(),
- new DAOProxy(obj));
- }
-
- private DAOProxy(Object obj) {
- this.obj = obj;
- }
-
- public Object invoke(Object proxy, Method m, Object[] args)
- throws Throwable
- {
- Object result;
-
- UserTransaction tx = ServiceLocator.getUserTransaction();
-
- try
- {
- // before method invocation
- tx.begin();
-
- // field target invocation
- result = m.invoke(obj, args);
-
- tx.commit();
-
- }
- catch (Throwable e)
- {
- if(tx!=null)
- {
- try
- {
- tx.rollback();
- }
- catch (SystemException e1) {
- log.error("Failed to rollback on " + obj + " -> " + m.getName());
- }
- }
-
- throw new RuntimeException("Unexpected invocation exception: " + e.getMessage(), e);
-
- }
- finally
- {
- // after method invocation
-
- }
-
- return result;
- }
-}
\ No newline at end of file
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ExtensionDAO.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ExtensionDAO.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ExtensionDAO.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.dao;
-
-import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
-import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
-import org.jboss.bpm.console.server.dao.ProcessDAO;
-
-/**
- * Proprietary to jBPM3, no sure if it will stay.
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public interface ExtensionDAO
-{
- byte[] getProcessImage(long processId);
-
- DiagramInfo getDiagramInfo(long processId);
-
- ActiveNodeInfo getActivNodeInfo(long instanceId);
-
- void signalToken(long tokenId, String signal);
-}
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/InvocationProxy.java (from rev 2910, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOProxy.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/InvocationProxy.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/InvocationProxy.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao;
+
+import org.jboss.bpm.console.server.util.ServiceLocator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+import java.lang.reflect.Method;
+
+/**
+ * Decorates management invocations with common system aspects, i.e. transaction demarcation.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class InvocationProxy implements java.lang.reflect.InvocationHandler
+{
+ private static final Log log = LogFactory.getLog(InvocationProxy.class);
+
+ private Object obj;
+
+ public static Object newInstance(Object obj) {
+ return java.lang.reflect.Proxy.newProxyInstance(
+ obj.getClass().getClassLoader(),
+ obj.getClass().getInterfaces(),
+ new InvocationProxy(obj));
+ }
+
+ private InvocationProxy(Object obj) {
+ this.obj = obj;
+ }
+
+ public Object invoke(Object proxy, Method m, Object[] args)
+ throws Throwable
+ {
+ Object result;
+
+ UserTransaction tx = ServiceLocator.getUserTransaction();
+
+ try
+ {
+ // before method invocation
+ tx.begin();
+
+ // field target invocation
+ result = m.invoke(obj, args);
+
+ tx.commit();
+
+ }
+ catch (Throwable e)
+ {
+ if(tx!=null)
+ {
+ try
+ {
+ tx.rollback();
+ }
+ catch (SystemException e1) {
+ log.error("Failed to rollback on " + obj + " -> " + m.getName());
+ }
+ }
+
+ throw new RuntimeException("Unexpected invocation exception: " + e.getMessage(), e);
+
+ }
+ finally
+ {
+ // after method invocation
+
+ }
+
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/InvocationProxy.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/JBPM3Extension.java (from rev 2904, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ExtensionDAO.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/JBPM3Extension.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/JBPM3Extension.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao;
+
+import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
+import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
+
+import java.util.Map;
+
+/**
+ * Proprietary to jBPM3, no sure if it will stay.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface JBPM3Extension
+{
+ byte[] getProcessImage(long processId);
+
+ DiagramInfo getDiagramInfo(long processId);
+
+ ActiveNodeInfo getActivNodeInfo(long instanceId);
+
+ void signalToken(long tokenId, String signal);
+
+ Map<String, String> getAvailableTaskForms(long processId);
+
+ byte[] getTaskFormByTaskName(long processId, long taskId);
+
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/JBPM3Extension.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ManagementFactory.java (from rev 2904, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ManagementFactory.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ManagementFactory.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao;
+
+import org.jboss.bpm.console.server.util.ServiceLoader;
+
+/**
+ * Construct management implementations.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class ManagementFactory
+{
+ public abstract ProcessManagement createProcessManagement();
+
+ // TODO: remove from base class. It's proprietary to jbpm3
+ public abstract JBPM3Extension createExtensionManagement();
+
+ public abstract TaskManagement createTaskManagement();
+
+ public abstract UserManagement createUsermanagement();
+
+ /**
+ * Load a ManagementFactory through {@link org.jboss.bpm.console.server.util.ServiceLoader}
+ * @return a ManagementFactory implementation
+ */
+ public static ManagementFactory newInstance()
+ {
+ ManagementFactory factory = (ManagementFactory)
+ ServiceLoader.loadFromServices(ManagementFactory.class.getName(), "org.jboss.bpm.console.server.dao.internal.JBPM3ManagementFactory");
+ if(null==factory)
+ throw new RuntimeException("Failed to load ManagementFactory.");
+
+ return factory;
+ }
+
+}
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessDAO.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessDAO.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessDAO.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.dao;
-
-import org.jboss.bpm.console.client.model.ProcessDefinition;
-import org.jboss.bpm.console.client.model.ProcessInstance;
-import org.jboss.bpm.console.client.model.TaskReference;
-
-import java.util.List;
-
-/**
- * Access process related data.
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public interface ProcessDAO
-{
- List<ProcessDefinition> getAllDefinitions();
-
- ProcessDefinition getDefinitionById(long processId);
-
- List<ProcessDefinition> removeDefinition(long processId);
-
- List<ProcessInstance> getInstancesByProcessId(long processId);
-
- ProcessInstance getInstanceById(long instanceId);
-
- void changeState(long instanceId, String nextState);
-
- ProcessInstance newInstance(long processId);
-
- ProcessDefinition deployNewDefinition(byte[] data);
-
- List<TaskReference> getAllTasks();
-}
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessManagement.java (from rev 2755, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessDAO.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessManagement.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao;
+
+import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.TaskReference;
+
+import java.util.List;
+
+/**
+ * Access process related data.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ProcessManagement
+{
+ List<ProcessDefinition> getAllDefinitions();
+
+ ProcessDefinition getDefinitionById(long processId);
+
+ List<ProcessDefinition> removeDefinition(long processId);
+
+ List<ProcessInstance> getInstancesByProcessId(long processId);
+
+ ProcessInstance getInstanceById(long instanceId);
+
+ void changeState(long instanceId, String nextState);
+
+ ProcessInstance newInstance(long processId);
+
+ ProcessDefinition deployNewDefinition(byte[] data);
+
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessManagement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskDAO.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskDAO.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskDAO.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.dao;
-
-import org.jboss.bpm.console.client.model.TaskReference;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public interface TaskDAO
-{
- List<TaskReference> getTasksByActor(String actorName);
- Map<String, String> getAvailableTaskForms(long processId);
- byte[] getTaskFormByTaskName(long processId, long taskId);
-
- TaskReference getTaskById(long taskId);
- void reassignTask(long taskId, String actorId);
- void closeTask(long taskId, String signalName);
-}
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskManagement.java (from rev 2962, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskDAO.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskManagement.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao;
+
+import org.jboss.bpm.console.client.model.TaskReference;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface TaskManagement
+{
+ List<TaskReference> getTasksByActor(String actorName);
+ TaskReference getTaskById(long taskId);
+ void reassignTask(long taskId, String actorId);
+
+ // TODO: If signaling resides with an extension then closeTask() should as well
+ void closeTask(long taskId, String signalName);
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/UserManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/UserManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/UserManagement.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface UserManagement
+{
+ List<String> getGroupsForActor(String actorId);
+ List<String> getActorsForGroup(String groupName);
+}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3CommandDelegate.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3CommandDelegate.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3CommandDelegate.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -26,14 +26,13 @@
import org.jbpm.ejb.LocalCommandServiceHome;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.taskmgmt.exe.TaskInstance;
-import org.jbpm.identity.Group;
import org.jboss.bpm.console.server.util.ServiceLocator;
-import org.jboss.bpm.console.server.dao.internal.cmd.GetGroupMemershipCommand;
+import org.jboss.bpm.console.server.dao.internal.cmd.GetGroupMembershipCommand;
+import org.jboss.bpm.console.server.dao.internal.cmd.GetUsersForGroupCommand;
import javax.ejb.CreateException;
import java.util.List;
import java.util.ArrayList;
-import java.util.Set;
/**
* Adopts a business interface to the command facade.<br>
@@ -152,9 +151,7 @@
public List<TaskInstance> getActualTasksForActor(String actorName)
{
- List<String> groupNames = (List<String>)facade.execute(
- new GetGroupMemershipCommand(actorName)
- );
+ List<String> groupNames = getGroupsForActor(actorName);
String[] actors = new String[groupNames.size()+1];
int i=0;
@@ -172,6 +169,22 @@
return tasks;
}
+ public List<String> getGroupsForActor(String actorName)
+ {
+ List<String> groupNames = (List<String>)facade.execute(
+ new GetGroupMembershipCommand(actorName)
+ );
+ return groupNames;
+ }
+
+ public List<String> getActorsForGroup(String groupName)
+ {
+ List<String> actorIds = (List<String>)facade.execute(
+ new GetUsersForGroupCommand(groupName)
+ );
+ return actorIds;
+ }
+
public TaskInstance getTaskById(long taskId)
{
// include variables, but no logs
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DAOFactory.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DAOFactory.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DAOFactory.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.dao.internal;
-
-import org.jboss.bpm.console.server.dao.*;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class JBPM3DAOFactory extends DAOFactory
-{
-
- public ProcessDAO createProcessDAO()
- {
- return (ProcessDAO) DAOProxy.newInstance(new JBPM3ProcessDAO());
- }
-
- public ExtensionDAO createDiagramDAO()
- {
- return (ExtensionDAO) DAOProxy.newInstance( new JBPM3ExtensionDAO() );
- }
-
-
- public TaskDAO createTaskDAO()
- {
- return (TaskDAO) DAOProxy.newInstance( new JBPM3TaskDAO() );
- }
-}
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ExtensionDAO.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ExtensionDAO.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ExtensionDAO.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.dao.internal;
-
-import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
-import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
-import org.jboss.bpm.console.client.model.jbpm3.DiagramNodeInfo;
-import org.jboss.bpm.console.server.dao.ExtensionDAO;
-
-import java.io.InputStream;
-import java.util.List;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class JBPM3ExtensionDAO implements ExtensionDAO
-{
- private JBPM3CommandDelegate delegate;
-
- private static final String PROCESSIMAGE_FILENAME = "processimage.jpg";
- private static final String GPD_XML_FILENAME = "gpd.xml";
-
- public JBPM3ExtensionDAO()
- {
- this.delegate = new JBPM3CommandDelegate();
- }
-
- public byte[] getProcessImage(long processId)
- {
- org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
- return p0.getFileDefinition().getBytes(PROCESSIMAGE_FILENAME);
- }
-
- public DiagramInfo getDiagramInfo(long processId)
- {
- org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
- InputStream in = p0.getFileDefinition().getInputStream(GPD_XML_FILENAME);
- return DiagramInfoParser.parse(in);
- }
-
- public ActiveNodeInfo getActivNodeInfo(long instanceId)
- {
- org.jbpm.graph.exe.ProcessInstance instance = delegate.getActualInstance(instanceId);
- String currentNodeName = instance.getRootToken().getNode().getName();
-
- DiagramInfo diagram = getDiagramInfo(instance.getProcessDefinition().getId());
- List<DiagramNodeInfo> nodes = diagram.getNodeList();
-
- DiagramNodeInfo activeNode = null;
- int i = 0;
- for(DiagramNodeInfo n : nodes)
- {
- if(currentNodeName.equals(n.getName()))
- {
- activeNode = n;
- break;
- }
- }
-
- if(null==activeNode)
- throw new RuntimeException("Failed to retrieve activeNodeInfo for instance " + instanceId);
-
- return new ActiveNodeInfo(diagram.getWidth(), diagram.getHeight(), activeNode);
- }
-
-
- public void signalToken(long tokenId, String signal)
- {
- delegate.signalToken(tokenId, signal);
- }
-}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3FormParser.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3FormParser.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3FormParser.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -36,7 +36,7 @@
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class JBPM3FormParser
+class JBPM3FormParser
{
private static final Log log = LogFactory.getLog(JBPM3FormParser.class);
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementExtension.java (from rev 2904, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ExtensionDAO.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementExtension.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementExtension.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao.internal;
+
+import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
+import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
+import org.jboss.bpm.console.client.model.jbpm3.DiagramNodeInfo;
+import org.jboss.bpm.console.server.dao.JBPM3Extension;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.file.def.FileDefinition;
+import org.jbpm.util.XmlUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JBPM3ManagementExtension implements JBPM3Extension
+{
+ private JBPM3CommandDelegate delegate;
+
+ private static final String PROCESSIMAGE_FILENAME = "processimage.jpg";
+ private static final String GPD_XML_FILENAME = "gpd.xml";
+
+ public JBPM3ManagementExtension()
+ {
+ this.delegate = new JBPM3CommandDelegate();
+ }
+
+ public byte[] getProcessImage(long processId)
+ {
+ org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
+ return p0.getFileDefinition().getBytes(PROCESSIMAGE_FILENAME);
+ }
+
+ public DiagramInfo getDiagramInfo(long processId)
+ {
+ org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
+ InputStream in = p0.getFileDefinition().getInputStream(GPD_XML_FILENAME);
+ return DiagramInfoParser.parse(in);
+ }
+
+ public ActiveNodeInfo getActivNodeInfo(long instanceId)
+ {
+ org.jbpm.graph.exe.ProcessInstance instance = delegate.getActualInstance(instanceId);
+ String currentNodeName = instance.getRootToken().getNode().getName();
+
+ DiagramInfo diagram = getDiagramInfo(instance.getProcessDefinition().getId());
+ List<DiagramNodeInfo> nodes = diagram.getNodeList();
+
+ DiagramNodeInfo activeNode = null;
+ int i = 0;
+ for(DiagramNodeInfo n : nodes)
+ {
+ if(currentNodeName.equals(n.getName()))
+ {
+ activeNode = n;
+ break;
+ }
+ }
+
+ if(null==activeNode)
+ throw new RuntimeException("Failed to retrieve activeNodeInfo for instance " + instanceId);
+
+ return new ActiveNodeInfo(diagram.getWidth(), diagram.getHeight(), activeNode);
+ }
+
+
+ public void signalToken(long tokenId, String signal)
+ {
+ delegate.signalToken(tokenId, signal);
+ }
+
+ public Map<String, String> getAvailableTaskForms(long processId)
+ {
+ org.jbpm.graph.def.ProcessDefinition processDefinition =
+ delegate.getActualDefinition(processId);
+
+ return getTask2FileMapping(processDefinition);
+ }
+
+ private Map<String, String> getTask2FileMapping(ProcessDefinition processDefinition)
+ {
+ Map<String, String> result = new HashMap<String, String>();
+
+ final FileDefinition fileDefinition = processDefinition.getFileDefinition();
+ if (! fileDefinition.hasFile("forms.xml"))
+ {
+ // exit with empty list
+ // TODO: maybe an exception is better?
+ return result;
+ }
+
+ final InputStream inputStream = fileDefinition.getInputStream("forms.xml");
+ if (inputStream == null)
+ {
+ throw new RuntimeException("Failed to open stream on forms.xml");
+ }
+
+ final Document document = XmlUtil.parseXmlInputStream(inputStream);
+ final Element documentElement = document.getDocumentElement();
+ final NodeList nodeList = documentElement.getElementsByTagName("form");
+ final int length = nodeList.getLength();
+ for (int i = 0; i < length; i ++)
+ {
+ final Element element = (Element) nodeList.item(i);
+ final String itemTaskName = element.getAttribute("task");
+ final String itemFormName = element.getAttribute("form");
+ if (itemTaskName == null || itemFormName == null) {
+ continue;
+ }
+ result.put(itemTaskName, itemFormName);
+ }
+ return result;
+ }
+
+ public byte[] getTaskFormByTaskName(long processId, long taskId)
+ {
+ org.jbpm.graph.def.ProcessDefinition processDefinition =
+ delegate.getActualDefinition(processId);
+ org.jbpm.taskmgmt.exe.TaskInstance t0 = delegate.getTaskById(taskId);
+
+ Map<String,String> fileMapping = getTask2FileMapping(processDefinition);
+ String fileName = fileMapping.get(t0.getName());
+ if(fileName !=null)
+ return processDefinition.getFileDefinition().getBytes(fileName);
+ else
+ throw new RuntimeException("No form definition for taskId '"+taskId+"'");
+
+ }
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementExtension.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementFactory.java (from rev 2904, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DAOFactory.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementFactory.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementFactory.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao.internal;
+
+import org.jboss.bpm.console.server.dao.*;
+
+/**
+ * Wraps management instances in {@link org.jboss.bpm.console.server.dao.InvocationProxy}
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JBPM3ManagementFactory extends ManagementFactory
+{
+
+ public ProcessManagement createProcessManagement()
+ {
+ return (ProcessManagement) InvocationProxy.newInstance(new JBPM3ProcessManagement());
+ }
+
+ public JBPM3Extension createExtensionManagement()
+ {
+ return (JBPM3Extension) InvocationProxy.newInstance( new JBPM3ManagementExtension() );
+ }
+
+
+ public TaskManagement createTaskManagement()
+ {
+ return (TaskManagement) InvocationProxy.newInstance( new JBPM3TaskManagement() );
+ }
+
+
+ public UserManagement createUsermanagement()
+ {
+ return (UserManagement) InvocationProxy.newInstance( new JBPM3UserManagement() );
+ }
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessDAO.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessDAO.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessDAO.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.dao.internal;
-
-import org.jboss.bpm.console.client.model.ProcessDefinition;
-import org.jboss.bpm.console.client.model.ProcessInstance;
-import org.jboss.bpm.console.client.model.TaskReference;
-import org.jboss.bpm.console.server.dao.ProcessDAO;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class JBPM3ProcessDAO implements ProcessDAO
-{
- private JBPM3CommandDelegate delegate;
-
- public JBPM3ProcessDAO()
- {
- this.delegate = new JBPM3CommandDelegate();
- }
-
- public List<ProcessDefinition> getAllDefinitions()
- {
- List<org.jbpm.graph.def.ProcessDefinition> defs = delegate.getActualDefinitions();
-
- List<ProcessDefinition> results = new ArrayList<ProcessDefinition>(defs.size());
- for(org.jbpm.graph.def.ProcessDefinition p0 : defs)
- {
- results.add( Transform.processDefinition(p0) );
- }
- return results;
- }
-
- public ProcessDefinition getDefinitionById(long processId)
- {
- org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
- return Transform.processDefinition(p0);
- }
-
- public List<ProcessDefinition> removeDefinition(long processId)
- {
- delegate.removeActualDefinition(processId);
- return getAllDefinitions();
- }
-
-
- public ProcessInstance newInstance(long processId)
- {
- org.jbpm.graph.exe.ProcessInstance instance = delegate.startNewInstance(processId);
- return Transform.processInstance(instance);
- }
-
- public List<ProcessInstance> getInstancesByProcessId(long processId)
- {
- List<org.jbpm.graph.exe.ProcessInstance> instances = delegate.getActualInstances(processId);
- List<ProcessInstance> results = new ArrayList<ProcessInstance>(instances.size());
- for(org.jbpm.graph.exe.ProcessInstance i0 : instances)
- {
- results.add( Transform.processInstance(i0) );
- }
- return results;
- }
-
- public ProcessInstance getInstanceById(long instanceId)
- {
- org.jbpm.graph.exe.ProcessInstance instance = delegate.getActualInstance(instanceId);
- return Transform.processInstance(instance);
- }
-
-
- public void changeState(long instanceId, String nextState)
- {
- org.jbpm.graph.exe.ProcessInstance p0 = delegate.getActualInstance(instanceId);
- Transform.doTransition(p0, nextState); // modifies the actual PI
-
- // TX commit will persist changes to the actual PI
-
-
- }
-
- public ProcessDefinition deployNewDefinition(byte[] data)
- {
- org.jbpm.graph.def.ProcessDefinition p0 = delegate.deploy(data);
- return Transform.processDefinition(p0);
- }
-
-
- public List<TaskReference> getAllTasks()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
-}
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessManagement.java (from rev 2755, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessDAO.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessManagement.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao.internal;
+
+import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.server.dao.ProcessManagement;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JBPM3ProcessManagement implements ProcessManagement
+{
+ private JBPM3CommandDelegate delegate;
+
+ public JBPM3ProcessManagement()
+ {
+ this.delegate = new JBPM3CommandDelegate();
+ }
+
+ public List<ProcessDefinition> getAllDefinitions()
+ {
+ List<org.jbpm.graph.def.ProcessDefinition> defs = delegate.getActualDefinitions();
+
+ List<ProcessDefinition> results = new ArrayList<ProcessDefinition>(defs.size());
+ for(org.jbpm.graph.def.ProcessDefinition p0 : defs)
+ {
+ results.add( Transform.processDefinition(p0) );
+ }
+ return results;
+ }
+
+ public ProcessDefinition getDefinitionById(long processId)
+ {
+ org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
+ return Transform.processDefinition(p0);
+ }
+
+ public List<ProcessDefinition> removeDefinition(long processId)
+ {
+ delegate.removeActualDefinition(processId);
+ return getAllDefinitions();
+ }
+
+
+ public ProcessInstance newInstance(long processId)
+ {
+ org.jbpm.graph.exe.ProcessInstance instance = delegate.startNewInstance(processId);
+ return Transform.processInstance(instance);
+ }
+
+ public List<ProcessInstance> getInstancesByProcessId(long processId)
+ {
+ List<org.jbpm.graph.exe.ProcessInstance> instances = delegate.getActualInstances(processId);
+ List<ProcessInstance> results = new ArrayList<ProcessInstance>(instances.size());
+ for(org.jbpm.graph.exe.ProcessInstance i0 : instances)
+ {
+ results.add( Transform.processInstance(i0) );
+ }
+ return results;
+ }
+
+ public ProcessInstance getInstanceById(long instanceId)
+ {
+ org.jbpm.graph.exe.ProcessInstance instance = delegate.getActualInstance(instanceId);
+ return Transform.processInstance(instance);
+ }
+
+
+ public void changeState(long instanceId, String nextState)
+ {
+ org.jbpm.graph.exe.ProcessInstance p0 = delegate.getActualInstance(instanceId);
+ Transform.doTransition(p0, nextState); // modifies the actual PI
+
+ // TX commit will persist changes to the actual PI
+
+
+ }
+
+ public ProcessDefinition deployNewDefinition(byte[] data)
+ {
+ org.jbpm.graph.def.ProcessDefinition p0 = delegate.deploy(data);
+ return Transform.processDefinition(p0);
+ }
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessManagement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskDAO.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskDAO.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskDAO.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,149 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.dao.internal;
-
-import org.jboss.bpm.console.client.model.TaskReference;
-import org.jboss.bpm.console.server.dao.TaskDAO;
-import org.jbpm.file.def.FileDefinition;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.util.XmlUtil;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class JBPM3TaskDAO implements TaskDAO
-{
-
- private JBPM3CommandDelegate delegate;
-
- public JBPM3TaskDAO()
- {
- this.delegate = new JBPM3CommandDelegate();
- }
-
- public List<TaskReference> getTasksByActor(String actorName)
- {
-
- List<org.jbpm.taskmgmt.exe.TaskInstance> actualTasks =
- delegate.getActualTasksForActor(actorName);
-
- List<TaskReference> taskRefs = new ArrayList<TaskReference>();
- for(org.jbpm.taskmgmt.exe.TaskInstance t0 : actualTasks)
- {
- taskRefs.add( Transform.taskInstance(t0));
- }
-
- List<TaskReference> copy = new ArrayList<TaskReference>();
- for(TaskReference ref : taskRefs)
- {
- copy.add(ref);
- }
- return copy;
- }
-
- public Map<String, String> getAvailableTaskForms(long processId)
- {
- org.jbpm.graph.def.ProcessDefinition processDefinition =
- delegate.getActualDefinition(processId);
-
- return getTask2FileMapping(processDefinition);
- }
-
- private Map<String, String> getTask2FileMapping(ProcessDefinition processDefinition)
- {
- Map<String, String> result = new HashMap<String, String>();
-
- final FileDefinition fileDefinition = processDefinition.getFileDefinition();
- if (! fileDefinition.hasFile("forms.xml"))
- {
- // exit with empty list
- // TODO: maybe an exception is better?
- return result;
- }
-
- final InputStream inputStream = fileDefinition.getInputStream("forms.xml");
- if (inputStream == null)
- {
- throw new RuntimeException("Failed to open stream on forms.xml");
- }
-
- final Document document = XmlUtil.parseXmlInputStream(inputStream);
- final Element documentElement = document.getDocumentElement();
- final NodeList nodeList = documentElement.getElementsByTagName("form");
- final int length = nodeList.getLength();
- for (int i = 0; i < length; i ++)
- {
- final Element element = (Element) nodeList.item(i);
- final String itemTaskName = element.getAttribute("task");
- final String itemFormName = element.getAttribute("form");
- if (itemTaskName == null || itemFormName == null) {
- continue;
- }
- result.put(itemTaskName, itemFormName);
- }
- return result;
- }
-
- public byte[] getTaskFormByTaskName(long processId, long taskId)
- {
- org.jbpm.graph.def.ProcessDefinition processDefinition =
- delegate.getActualDefinition(processId);
- org.jbpm.taskmgmt.exe.TaskInstance t0 = delegate.getTaskById(taskId);
-
- Map<String,String> fileMapping = getTask2FileMapping(processDefinition);
- String fileName = fileMapping.get(t0.getName());
- if(fileName !=null)
- return processDefinition.getFileDefinition().getBytes(fileName);
- else
- throw new RuntimeException("No form definition for taskId '"+taskId+"'");
-
- }
-
- public TaskReference getTaskById(long taskId)
- {
- org.jbpm.taskmgmt.exe.TaskInstance t0 = delegate.getTaskById(taskId);
- TaskReference taskRef = Transform.taskInstance(t0);
- return taskRef;
- }
-
-
- public void reassignTask(long taskId, String actorId)
- {
- // TODO: validation of actorId?
- delegate.assignTask(taskId, actorId);
- }
-
-
- public void closeTask(long taskId, String signalName)
- {
- delegate.endTask(taskId, signalName);
- }
-}
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskManagement.java (from rev 2962, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskDAO.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskManagement.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao.internal;
+
+import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.server.dao.TaskManagement;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JBPM3TaskManagement implements TaskManagement
+{
+
+ private JBPM3CommandDelegate delegate;
+
+ public JBPM3TaskManagement()
+ {
+ this.delegate = new JBPM3CommandDelegate();
+ }
+
+ public List<TaskReference> getTasksByActor(String actorName)
+ {
+
+ List<org.jbpm.taskmgmt.exe.TaskInstance> actualTasks =
+ delegate.getActualTasksForActor(actorName);
+
+ List<TaskReference> taskRefs = new ArrayList<TaskReference>();
+ for(org.jbpm.taskmgmt.exe.TaskInstance t0 : actualTasks)
+ {
+ taskRefs.add( Transform.taskInstance(t0));
+ }
+
+ List<TaskReference> copy = new ArrayList<TaskReference>();
+ for(TaskReference ref : taskRefs)
+ {
+ copy.add(ref);
+ }
+ return copy;
+ }
+
+ public TaskReference getTaskById(long taskId)
+ {
+ org.jbpm.taskmgmt.exe.TaskInstance t0 = delegate.getTaskById(taskId);
+ TaskReference taskRef = Transform.taskInstance(t0);
+ return taskRef;
+ }
+
+
+ public void reassignTask(long taskId, String actorId)
+ {
+ // TODO: validation of actorId?
+ delegate.assignTask(taskId, actorId);
+ }
+
+
+ public void closeTask(long taskId, String signalName)
+ {
+ delegate.endTask(taskId, signalName);
+ }
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3UserManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3UserManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3UserManagement.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao.internal;
+
+import org.jboss.bpm.console.server.dao.UserManagement;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JBPM3UserManagement implements UserManagement
+{
+
+ private JBPM3CommandDelegate delegate;
+
+ public JBPM3UserManagement()
+ {
+ this.delegate = new JBPM3CommandDelegate();
+ }
+
+ public List<String> getGroupsForActor(String actorId)
+ {
+ return delegate.getGroupsForActor(actorId);
+ }
+
+ public List<String> getActorsForGroup(String groupName)
+ {
+ return delegate.getActorsForGroup(groupName);
+ }
+}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/Transform.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/Transform.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/Transform.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -37,7 +37,7 @@
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class Transform
+class Transform
{
public static ProcessDefinition processDefinition(org.jbpm.graph.def.ProcessDefinition p0)
{
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetGroupMembershipCommand.java (from rev 2865, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetGroupMemershipCommand.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetGroupMembershipCommand.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetGroupMembershipCommand.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao.internal.cmd;
+
+import org.jbpm.command.Command;
+import org.jbpm.command.AbstractGetObjectBaseCommand;
+import org.jbpm.JbpmContext;
+import org.jbpm.identity.hibernate.IdentitySession;
+import org.jbpm.identity.User;
+import org.jbpm.identity.Group;
+
+import java.util.Set;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * TODO: Group resolution should be pluggable
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class GetGroupMembershipCommand extends AbstractGetObjectBaseCommand implements Command
+{
+ private static final long serialVersionUID = -1627380259541998349L;
+
+ private String actorName;
+
+ public GetGroupMembershipCommand(String actorName)
+ {
+ super();
+ this.actorName = actorName;
+ }
+
+ public Object execute(JbpmContext jbpmContext) throws Exception
+ {
+ List<String> groupNames = new ArrayList<String>();
+
+ setJbpmContext(jbpmContext);
+
+ IdentitySession session = new IdentitySession(
+ jbpmContext.getSession()
+ );
+
+ User user = session.getUserByName(actorName);
+ Set<Group> groups = (Set<Group>)user.getGroupsForGroupType("organisation");
+
+ for(Group g : groups)
+ {
+ groupNames.add(g.getName());
+ }
+
+ return groupNames;
+ }
+}
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetGroupMemershipCommand.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetGroupMemershipCommand.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetGroupMemershipCommand.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.dao.internal.cmd;
-
-import org.jbpm.command.Command;
-import org.jbpm.command.AbstractGetObjectBaseCommand;
-import org.jbpm.JbpmContext;
-import org.jbpm.identity.hibernate.IdentitySession;
-import org.jbpm.identity.User;
-import org.jbpm.identity.Group;
-
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class GetGroupMemershipCommand extends AbstractGetObjectBaseCommand implements Command
-{
- private static final long serialVersionUID = -1627380259541998349L;
-
- private String actorName;
-
- public GetGroupMemershipCommand(String actorName)
- {
- super();
- this.actorName = actorName;
- }
-
- public Object execute(JbpmContext jbpmContext) throws Exception
- {
- List<String> groupNames = new ArrayList<String>();
-
- setJbpmContext(jbpmContext);
-
- IdentitySession session = new IdentitySession(
- jbpmContext.getSession()
- );
-
- User user = session.getUserByName(actorName);
- Set<Group> groups = (Set<Group>)user.getGroupsForGroupType("organisation");
-
- for(Group g : groups)
- {
- groupNames.add(g.getName());
- }
-
- return groupNames;
- }
-}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetUsersForGroupCommand.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetUsersForGroupCommand.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/cmd/GetUsersForGroupCommand.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao.internal.cmd;
+
+import org.jbpm.command.Command;
+import org.jbpm.command.AbstractGetObjectBaseCommand;
+import org.jbpm.JbpmContext;
+import org.jbpm.identity.hibernate.IdentitySession;
+import org.jbpm.identity.Group;
+import org.jbpm.identity.User;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Set;
+
+/**
+ * TODO: Group resolution should be pluggable
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class GetUsersForGroupCommand extends AbstractGetObjectBaseCommand implements Command
+{
+ private static final long serialVersionUID = -1627380259541998349L;
+
+ private String groupName;
+
+ public GetUsersForGroupCommand(String groupName)
+ {
+ super();
+ this.groupName = groupName;
+ }
+
+ public Object execute(JbpmContext jbpmContext) throws Exception
+ {
+ List<String> userNames = new ArrayList<String>();
+
+ setJbpmContext(jbpmContext);
+
+ IdentitySession session = new IdentitySession(
+ jbpmContext.getSession()
+ );
+
+ Group group = session.getGroupByName(groupName);
+ Set<User> users = group.getUsers();
+ for(User u : users)
+ {
+ userNames.add(u.getName());
+ }
+
+ return userNames;
+ }
+}
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/BufferedResponseWrapper.java (from rev 2755, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/BufferedResponseWrapper.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/BufferedResponseWrapper.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/BufferedResponseWrapper.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.util;
+
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintWriter;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@SuppressWarnings("deprecation")
+public class BufferedResponseWrapper extends HttpServletResponseWrapper
+{
+ private ByteArrayOutputStream output;
+ private int contentLength;
+ private String contentType = "";
+
+ public BufferedResponseWrapper(HttpServletResponse httpServletResponse)
+ {
+ super(httpServletResponse);
+ output=new ByteArrayOutputStream();
+ }
+
+ public byte[] getData() {
+ return output.toByteArray();
+ }
+
+ public ServletOutputStream getOutputStream() {
+ return new FilterServletOutputStream(output);
+ }
+
+ public PrintWriter getWriter() {
+ return new PrintWriter(getOutputStream(),true);
+ }
+
+ public void setContentLength(int length) {
+ this.contentLength = length;
+ super.setContentLength(length);
+ }
+
+ public int getContentLength() {
+ return contentLength;
+ }
+
+ public void setContentType(String type) {
+ this.contentType = type;
+ super.setContentType(type);
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/BufferedResponseWrapper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/FilterServletOutputStream.java (from rev 2755, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/FilterServletOutputStream.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/FilterServletOutputStream.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/FilterServletOutputStream.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.util;
+
+import javax.servlet.ServletOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class FilterServletOutputStream extends ServletOutputStream
+{
+
+ private DataOutputStream stream;
+
+ public FilterServletOutputStream(OutputStream output) {
+ stream = new DataOutputStream(output);
+ }
+
+ public void write(int b) throws IOException {
+ stream.write(b);
+ }
+
+ public void write(byte[] b) throws IOException {
+ stream.write(b);
+ }
+
+ public void write(byte[] b, int off, int len) throws IOException
+ {
+ stream.write(b,off,len);
+ }
+
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/FilterServletOutputStream.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/GWTJsonFilter.java (from rev 2755, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/GWTJsonFilter.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/GWTJsonFilter.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/GWTJsonFilter.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.util;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class GWTJsonFilter implements Filter
+{
+
+ public FilterConfig filterConfig;
+ private static final String COLLECTION_PREFIX = "{\"wrapper\":";
+ private static final String COLLECTION_SUFFIX = "}";
+
+ public void init(FilterConfig filterConfig) throws ServletException
+ {
+ this.filterConfig = filterConfig;
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+ throws IOException, ServletException
+ {
+
+ boolean isSOPCallback = false;
+
+ // identify GWT json requests
+ if(request.getParameter("callback")!=null)
+ isSOPCallback = true;
+
+ // sneak in repsonse wrapper
+ OutputStream out = response.getOutputStream();
+ BufferedResponseWrapper wrapper = new BufferedResponseWrapper((HttpServletResponse) response);
+
+ // proceed chain
+ chain.doFilter(request, wrapper);
+
+ // add callback std. json output
+ String contentType = response.getContentType() != null ? response.getContentType() : "application/octet-stream";
+ boolean isJSONEncoding = contentType.equals("application/json");
+ StringBuffer sb = null;
+ if(isJSONEncoding)
+ {
+ String payload = new String(wrapper.getData());
+ String gwtextFriendly = trimPayload(payload);
+
+ sb = new StringBuffer();
+
+ if(isSOPCallback)
+ {
+ sb.append(request.getParameter("callback"));
+ sb.append("(");
+ }
+
+ // Strip wrapper when JSONRequest
+ sb.append(gwtextFriendly);
+
+ if(isSOPCallback)
+ {
+ sb.append(");");
+ }
+
+ }
+
+ // flush
+ if(sb!=null)
+ out.write(sb.toString().getBytes());
+ else
+ out.write(wrapper.getData());
+
+ out.flush();
+ out.close();
+ }
+
+ private String trimPayload(String payload)
+ {
+ String s = payload;
+ if(s.startsWith(COLLECTION_PREFIX))
+ {
+ s = payload.substring( COLLECTION_PREFIX.length(), payload.lastIndexOf(COLLECTION_SUFFIX));
+ }
+ return s;
+ }
+
+ public void destroy()
+ {
+
+ }
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/GWTJsonFilter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/gwt-console/trunk/server/src/main/webapp/WEB-INF/web.xml
===================================================================
--- projects/gwt-console/trunk/server/src/main/webapp/WEB-INF/web.xml 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/server/src/main/webapp/WEB-INF/web.xml 2008-11-19 13:04:27 UTC (rev 2996)
@@ -16,13 +16,13 @@
</context-param>
<context-param>
- <param-name>org.jboss.bpm.console.server.dao.DAOFactory</param-name>
- <param-value>org.jboss.bpm.console.server.dao.internal.JBPM3DAOFactory</param-value>
+ <param-name>org.jboss.bpm.console.server.dao.ManagementFactory</param-name>
+ <param-value>org.jboss.bpm.console.server.dao.internal.JBPM3ManagementFactory</param-value>
</context-param>
<filter>
<filter-name>gwtJSON</filter-name>
- <filter-class>org.jboss.bpm.console.server.GWTJsonFilter</filter-class>
+ <filter-class>org.jboss.bpm.console.server.util.GWTJsonFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>gwtJSON</filter-name>
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/UIConstants.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/UIConstants.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/UIConstants.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -33,4 +33,6 @@
public static final int EDITOR_WIDTH = 680;
public static final int TEASER_PANEL_WIDTH = 200;
public static final int EDITOR_PANEL_WIDTH = 450;
+
+ public static final String DEFAULT_TRANSITION = "(Default transition)";
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -39,7 +39,7 @@
this.consoleServerUrl = consoleServerUrl;
this.webContext = webContext;
- Log.debug("Using gwt-console-server: " + consoleServerUrl + "/" +webContext);
+ Log.debug("Using gwt-console-server: " + getBaseUrl());
}
public String getConsoleServerUrl()
@@ -76,7 +76,7 @@
if(i<possibleRoles.length-1)
sb.append(",");
}
- return getBaseUrl() + "/rs/user/roles?roleCheck="+sb.toString();
+ return getBaseUrl() + "/rs/identity/user/roles?roleCheck="+sb.toString();
}
@Deprecated
@@ -151,4 +151,10 @@
String encodedSignal = URL.encode(signal);
return getBaseUrl() + "/rs/jbpm3/tokens/"+tok.getId()+"/transition?signal="+encodedSignal;
}
+
+ public String getGroupsForActorUrl(String actorId)
+ {
+ return getBaseUrl() + "/rs/identity/user/"+actorId+"/groups";
+ }
+
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -239,4 +239,24 @@
return rt;
}
+ public static List<String> parseStringArray(JSONValue jso)
+ {
+ List<String> result = new ArrayList<String>();
+
+ JSONArray jsonArray = jso.isArray();
+
+ if(null==jsonArray)
+ throw new IllegalArgumentException("Not an array: " +jso);
+
+ for(int i=0; i<jsonArray.size(); i++)
+ {
+ JSONValue jsonValue = jsonArray.get(i);
+ if(jsonValue.toString().equals("null"))
+ continue; // TODO: JBPM-1828
+ JSONString item = jsonValue.isString();
+ result.add(item.stringValue());
+ }
+
+ return result;
+ }
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -44,10 +44,7 @@
import org.jboss.bpm.console.client.model.ProcessDefinition;
import org.jboss.bpm.console.client.model.ProcessInstance;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
-import org.jboss.bpm.console.client.widgets.HelpPanel;
-import org.jboss.bpm.console.client.widgets.TeaserPanel;
-import org.jboss.bpm.console.client.widgets.TokenEditor;
-import org.jboss.bpm.console.client.widgets.TokenForm;
+import org.jboss.bpm.console.client.widgets.*;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
@@ -137,7 +134,7 @@
// ---------------
- detailsForm = createBaseFormPanel();
+ detailsForm = FormWidgets.createBaseFormPanel();
// ---------------
@@ -230,23 +227,12 @@
return outerFormPanel;
}
- private FormPanel createBaseFormPanel()
- {
- final FormPanel formPanel = new FormPanel();
- formPanel.setLabelAlign(Position.LEFT);
- formPanel.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
- formPanel.setHeader(false);
- formPanel.setFrame(false);
- formPanel.setBorder(false);
- formPanel.setPaddings(5, 5, 5, 0);
- formPanel.setLabelWidth(120);
- return formPanel;
- }
+
private void remoteSignal(TokenReference tok, String signal)
{
- String url = signal.equals(TokenForm.DEFAULT_TRANSITION) ?
+ String url = signal.equals(UIConstants.DEFAULT_TRANSITION) ?
view.getUrlBuilder().getTokenSignalUrl(tok) :
view.getUrlBuilder().getTokenSignalUrl(tok, signal);
Added: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentCallback.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentCallback.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentCallback.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.task;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface AssignmentCallback
+{
+ void onAssignmentDone();
+}
Added: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,180 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.task;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.http.client.*;
+import com.google.gwt.json.client.JSONParser;
+import com.google.gwt.json.client.JSONValue;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.data.Record;
+import com.gwtext.client.widgets.*;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.event.PanelListenerAdapter;
+import com.gwtext.client.widgets.form.Form;
+import com.gwtext.client.widgets.form.FormPanel;
+import org.jboss.bpm.console.client.MainView;
+import org.jboss.bpm.console.client.model.DTOParser;
+import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.client.widgets.FormWidgets;
+import org.jboss.bpm.console.client.widgets.ModelChangeListener;
+import org.jboss.bpm.console.client.widgets.ModelListenerRegistry;
+import org.jboss.bpm.console.client.widgets.RefreshableComboBox;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class AssignmentFormPanel extends Panel implements ModelChangeListener
+{
+ private FormPanel formPanel;
+
+ private MainView mainView;
+ private AssignmentCallback callback;
+
+ private List<String> selectedGroups;
+
+ public AssignmentFormPanel(MainView mainView, AssignmentCallback callback)
+ {
+ super();
+ this.mainView = mainView;
+ this.callback = callback;
+
+ setTitle("Assigment");
+ setBorder(false);
+ setFrame(false);
+
+ // ---------------
+
+ formPanel = FormWidgets.createBaseFormPanel();
+ RefreshableComboBox cb = new RefreshableComboBox("actorId", "Actor");
+ formPanel.add(cb);
+
+ final Button assignBtn = new Button("Assign",
+ new ButtonListenerAdapter()
+ {
+
+ public void onClick(Button button, EventObject eventObject)
+ {
+
+ Form form = formPanel.getForm();
+ RefreshableComboBox cb = (RefreshableComboBox)form.findField("actorId");
+ String rawValue = cb.getRawValue();
+
+ if(null==rawValue || rawValue.equals(""))
+ {
+ MessageBox.alert("Please select an actor.");
+ return;
+ }
+
+ // TODO: implement
+ Log.debug("Assign to " + rawValue);
+
+ }
+ }
+ );
+
+ formPanel.add(assignBtn);
+ this.add(formPanel);
+
+ // ---------------
+ this.addListener(
+ new PanelListenerAdapter()
+ {
+
+
+ public void onAfterLayout(Container container)
+ {
+ refreshComboBox();
+ }
+ }
+ );
+
+ }
+
+
+ public void onModelChange(ModelListenerRegistry parent, Object changeEvent)
+ {
+ TaskListEditor editor = (TaskListEditor)parent.getUnderlying();
+ TaskReference taskRef = (TaskReference)changeEvent;
+
+ Log.debug("onModelChange " + taskRef);
+ selectedGroups = null;
+
+ String resourceUrl = mainView.getUrlBuilder().getGroupsForActorUrl(mainView.getUsername());
+ updateAssigmentForm(resourceUrl);
+ }
+
+
+ public void onRecordChange(ModelListenerRegistry parent, Record record)
+ {
+ // ignore
+ }
+
+ private void updateAssigmentForm(String url)
+ {
+ RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url );
+
+ try
+ {
+ rb.sendRequest(null,
+ new RequestCallback() {
+
+ public void onResponseReceived(Request request, Response response)
+ {
+ if(200 != response.getStatusCode())
+ Log.error("Failed to retrieve groups: " + response.getStatusText());
+
+ JSONValue value = JSONParser.parse(response.getText());
+
+ selectedGroups = DTOParser.parseStringArray(value);
+
+ if(isRendered())
+ refreshComboBox();
+
+ Log.debug("Update from " + selectedGroups);
+ }
+
+ public void onError(Request request, Throwable t)
+ {
+ // Unknown error
+ Log.error("Unknown error", t);
+ }
+ });
+ }
+ catch (RequestException e1)
+ {
+ Log.error("Request failed" ,e1);
+ }
+ }
+
+ private void refreshComboBox()
+ {
+ if(null==selectedGroups)
+ throw new IllegalArgumentException("Group list cannot be null");
+
+ Form form = formPanel.getForm();
+ RefreshableComboBox cb = (RefreshableComboBox)form.findField("actorId");
+ cb.display(selectedGroups);
+ }
+}
Added: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/DetailsFormPanel.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/DetailsFormPanel.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/DetailsFormPanel.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,274 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.task;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.http.client.*;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.data.Record;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.MessageBox;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.form.ComboBox;
+import com.gwtext.client.widgets.form.Form;
+import com.gwtext.client.widgets.form.FormPanel;
+import com.gwtext.client.widgets.form.TextField;
+import org.jboss.bpm.console.client.MainView;
+import org.jboss.bpm.console.client.UIConstants;
+import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.client.widgets.FormWidgets;
+import org.jboss.bpm.console.client.widgets.ModelChangeListener;
+import org.jboss.bpm.console.client.widgets.ModelListenerRegistry;
+import org.jboss.bpm.console.client.widgets.RefreshableComboBox;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class DetailsFormPanel extends Panel implements ModelChangeListener
+{
+
+ private FormPanel formPanel;
+ private TaskReference selectedInstance;
+ private MainView mainView;
+
+ private Button startBtn;
+ private Button stopBtn;
+ private Button endBtn;
+
+ private AssignmentCallback callback;
+
+ public DetailsFormPanel(final MainView mainView, AssignmentCallback callback)
+ {
+ super();
+ this.mainView = mainView;
+ this.callback = callback;
+
+ setTitle("Task Details");
+ setBorder(false);
+ setFrame(false);
+
+ // ---------------
+
+ formPanel = FormWidgets.createBaseFormPanel();
+
+ //the field names must match the data field values from the Store
+ TextField idField = new TextField("Id", "id", 230);
+ idField.setReadOnly(true);
+ formPanel.add(idField);
+
+ TextField nameField = new TextField("Name", "name", 230);
+ nameField.setReadOnly(true);
+ formPanel.add(nameField);
+
+ TextField actorField = new TextField("Actor", "actor", 230);
+ actorField.setReadOnly(true);
+ formPanel.add(actorField);
+
+ TextField stateField = new TextField("State", "currentState", 230);
+ stateField.setReadOnly(true);
+ formPanel.add(stateField);
+
+ // ----------
+ RefreshableComboBox cb = new RefreshableComboBox("signal", "End signal");
+ formPanel.add(cb);
+
+ startBtn = new Button("Assign current user",
+ new ButtonListenerAdapter()
+ {
+
+ public void onClick(Button button, EventObject eventObject)
+ {
+ if(null==selectedInstance)
+ {
+ MessageBox.alert("Please select a task.");
+ return;
+ }
+ selectedInstance.setActor(mainView.getUsername());
+ reassignTask();
+ }
+ }
+ );
+
+ stopBtn = new Button("Release",
+ new ButtonListenerAdapter()
+ {
+
+ public void onClick(Button button, EventObject eventObject)
+ {
+ if(null==selectedInstance)
+ {
+ MessageBox.alert("Please select a task.");
+ return;
+ }
+ selectedInstance.setActor(null);
+ reassignTask();
+ }
+ }
+ );
+
+ endBtn = new Button("End",
+ new ButtonListenerAdapter()
+ {
+
+ public void onClick(Button button, EventObject eventObject)
+ {
+ if(null==selectedInstance)
+ {
+ MessageBox.alert("Please select a task.");
+ return;
+ }
+
+ selectedInstance.close();
+
+ ComboBox cb = (ComboBox) formPanel.getForm().findField("signal");
+ String signalName = cb.getRawValue();
+ if(signalName.equals(""))
+ MessageBox.alert("Please select a signal to end this task");
+ else
+ endTask(signalName);
+ }
+ }
+ );
+
+ formPanel.addButton(startBtn);
+ formPanel.addButton(stopBtn);
+ formPanel.addButton(endBtn);
+
+ this.add(formPanel);
+ }
+
+ private void reassignTask()
+ {
+ RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,
+ mainView.getUrlBuilder().getTaskAssignmentURL(
+ selectedInstance.getId(), selectedInstance.getActor()
+ )
+ );
+
+ try
+ {
+ rb.sendRequest("",
+ new RequestCallback() {
+
+ public void onResponseReceived(Request request, Response response)
+ {
+ if(200 != response.getStatusCode())
+ Log.error("Failed to reassign task: " + response.getStatusText());
+
+ selectedInstance = null;
+ callback.onAssignmentDone();
+ }
+
+ public void onError(Request request, Throwable t)
+ {
+ // Unknown error
+ Log.error("Unknown error", t);
+ }
+ });
+ }
+ catch (RequestException e1)
+ {
+ Log.error("Request failed" ,e1);
+ }
+ }
+
+ private void endTask(String signalName)
+ {
+ String taskCloseURL = signalName.equals(UIConstants.DEFAULT_TRANSITION) ?
+ mainView.getUrlBuilder().getTaskEndURL(selectedInstance.getId()) :
+ mainView.getUrlBuilder().getTaskEndURL(selectedInstance.getId(), signalName);
+
+ RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,
+ taskCloseURL
+ );
+
+ Log.debug(taskCloseURL);
+
+ try
+ {
+ rb.sendRequest("",
+ new RequestCallback() {
+
+ public void onResponseReceived(Request request, Response response)
+ {
+ if(200 != response.getStatusCode())
+ Log.error("Failed to end task: " + response.getStatusText());
+
+ selectedInstance = null;
+ }
+
+ public void onError(Request request, Throwable t)
+ {
+ // Unknown error
+ Log.error("Unknown error", t);
+ }
+ });
+ }
+ catch (RequestException e1)
+ {
+ Log.error("Failed to close task", e1);
+ }
+ }
+
+
+ public void onRecordChange(ModelListenerRegistry parent, Record changeEvent)
+ {
+ TaskListEditor editor = (TaskListEditor)parent.getUnderlying();
+ selectedInstance = TaskList.transform(changeEvent);
+
+ Form form = formPanel.getForm();
+ RefreshableComboBox cb = (RefreshableComboBox)form.findField("signal");
+
+ if(!selectedInstance.hasPooledActors())
+ {
+ // no group assignment available
+ startBtn.disable();
+ stopBtn.disable();
+ }
+ else if(TaskReference.STATE.IN_PROGRESS == selectedInstance.getCurrentState())
+ {
+ startBtn.disable();
+ stopBtn.enable();
+ cb.enable();
+ endBtn.enable();
+ }
+ else
+ {
+ startBtn.enable();
+ stopBtn.disable();
+ cb.disable();
+ endBtn.disable();
+ }
+
+ cb.display( selectedInstance.getTransitionNames() );
+
+ formPanel.getForm().loadRecord(changeEvent);
+ formPanel.doLayout();
+ }
+
+
+ public void onModelChange(ModelListenerRegistry parent, Object changeEvent)
+ {
+ // ignore
+ }
+}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -21,18 +21,12 @@
*/
package org.jboss.bpm.console.client.task;
-import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.http.client.*;
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.core.Position;
-import com.gwtext.client.data.*;
-import com.gwtext.client.widgets.*;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.data.Record;
+import com.gwtext.client.widgets.Component;
+import com.gwtext.client.widgets.PaddedPanel;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.TabPanel;
import com.gwtext.client.widgets.event.PanelListenerAdapter;
-import com.gwtext.client.widgets.form.FormPanel;
-import com.gwtext.client.widgets.form.TextField;
-import com.gwtext.client.widgets.form.ComboBox;
-import com.gwtext.client.widgets.form.Form;
import com.gwtext.client.widgets.grid.RowSelectionModel;
import com.gwtext.client.widgets.grid.event.RowSelectionListenerAdapter;
import com.gwtext.client.widgets.layout.ColumnLayout;
@@ -41,15 +35,14 @@
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.client.widgets.ModelChangeListener;
+import org.jboss.bpm.console.client.widgets.ModelListenerRegistry;
import org.jboss.bpm.console.client.widgets.TeaserPanel;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class TaskListEditor extends Editor
+public class TaskListEditor extends Editor implements AssignmentCallback
{
public final static String ID = "org.jboss.bpm.task.TaskList";
@@ -57,37 +50,24 @@
private TaskList taskList;
private Panel teaserPanel;
private boolean initialized;
-
- private Panel formContainer;
-
- private TaskReference selectedInstance;
-
private TabPanel tabPanel;
- private FormPanel formPanel;
+ private ModelListenerRegistry modelListeners;
-
- public static final String DEFAULT_TRANSITION = "(Default transition)";
-
- final ArrayReader reader = new ArrayReader(new RecordDef(
- new FieldDef[]{
- new StringFieldDef("signal")
- }
- ));
-
- public TaskListEditor(MainView mainView )
+ public TaskListEditor(MainView mainView)
{
super();
this.setId(ID);
this.mainView = mainView;
+ this.modelListeners = new ModelListenerRegistry(this);
+
this.setLayout( new ColumnLayout() );
this.setWidth(UIConstants.EDITOR_WIDTH);
this.addListener(
new PanelListenerAdapter()
{
-
public boolean doBeforeRender(Component component)
{
return beforeRenderCallback();
@@ -126,7 +106,7 @@
leftHand.setBorder(false);
// ----------------------------------
-
+
tabPanel = new TabPanel();
tabPanel.setPaddings(10);
tabPanel.setPlain(true);
@@ -138,27 +118,42 @@
// ----------------------------------
taskList = new TaskList("Task overview", mainView);
+ final RowSelectionModel sm = new RowSelectionModel(true);
+ sm.addListener(
+ new RowSelectionListenerAdapter()
+ {
+ public void onRowSelect(RowSelectionModel sm, int rowIndex, Record record)
+ {
+ TaskReference taskRef = TaskList.transform(record);
+ modelListeners.fireRecordChangeEvent(record);
+ modelListeners.fireModelChangeEvent(taskRef);
+ }
+ }
+ );
+ taskList.setRowSelectionModel(sm);
leftHand.add(taskList);
// ----------------------------------
- Panel detailsFormPanel = assembleDetailsForm();
- tabPanel.add(detailsFormPanel);
- tabPanel.add( new Panel("Assignment") );
+ Panel detailsPanel = new DetailsFormPanel(mainView, this);
+ Panel assignmentPanel = new AssignmentFormPanel(mainView, this);
- formContainer = new Panel("Data");
- formContainer.setPaddings(10);
- formContainer.setBorder(false);
- //tabPanel.add(formContainer);
+ modelListeners.addListener((ModelChangeListener)detailsPanel);
+ modelListeners.addListener((ModelChangeListener)assignmentPanel);
+ tabPanel.add( detailsPanel );
+ tabPanel.add( assignmentPanel );
+
+ // ----------------------------------
+
leftHand.add(tabPadding);
// ----------------------------------
teaserPanel = new TeaserPanel();
- // ----------------------------------
-
+ // ----------------------------------
+
this.add(leftHand, new ColumnLayoutData(0.7) );
this.add(teaserPanel , new ColumnLayoutData(0.3) );
@@ -170,373 +165,8 @@
return true;
}
- public Panel getFormContainer()
+ public void onAssignmentDone()
{
- return formContainer;
+ taskList.reloadStore();
}
-
- private Panel assembleDetailsForm()
- {
- // ---------------
-
- Panel outerFormPanel = new Panel();
- outerFormPanel.setTitle("Task Details");
- outerFormPanel.setBorder(false);
- outerFormPanel.setFrame(false);
-
- // ---------------
-
- formPanel = new FormPanel();
- formPanel.setLabelAlign(Position.LEFT);
- formPanel.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
- formPanel.setHeader(false);
- formPanel.setFrame(false);
- formPanel.setBorder(false);
- formPanel.setPaddings(5, 5, 5, 0);
- formPanel.setLabelWidth(120);
-
- //the field names must match the data field values from the Store
- TextField idField = new TextField("Id", "id", 230);
- idField.setReadOnly(true);
- formPanel.add(idField);
-
- TextField nameField = new TextField("Name", "name", 230);
- nameField.setReadOnly(true);
- formPanel.add(nameField);
-
- TextField actorField = new TextField("Actor", "actor", 230);
- actorField.setReadOnly(true);
- formPanel.add(actorField);
-
- TextField stateField = new TextField("State", "currentState", 230);
- stateField.setReadOnly(true);
- formPanel.add(stateField);
-
- // ----------
- MemoryProxy dataProxy = createMemoryProxy(new ArrayList<String>());
- Store store = new Store(dataProxy, reader);
- store.load();
-
- ComboBox cb = new ComboBox();
- cb.setFieldLabel("End signal");
- cb.setHiddenName("signal");
- cb.setStore(store);
- cb.setDisplayField("signal");
- cb.setMode(ComboBox.LOCAL);
- cb.setTriggerAction(ComboBox.ALL);
- cb.setEmptyText("");
- cb.setSelectOnFocus(true);
- cb.setWidth(190);
- cb.setEditable(false);
- formPanel.add(cb);
-
- final Button startBtn = new Button("Assign current user",
- new ButtonListenerAdapter()
- {
-
- public void onClick(Button button, EventObject eventObject)
- {
- if(null==selectedInstance)
- {
- MessageBox.alert("Please select a task.");
- return;
- }
- selectedInstance.setActor(mainView.getUsername());
- reassignTask();
- }
- }
- );
-
- final Button stopBtn = new Button("Release",
- new ButtonListenerAdapter()
- {
-
- public void onClick(Button button, EventObject eventObject)
- {
- if(null==selectedInstance)
- {
- MessageBox.alert("Please select a task.");
- return;
- }
- selectedInstance.setActor(null);
- reassignTask();
- }
- }
- );
-
- final Button endBtn = new Button("End",
- new ButtonListenerAdapter()
- {
-
- public void onClick(Button button, EventObject eventObject)
- {
- if(null==selectedInstance)
- {
- MessageBox.alert("Please select a task.");
- return;
- }
-
- selectedInstance.close();
-
- ComboBox cb = (ComboBox)formPanel.getForm().findField("signal");
- String signalName = cb.getRawValue();
- if(signalName.equals(""))
- MessageBox.alert("Please select a signal to end this task");
- else
- endTask(signalName);
- }
- }
- );
-
-
- /*Button examineButton = new Button("Examine", new ButtonListenerAdapter()
- {
- public void onClick(Button button, EventObject e)
- {
- if (null == selectedInstance)
- MessageBox.alert("Please select a process.");
- else
- onExamine(selectedInstance);
- }
- });
- examineButton.setTooltip("Examine");
- formPanel.add(examineButton);
- */
-
- formPanel.addButton(startBtn);
- formPanel.addButton(stopBtn);
-
-
- formPanel.addButton(endBtn);
-
-
- // ----------------
-
- final RowSelectionModel sm = new RowSelectionModel(true);
- sm.addListener(
- new RowSelectionListenerAdapter()
- {
- public void onRowSelect(RowSelectionModel sm, int rowIndex, Record record)
- {
- selectedInstance = TaskList.transform(record);
- Form form = formPanel.getForm();
- ComboBox signals = (ComboBox)form.findField("signal");
-
- if(!selectedInstance.hasPooledActors())
- {
- // no group assignment available
- startBtn.disable();
- stopBtn.disable();
- }
- else if(TaskReference.STATE.IN_PROGRESS == selectedInstance.getCurrentState())
- {
- startBtn.disable();
- stopBtn.enable();
- signals.enable();
- endBtn.enable();
- }
- else
- {
- startBtn.enable();
- stopBtn.disable();
- signals.disable();
- endBtn.disable();
- }
-
- // refresh combo box
-
- signals.reset();
-
- MemoryProxy dataProxy = createMemoryProxy(selectedInstance.getTransitionNames());
- Store store = new Store(dataProxy, reader);
- store.load();
- signals.setStore(store);
-
- formPanel.getForm().loadRecord(record);
- formPanel.doLayout();
- }
- }
- );
- taskList.setRowSelectionModel(sm);
-
- outerFormPanel.add(formPanel);
-
- return outerFormPanel;
- }
-
- private void reassignTask()
- {
- RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,
- mainView.getUrlBuilder().getTaskAssignmentURL(
- selectedInstance.getId(), selectedInstance.getActor()
- )
- );
-
- try
- {
- rb.sendRequest("",
- new RequestCallback() {
-
- public void onResponseReceived(Request request, Response response)
- {
- if(200 != response.getStatusCode())
- Log.error("Failed to reassign task: " + response.getStatusText());
-
- taskList.reloadStore();
- selectedInstance = null;
- }
-
- public void onError(Request request, Throwable t)
- {
- // Unknown error
- Log.error("Unknown error", t);
- }
- });
- }
- catch (RequestException e1)
- {
- Log.error("Request failed" ,e1);
- }
- }
-
- private void endTask(String signalName)
- {
- String taskCloseURL = signalName.equals(DEFAULT_TRANSITION) ?
- mainView.getUrlBuilder().getTaskEndURL(selectedInstance.getId()) :
- mainView.getUrlBuilder().getTaskEndURL(selectedInstance.getId(), signalName);
-
- RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,
- taskCloseURL
- );
-
- Log.debug(taskCloseURL);
-
- try
- {
- rb.sendRequest("",
- new RequestCallback() {
-
- public void onResponseReceived(Request request, Response response)
- {
- if(200 != response.getStatusCode())
- Log.error("Failed to end task: " + response.getStatusText());
-
- taskList.reloadStore();
- selectedInstance = null;
- }
-
- public void onError(Request request, Throwable t)
- {
- // Unknown error
- Log.error("Unknown error", t);
- }
- });
- }
- catch (RequestException e1)
- {
- Log.error("Failed to close task", e1);
- }
- }
-
- /*protected void onExamine(final TaskReference selectedInstance)
- {
- String url = mainView.getUrlBuilder().getTaskFormDefURL(
- selectedInstance.getProcessId(), selectedInstance.getId());
-
- MessageBox.show(new MessageBoxConfig() {
- {
- setMsg("Generate form, please wait.");
- setProgressText("Loading...");
- setWidth(300);
- setWait(true);
- setWaitConfig(new WaitConfig() {
- {
- setInterval(200);
- }
- });
- }
- });
-
- JSONRequest.get(url,
- new JSONRequestHandler() {
-
- public void onRequestComplete(JavaScriptObject json)
- {
- JSONObject root = new JSONObject(json);
- FormDef formDef = null;
- try
- {
- formDef = DTOParser.parseFormDef(root);
- }
- catch (Throwable e)
- {
- Log.error("FormDef parsing failed", e);
- }
-
- MessageBox.hide();
-
- // generate form
- FormPanel formPanel = new FormPanel();
-
- // -----------
-
- FieldSet fieldSet = new FieldSet();
- fieldSet.setLabelWidth(90);
- fieldSet.setTitle(selectedInstance.getName());
- fieldSet.setAutoHeight(true);
- fieldSet.setBorder(false);
-
- // -----------
- for(org.jboss.bpm.console.client.model.forms.FieldDef fieldDef : formDef.getFields())
- {
- switch(fieldDef.getInputType())
- {
- case TEXT:
- fieldSet.add( new TextField(fieldDef.getLabel(), fieldDef.getVarname()) );
- break;
- case TEXTAREA:
- fieldSet.add( new TextArea(fieldDef.getLabel(), fieldDef.getVarname()));
- break;
- case BOOL:
- fieldSet.add( new Radio(fieldDef.getLabel(), fieldDef.getVarname()));
- break;
- default:
- Log.debug("Unknown input type:" + fieldDef.getInputType());
- }
- }
-
- // -----------
-
- Panel inner = new PaddedPanel(fieldSet, 0, 10, 0, 0);
- formPanel.add(inner);
-
- // -----------
- displayForm(formPanel);
- }
- }
- );
- }
-
- private void displayForm(FormPanel formPanel)
- {
-
- final Window window = new Window();
- window.setTitle("Task form");
- window.setClosable(true);
- window.setWidth(320);
- window.setHeight(240);
- window.setPlain(true);
- window.setCloseAction(Window.HIDE);
- window.add( formPanel );
- window.show("");
- } */
-
- private MemoryProxy createMemoryProxy(List signals)
- {
- if(signals.isEmpty())
- signals.add(DEFAULT_TRANSITION);
- return new MemoryProxy(
- new Object[][]{ signals.toArray()}
- );
- }
}
Added: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/FormWidgets.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/FormWidgets.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/FormWidgets.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.widgets;
+
+import com.gwtext.client.core.Position;
+import com.gwtext.client.widgets.form.FormPanel;
+import org.jboss.bpm.console.client.UIConstants;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class FormWidgets
+{
+ public static FormPanel createBaseFormPanel()
+ {
+ final FormPanel formPanel = new FormPanel();
+ formPanel.setLabelAlign(Position.LEFT);
+ formPanel.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
+ formPanel.setHeader(false);
+ formPanel.setFrame(false);
+ formPanel.setBorder(false);
+ formPanel.setPaddings(5, 5, 5, 0);
+ formPanel.setLabelWidth(120);
+ return formPanel;
+ }
+
+
+}
Added: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelChangeListener.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelChangeListener.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelChangeListener.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.widgets;
+
+import com.gwtext.client.data.Record;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ModelChangeListener
+{
+ void onModelChange(ModelListenerRegistry parent, Object changeEvent);
+ void onRecordChange(ModelListenerRegistry parent, Record record);
+}
Added: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelListenerRegistry.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelListenerRegistry.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelListenerRegistry.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.widgets;
+
+import com.gwtext.client.data.Record;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Utility to propaget model change events across widgets
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ModelListenerRegistry
+{
+ private List<ModelChangeListener> listeners = new ArrayList<ModelChangeListener>();
+
+ private Object underlying;
+
+ public ModelListenerRegistry(Object underlying)
+ {
+ this.underlying = underlying;
+ }
+
+ public void addListener(ModelChangeListener listener)
+ {
+ this.listeners.add(listener);
+ }
+
+ public void fireRecordChangeEvent(Record record)
+ {
+ for(ModelChangeListener l : listeners)
+ {
+ l.onRecordChange(this, record);
+ }
+ }
+
+ public void fireModelChangeEvent(Object event)
+ {
+ for(ModelChangeListener l : listeners)
+ {
+ l.onModelChange(this, event);
+ }
+ }
+
+ public Object getUnderlying()
+ {
+ return underlying;
+ }
+}
Added: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RefreshableComboBox.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RefreshableComboBox.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RefreshableComboBox.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.widgets;
+
+import com.gwtext.client.widgets.form.ComboBox;
+import com.gwtext.client.data.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.bpm.console.client.UIConstants;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class RefreshableComboBox extends ComboBox
+{
+
+ private final Reader reader;
+
+ public RefreshableComboBox(String fieldName, String label)
+ {
+ super();
+ this.reader = new ArrayReader(new RecordDef(
+ new FieldDef[]{
+ new StringFieldDef(fieldName)
+ }
+ ));
+
+ MemoryProxy dataProxy = createMemoryProxy(new ArrayList<String>());
+ Store store = new Store(dataProxy, reader);
+ store.load();
+
+ setFieldLabel(label);
+ setHiddenName(fieldName);
+ setStore(store);
+ setDisplayField(fieldName);
+ setMode(ComboBox.LOCAL);
+ setTriggerAction(ComboBox.ALL);
+ setEmptyText("");
+ setSelectOnFocus(true);
+ setWidth(190);
+ setEditable(false);
+ }
+
+ private MemoryProxy createMemoryProxy(List<String> items)
+ {
+ if(items.isEmpty())
+ items.add(UIConstants.DEFAULT_TRANSITION);
+
+ Object[][] objs = new Object[items.size()][];
+ int i=0;
+ for(String s : items)
+ {
+ objs[i] = new Object[]{s};
+ i++;
+ }
+
+ return new MemoryProxy(objs);
+ }
+
+ public void display(List<String> items)
+ {
+ super.reset();
+
+ MemoryProxy dataProxy = createMemoryProxy(items);
+ Store store = new Store(dataProxy, reader);
+ store.load();
+ super.setStore(store);
+ }
+}
\ No newline at end of file
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -24,7 +24,6 @@
import com.gwtext.client.core.EventObject;
import com.gwtext.client.data.Node;
import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.layout.HorizontalLayout;
import com.gwtext.client.widgets.layout.ColumnLayout;
import com.gwtext.client.widgets.layout.ColumnLayoutData;
import com.gwtext.client.widgets.tree.TreeNode;
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java 2008-11-19 12:54:44 UTC (rev 2995)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java 2008-11-19 13:04:27 UTC (rev 2996)
@@ -23,7 +23,6 @@
import com.gwtext.client.core.EventObject;
import com.gwtext.client.core.Position;
-import com.gwtext.client.data.*;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.MessageBox;
import com.gwtext.client.widgets.Panel;
@@ -36,9 +35,6 @@
import org.jboss.bpm.console.client.model.ProcessInstance;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
@@ -46,15 +42,8 @@
{
private final FormPanel tokenForm;
private final Button signalButton;
- final ArrayReader reader = new ArrayReader(new RecordDef(
- new FieldDef[]{
- new StringFieldDef("signal")
- }
- ));
-
private TokenReference lastSelectedToken;
- public static final String DEFAULT_TRANSITION = "(Default transition)";
-
+
public TokenForm(final TokenEditor.SignalCallback callback)
{
super();
@@ -85,21 +74,7 @@
// ----------
- MemoryProxy dataProxy = createMemoryProxy(new ArrayList<String>());
- Store store = new Store(dataProxy, reader);
- store.load();
-
- ComboBox cb = new ComboBox();
- cb.setFieldLabel("Signal");
- cb.setHiddenName("signal");
- cb.setStore(store);
- cb.setDisplayField("signal");
- cb.setMode(ComboBox.LOCAL);
- cb.setTriggerAction(ComboBox.ALL);
- cb.setEmptyText("");
- cb.setSelectOnFocus(true);
- cb.setWidth(190);
- cb.setEditable(false);
+ RefreshableComboBox cb = new RefreshableComboBox("signal", "Signal");
tokenForm.add(cb);
final ButtonListenerAdapter listenerAdapter = new ButtonListenerAdapter()
@@ -147,15 +122,11 @@
form.findField("id").setRawValue(tok.getId()+"");
form.findField("nodeName").setRawValue(tok.getCurrentNodeName());
- // refresh combo box
- ComboBox cb = (ComboBox)form.findField("signal");
+ // display combo box
+ RefreshableComboBox cb = (RefreshableComboBox)form.findField("signal");
cb.reset();
-
- MemoryProxy dataProxy = createMemoryProxy(tok.getAvailableSignals());
- Store store = new Store(dataProxy, reader);
- store.load();
- cb.setStore(store);
-
+ cb.display( tok.getAvailableSignals());
+
// suspended instances cannot be signaled
if(processInstance.isSuspended() || !tok.canBeSignaled())
{
@@ -174,16 +145,7 @@
lastSelectedToken = tok;
}
-
- private MemoryProxy createMemoryProxy(List signals)
- {
- if(signals.isEmpty())
- signals.add(DEFAULT_TRANSITION);
- return new MemoryProxy(
- new Object[][]{ signals.toArray()}
- );
- }
-
+
public void resetForm()
{
tokenForm.getForm().reset();
17 years, 5 months