JBoss JBPM SVN: r4564 - in jbpm4/trunk/modules: examples/src/test/resources and 5 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-16 07:50:42 -0400 (Thu, 16 Apr 2009)
New Revision: 4564
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JbossIdmIdentitySessionFactoryBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionFactoryDescriptor.java
Removed:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java
Modified:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.wire.bindings.xml
Log:
renaming the jboss idm bindings and descriptors in line with the config elements
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml 2009-04-16 10:55:45 UTC (rev 4563)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml 2009-04-16 11:50:42 UTC (rev 4564)
@@ -49,7 +49,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.TimerSessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.HistorySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
<!-- db sessions -->
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.wire.bindings.xml 2009-04-16 10:55:45 UTC (rev 4563)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.wire.bindings.xml 2009-04-16 11:50:42 UTC (rev 4564)
@@ -49,7 +49,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.TimerSessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.HistorySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
<!-- db sessions -->
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml 2009-04-16 10:55:45 UTC (rev 4563)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml 2009-04-16 11:50:42 UTC (rev 4564)
@@ -49,7 +49,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.TimerSessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.HistorySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
<!-- db sessions -->
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java 2009-04-16 10:55:45 UTC (rev 4563)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java 2009-04-16 11:50:42 UTC (rev 4564)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.jbpm.pvm.internal.wire.binding;
-
-import org.jbpm.pvm.internal.wire.descriptor.IdentitySessionFactoryDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class IdentitySessionFactoryBinding extends WireDescriptorBinding {
-
- public IdentitySessionFactoryBinding() {
- super("jboss-idm-identity-session-factory");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- IdentitySessionFactoryDescriptor descriptor = new IdentitySessionFactoryDescriptor();
-
- if (element.hasAttribute("jndi")) {
- descriptor.setJndiName(element.getAttribute("jndi"));
-
- } else if (element.hasAttribute("resource")) {
- descriptor.setResource(element.getAttribute("resource"));
- }
-
- return descriptor;
- }
-
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JbossIdmIdentitySessionFactoryBinding.java (from rev 4562, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JbossIdmIdentitySessionFactoryBinding.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JbossIdmIdentitySessionFactoryBinding.java 2009-04-16 11:50:42 UTC (rev 4564)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbpm.pvm.internal.wire.binding;
+
+import org.jbpm.pvm.internal.wire.descriptor.JbossIdmIdentitySessionFactoryDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JbossIdmIdentitySessionFactoryBinding extends WireDescriptorBinding {
+
+ public JbossIdmIdentitySessionFactoryBinding() {
+ super("jboss-idm-identity-session-factory");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ JbossIdmIdentitySessionFactoryDescriptor descriptor = new JbossIdmIdentitySessionFactoryDescriptor();
+
+ if (element.hasAttribute("jndi")) {
+ descriptor.setJndiName(element.getAttribute("jndi"));
+
+ } else if (element.hasAttribute("resource")) {
+ descriptor.setResource(element.getAttribute("resource"));
+ }
+
+ return descriptor;
+ }
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JbossIdmIdentitySessionFactoryBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java 2009-04-16 10:55:45 UTC (rev 4563)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java 2009-04-16 11:50:42 UTC (rev 4564)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.jbpm.pvm.internal.wire.descriptor;
-
-import javax.naming.InitialContext;
-
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.impl.api.IdentitySessionFactoryImpl;
-import org.jbpm.JbpmException;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.WireDefinition;
-
-
-/**
- * @author Tom Baeyens
- */
-public class IdentitySessionFactoryDescriptor extends AbstractDescriptor {
-
- private static final long serialVersionUID = 1L;
-
- protected String resource = "jbpm.identity.cfg.xml";
- protected String jndiName = null;
-
- public Object construct(WireContext wireContext) {
- if (jndiName!=null) {
- try {
- InitialContext initialContext = new InitialContext();
- IdentitySessionFactory identitySessionFactory = (IdentitySessionFactory) initialContext.lookup(jndiName);
- return identitySessionFactory;
- } catch (Exception e) {
- throw new JbpmException("couldn't get idm session factory from jndi address "+jndiName, e);
- }
- }
-
- try {
- return new IdentitySessionFactoryImpl(resource);
- } catch (Exception e) {
- throw new JbpmException("couldn't instanatiate identity session factory: "+e.getMessage(), e);
- }
- }
-
- public Class< ? > getType(WireDefinition wireDefinition) {
- return IdentitySessionFactory.class;
- }
-
- public void setResource(String resource) {
- this.resource = resource;
- }
- public void setJndiName(String jndiName) {
- this.jndiName = jndiName;
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionFactoryDescriptor.java (from rev 4563, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionFactoryDescriptor.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionFactoryDescriptor.java 2009-04-16 11:50:42 UTC (rev 4564)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbpm.pvm.internal.wire.descriptor;
+
+import javax.naming.InitialContext;
+
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.impl.api.IdentitySessionFactoryImpl;
+import org.jbpm.JbpmException;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireDefinition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JbossIdmIdentitySessionFactoryDescriptor extends AbstractDescriptor {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String resource = "jbpm.identity.cfg.xml";
+ protected String jndiName = null;
+
+ public Object construct(WireContext wireContext) {
+ if (jndiName!=null) {
+ try {
+ InitialContext initialContext = new InitialContext();
+ IdentitySessionFactory identitySessionFactory = (IdentitySessionFactory) initialContext.lookup(jndiName);
+ return identitySessionFactory;
+ } catch (Exception e) {
+ throw new JbpmException("couldn't get idm session factory from jndi address "+jndiName, e);
+ }
+ }
+
+ try {
+ return new IdentitySessionFactoryImpl(resource);
+ } catch (Exception e) {
+ throw new JbpmException("couldn't instanatiate identity session factory: "+e.getMessage(), e);
+ }
+ }
+
+ public Class< ? > getType(WireDefinition wireDefinition) {
+ return IdentitySessionFactory.class;
+ }
+
+ public void setResource(String resource) {
+ this.resource = resource;
+ }
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionFactoryDescriptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.wire.bindings.xml 2009-04-16 10:55:45 UTC (rev 4563)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.wire.bindings.xml 2009-04-16 11:50:42 UTC (rev 4564)
@@ -49,7 +49,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.TimerSessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.HistorySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
<!-- db sessions -->
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.wire.bindings.xml 2009-04-16 10:55:45 UTC (rev 4563)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.wire.bindings.xml 2009-04-16 11:50:42 UTC (rev 4564)
@@ -49,7 +49,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.TimerSessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.HistorySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
<!-- db sessions -->
17 years
JBoss JBPM SVN: r4563 - jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-16 06:55:45 -0400 (Thu, 16 Apr 2009)
New Revision: 4563
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java
Log:
cleaning imports
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java 2009-04-16 10:53:21 UTC (rev 4562)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java 2009-04-16 10:55:45 UTC (rev 4563)
@@ -22,11 +22,9 @@
package org.jbpm.pvm.internal.wire.descriptor;
import javax.naming.InitialContext;
-import javax.naming.NamingException;
import org.jboss.identity.idm.api.IdentitySessionFactory;
import org.jboss.identity.idm.impl.api.IdentitySessionFactoryImpl;
-import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
import org.jbpm.JbpmException;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireDefinition;
17 years
JBoss JBPM SVN: r4562 - jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-16 06:53:21 -0400 (Thu, 16 Apr 2009)
New Revision: 4562
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java
Log:
added jndi lookup support for jboss idm session factory lookup in jboss
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java 2009-04-16 10:49:19 UTC (rev 4561)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java 2009-04-16 10:53:21 UTC (rev 4562)
@@ -33,7 +33,7 @@
public class IdentitySessionFactoryBinding extends WireDescriptorBinding {
public IdentitySessionFactoryBinding() {
- super("identity-session-factory");
+ super("jboss-idm-identity-session-factory");
}
public Object parse(Element element, Parse parse, Parser parser) {
17 years
JBoss JBPM SVN: r4561 - in jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire: descriptor and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-16 06:49:19 -0400 (Thu, 16 Apr 2009)
New Revision: 4561
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java
Log:
added jndi lookup support for jboss idm session factory lookup in jboss
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java 2009-04-16 08:22:20 UTC (rev 4560)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentitySessionFactoryBinding.java 2009-04-16 10:49:19 UTC (rev 4561)
@@ -39,7 +39,10 @@
public Object parse(Element element, Parse parse, Parser parser) {
IdentitySessionFactoryDescriptor descriptor = new IdentitySessionFactoryDescriptor();
- if (element.hasAttribute("resource")) {
+ if (element.hasAttribute("jndi")) {
+ descriptor.setJndiName(element.getAttribute("jndi"));
+
+ } else if (element.hasAttribute("resource")) {
descriptor.setResource(element.getAttribute("resource"));
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java 2009-04-16 08:22:20 UTC (rev 4560)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/IdentitySessionFactoryDescriptor.java 2009-04-16 10:49:19 UTC (rev 4561)
@@ -21,7 +21,12 @@
*/
package org.jbpm.pvm.internal.wire.descriptor;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.identity.idm.api.IdentitySessionFactory;
import org.jboss.identity.idm.impl.api.IdentitySessionFactoryImpl;
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
import org.jbpm.JbpmException;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireDefinition;
@@ -35,8 +40,19 @@
private static final long serialVersionUID = 1L;
protected String resource = "jbpm.identity.cfg.xml";
+ protected String jndiName = null;
public Object construct(WireContext wireContext) {
+ if (jndiName!=null) {
+ try {
+ InitialContext initialContext = new InitialContext();
+ IdentitySessionFactory identitySessionFactory = (IdentitySessionFactory) initialContext.lookup(jndiName);
+ return identitySessionFactory;
+ } catch (Exception e) {
+ throw new JbpmException("couldn't get idm session factory from jndi address "+jndiName, e);
+ }
+ }
+
try {
return new IdentitySessionFactoryImpl(resource);
} catch (Exception e) {
@@ -44,11 +60,14 @@
}
}
+ public Class< ? > getType(WireDefinition wireDefinition) {
+ return IdentitySessionFactory.class;
+ }
+
public void setResource(String resource) {
this.resource = resource;
}
-
- public Class< ? > getType(WireDefinition wireDefinition) {
- return IdentitySessionFactoryImpl.class;
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
}
}
17 years
JBoss JBPM SVN: r4560 - jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-04-16 04:22:20 -0400 (Thu, 16 Apr 2009)
New Revision: 4560
Modified:
jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MailTemplateWireTest.java
Log:
adapt mail wire test to changes in attachment template
Modified: jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MailTemplateWireTest.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MailTemplateWireTest.java 2009-04-16 08:17:49 UTC (rev 4559)
+++ jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MailTemplateWireTest.java 2009-04-16 08:22:20 UTC (rev 4560)
@@ -21,8 +21,6 @@
*/
package org.jbpm.pvm.internal.wire;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import org.jbpm.pvm.internal.email.impl.AttachmentTemplate;
@@ -33,142 +31,141 @@
*/
public class MailTemplateWireTest extends WireTestCase {
- public void testName() {
- WireContext wireContext =
- createWireContext("<objects>"
- + "<mail-template name='plate'>"
- + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
- + " <subject>bureaucracy</subject>"
- + "</mail-template>"
- + "</objects>");
+ public void testName() {
+ WireContext wireContext =
+ createWireContext("<objects>"
+ + "<mail-template name='plate'>"
+ + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
+ + " <subject>bureaucracy</subject>"
+ + "</mail-template>"
+ + "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
- assertEquals("plate", template.getName());
- }
+ MailTemplate template = wireContext.get(MailTemplate.class);
+ assertEquals("plate", template.getName());
+ }
- public void testLanguage() {
- WireContext wireContext =
- createWireContext("<objects>"
- + "<mail-template name='plate' language='juel'>"
- + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
- + " <subject>bureaucracy</subject>"
- + "</mail-template>"
- + "</objects>");
+ public void testLanguage() {
+ WireContext wireContext =
+ createWireContext("<objects>"
+ + "<mail-template name='plate' language='juel'>"
+ + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
+ + " <subject>bureaucracy</subject>"
+ + "</mail-template>"
+ + "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
- assertEquals("juel", template.getLanguage());
- }
+ MailTemplate template = wireContext.get(MailTemplate.class);
+ assertEquals("juel", template.getLanguage());
+ }
- public void testTo() {
- WireContext wireContext =
- createWireContext("<objects>"
- + "<mail-template name='plate'>"
- + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
- + " <subject>bureaucracy</subject>"
- + "</mail-template>"
- + "</objects>");
+ public void testTo() {
+ WireContext wireContext =
+ createWireContext("<objects>"
+ + "<mail-template name='plate'>"
+ + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
+ + " <subject>bureaucracy</subject>"
+ + "</mail-template>"
+ + "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
- assertEquals(Arrays.asList("dilbert@office", "alice@work", "dogbert@house"), template
- .getTo()
- .getAddresses());
- }
+ MailTemplate template = wireContext.get(MailTemplate.class);
+ assertEquals("dilbert@office, alice@work, dogbert@house", template.getTo().getAddresses());
+ }
- public void testCc() {
- WireContext wireContext =
- createWireContext("<objects>"
- + "<mail-template name='plate'>"
- + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
- + " <cc actors='theboss, hrpolicymaker'/>"
- + " <subject>bureaucracy</subject>"
- + "</mail-template>"
- + "</objects>");
+ public void testCc() {
+ WireContext wireContext =
+ createWireContext("<objects>"
+ + "<mail-template name='plate'>"
+ + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
+ + " <cc actors='theboss, hrpolicymaker'/>"
+ + " <subject>bureaucracy</subject>"
+ + "</mail-template>"
+ + "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
- assertEquals(Arrays.asList("theboss", "hrpolicymaker"), template.getCc().getActors());
- }
+ MailTemplate template = wireContext.get(MailTemplate.class);
+ assertEquals("theboss, hrpolicymaker", template.getCc().getActors());
+ }
- public void testBcc() {
- WireContext wireContext =
- createWireContext("<objects>"
- + "<mail-template name='plate'>"
- + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
- + " <bcc actors='thoughtpolice'/>"
- + " <subject>bureaucracy</subject>"
- + "</mail-template>"
- + "</objects>");
+ public void testBcc() {
+ WireContext wireContext =
+ createWireContext("<objects>"
+ + "<mail-template name='plate'>"
+ + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
+ + " <bcc actors='thoughtpolice'/>"
+ + " <subject>bureaucracy</subject>"
+ + "</mail-template>"
+ + "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
- assertEquals(Collections.singletonList("thoughtpolice"), template.getBcc().getActors());
- }
+ MailTemplate template = wireContext.get(MailTemplate.class);
+ assertEquals("thoughtpolice", template.getBcc().getActors());
+ }
- public void testSubject() {
- WireContext wireContext =
- createWireContext("<objects>"
- + "<mail-template name='plate'>"
- + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
- + " <subject>bureaucracy</subject>"
- + "</mail-template>"
- + "</objects>");
+ public void testSubject() {
+ WireContext wireContext =
+ createWireContext("<objects>"
+ + "<mail-template name='plate'>"
+ + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
+ + " <subject>bureaucracy</subject>"
+ + "</mail-template>"
+ + "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
- assertEquals("bureaucracy", template.getSubject());
- }
+ MailTemplate template = wireContext.get(MailTemplate.class);
+ assertEquals("bureaucracy", template.getSubject());
+ }
- public void testText() {
- WireContext wireContext =
- createWireContext("<objects>"
- + "<mail-template name='plate'>"
- + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
- + " <subject>bureaucracy</subject>"
- + " <text>plain text content</text>"
- + "</mail-template>"
- + "</objects>");
+ public void testText() {
+ WireContext wireContext =
+ createWireContext("<objects>"
+ + "<mail-template name='plate'>"
+ + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
+ + " <subject>bureaucracy</subject>"
+ + " <text>plain text content</text>"
+ + "</mail-template>"
+ + "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
- assertEquals("plain text content", template.getText());
- }
+ MailTemplate template = wireContext.get(MailTemplate.class);
+ assertEquals("plain text content", template.getText());
+ }
- public void testHtml() {
- WireContext wireContext =
- createWireContext("<objects>"
- + "<mail-template name='plate'>"
- + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
- + " <subject>bureaucracy</subject>"
- + " <html><strong>rich</strong> content</html>"
- + "</mail-template>"
- + "</objects>");
+ public void testHtml() {
+ WireContext wireContext =
+ createWireContext("<objects>"
+ + "<mail-template name='plate'>"
+ + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
+ + " <subject>bureaucracy</subject>"
+ + " <html><strong>rich</strong> content</html>"
+ + "</mail-template>"
+ + "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
- System.out.println(template.getHtml());
- assertEquals("<html>\n<strong>rich</strong> content</html>\n", template.getHtml());
- }
+ MailTemplate template = wireContext.get(MailTemplate.class);
+ System.out.println(template.getHtml());
+ assertEquals("<html>\n<strong>rich</strong> content</html>\n", template.getHtml());
+ }
- public void testAttachments() {
- WireContext wireContext =
- createWireContext("<objects>"
- + "<mail-template name='plate'>"
- + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
- + " <subject>bureaucracy</subject>"
- + " <attachments>"
- + " <attachment url='http://en.wikipedia.org/wiki/File:Dilbert-20050910.png'/>"
- + " <attachment resource='org/example/pic.jpg'/>"
- + " <attachment file='${user.home}/.face'/>"
- + " </attachments>"
- + "</mail-template>"
- + "</objects>");
+ public void testAttachments() {
+ WireContext wireContext =
+ createWireContext("<objects>"
+ + "<mail-template name='plate'>"
+ + " <to addresses='dilbert@office, alice@work, dogbert@house'/>"
+ + " <subject>bureaucracy</subject>"
+ + " <attachments>"
+ + " <attachment url='http://en.wikipedia.org/wiki/File:Dilbert-20050910.png'/>"
+ + " <attachment resource='org/example/pic.jpg'/>"
+ + " <attachment file='${user.home}/.face'/>"
+ + " </attachments>"
+ + "</mail-template>"
+ + "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
- List<AttachmentTemplate> attachmentTemplates = template.getAttachmentTemplates();
- assertEquals(3, attachmentTemplates.size());
- // url
- AttachmentTemplate attachmentTemplate = attachmentTemplates.get(0);
- assertEquals("http://en.wikipedia.org/wiki/File:Dilbert-20050910.png", attachmentTemplate.getUrl());
- // resource
- attachmentTemplate = attachmentTemplates.get(1);
- assertEquals("org/example/pic.jpg", attachmentTemplate.getResource());
- // file
- attachmentTemplate = attachmentTemplates.get(2);
- assertEquals("${user.home}/.face", attachmentTemplate.getFile());
- }
+ MailTemplate template = wireContext.get(MailTemplate.class);
+ List<AttachmentTemplate> attachmentTemplates = template.getAttachmentTemplates();
+ assertEquals(3, attachmentTemplates.size());
+ // url
+ AttachmentTemplate attachmentTemplate = attachmentTemplates.get(0);
+ assertEquals("http://en.wikipedia.org/wiki/File:Dilbert-20050910.png", attachmentTemplate
+ .getUrl());
+ // resource
+ attachmentTemplate = attachmentTemplates.get(1);
+ assertEquals("org/example/pic.jpg", attachmentTemplate.getResource());
+ // file
+ attachmentTemplate = attachmentTemplates.get(2);
+ assertEquals("${user.home}/.face", attachmentTemplate.getFile());
+ }
}
17 years
JBoss JBPM SVN: r4559 - in jbpm4/branches/email/modules: pvm/.settings and 5 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-04-16 04:17:49 -0400 (Thu, 16 Apr 2009)
New Revision: 4559
Added:
jbpm4/branches/email/modules/pvm/.settings/org.eclipse.jdt.ui.prefs
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/GivenSpaceFamilyNameBuilder.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/MailProducer.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/RecipientNameBuilder.java
Modified:
jbpm4/branches/email/modules/api/src/main/java/org/jbpm/identity/User.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/AttachmentTemplate.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailTemplate.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/RecipientTemplate.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/MailSession.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailTemplateBinding.java
Log:
alternate proposal for mail producer which aggregates the mail template
Modified: jbpm4/branches/email/modules/api/src/main/java/org/jbpm/identity/User.java
===================================================================
--- jbpm4/branches/email/modules/api/src/main/java/org/jbpm/identity/User.java 2009-04-15 20:09:56 UTC (rev 4558)
+++ jbpm4/branches/email/modules/api/src/main/java/org/jbpm/identity/User.java 2009-04-16 08:17:49 UTC (rev 4559)
@@ -31,4 +31,6 @@
String getGivenName();
String getFamilyName();
+
+ String getEmailAddress();
}
Added: jbpm4/branches/email/modules/pvm/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- jbpm4/branches/email/modules/pvm/.settings/org.eclipse.jdt.ui.prefs (rev 0)
+++ jbpm4/branches/email/modules/pvm/.settings/org.eclipse.jdt.ui.prefs 2009-04-16 08:17:49 UTC (rev 4559)
@@ -0,0 +1,3 @@
+#Wed Apr 15 21:58:44 CDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/AttachmentTemplate.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/AttachmentTemplate.java 2009-04-15 20:09:56 UTC (rev 4558)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/AttachmentTemplate.java 2009-04-16 08:17:49 UTC (rev 4559)
@@ -21,37 +21,57 @@
*/
package org.jbpm.pvm.internal.email.impl;
+import java.net.URL;
+
/**
* @author Alejandro Guizar
*/
public class AttachmentTemplate {
- private String url;
- private String resource;
- private String file;
+ private String name;
+ private String description;
+ private String url;
+ private String resource;
+ private String file;
- public String getUrl() {
- return url;
- }
+ public String getName() {
+ return name;
+ }
- public void setUrl(String url) {
- this.url = url;
- }
+ public void setName(String name) {
+ this.name = name;
+ }
- public String getResource() {
- return resource;
- }
+ public String getDescription() {
+ return description;
+ }
- public void setResource(String resource) {
- this.resource = resource;
- }
+ public void setDescription(String description) {
+ this.description = description;
+ }
- public String getFile() {
- return file;
- }
+ public String getUrl() {
+ return url;
+ }
- public void setFile(String file) {
- this.file = file;
- }
+ public void setUrl(String url) {
+ this.url = url;
+ }
+ public String getResource() {
+ return resource;
+ }
+
+ public void setResource(String resource) {
+ this.resource = resource;
+ }
+
+ public String getFile() {
+ return file;
+ }
+
+ public void setFile(String file) {
+ this.file = file;
+ }
+
}
Added: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/GivenSpaceFamilyNameBuilder.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/GivenSpaceFamilyNameBuilder.java (rev 0)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/GivenSpaceFamilyNameBuilder.java 2009-04-16 08:17:49 UTC (rev 4559)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbpm.pvm.internal.email.impl;
+
+import org.jbpm.identity.User;
+import org.jbpm.pvm.internal.email.spi.RecipientNameBuilder;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class GivenSpaceFamilyNameBuilder implements RecipientNameBuilder {
+
+ public String buildName(User user) {
+ String givenName = user.getGivenName();
+ String familyName = user.getFamilyName();
+
+ return givenName != null ? familyName != null ? givenName + ' ' + familyName : givenName
+ : familyName;
+ }
+
+}
Added: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java (rev 0)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java 2009-04-16 08:17:49 UTC (rev 4559)
@@ -0,0 +1,251 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbpm.pvm.internal.email.impl;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.mail.Email;
+import org.apache.commons.mail.EmailAttachment;
+import org.apache.commons.mail.EmailException;
+import org.apache.commons.mail.HtmlEmail;
+import org.apache.commons.mail.MultiPartEmail;
+import org.apache.commons.mail.SimpleEmail;
+import org.jbpm.JbpmException;
+import org.jbpm.env.Environment;
+import org.jbpm.identity.Group;
+import org.jbpm.identity.User;
+import org.jbpm.model.OpenExecution;
+import org.jbpm.pvm.internal.email.spi.MailProducer;
+import org.jbpm.pvm.internal.email.spi.RecipientNameBuilder;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+/**
+ * Default mail producer.
+ *
+ * @author Alejandro Guizar
+ */
+public class MailProducerImpl implements MailProducer {
+
+ private MailTemplate template;
+
+ public MailTemplate getTemplate() {
+ return template;
+ }
+
+ public void setTemplate(MailTemplate template) {
+ this.template = template;
+ }
+
+ public Email produce(OpenExecution execution) {
+ try {
+ Email email = instantiateEmail(template);
+ fillRecipients(template, execution, email);
+ fillSubject(execution, email);
+ fillBody(execution, email);
+ return email;
+ }
+ catch (EmailException e) {
+ throw new JbpmException("could not produce email", e);
+ }
+ }
+
+ protected Email instantiateEmail(MailTemplate template) {
+ return template.getHtml() != null ? new HtmlEmail() : template
+ .getAttachmentTemplates()
+ .isEmpty() ? new MultiPartEmail() : new SimpleEmail();
+ }
+
+ protected void fillRecipients(MailTemplate template, OpenExecution execution, Email email)
+ throws EmailException {
+ Environment environment = Environment.getCurrent();
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ RecipientNameBuilder recipientNameBuilder = environment.get(RecipientNameBuilder.class);
+
+ // to
+ RecipientTemplate to = template.getTo();
+ if (to != null) {
+ for (String address : evaluateRecipients(to.getAddresses(), execution)) {
+ email.addTo(address);
+ }
+ for (String actorId : evaluateRecipients(to.getActors(), execution)) {
+ Collection<User> users = resolveUsers(identitySession, actorId);
+ for (User user : users) {
+ email.addTo(user.getEmailAddress(), recipientNameBuilder.buildName(user));
+ }
+ }
+ }
+
+ // cc
+ RecipientTemplate cc = template.getCc();
+ if (cc != null) {
+ for (String address : evaluateRecipients(cc.getAddresses(), execution)) {
+ email.addCc(address);
+ }
+ for (String actorId : evaluateRecipients(cc.getActors(), execution)) {
+ Collection<User> users = resolveUsers(identitySession, actorId);
+ for (User user : users) {
+ email.addCc(user.getEmailAddress(), recipientNameBuilder.buildName(user));
+ }
+ }
+ }
+
+ // bcc
+ RecipientTemplate bcc = template.getBcc();
+ if (bcc != null) {
+ for (String address : evaluateRecipients(bcc.getAddresses(), execution)) {
+ email.addBcc(address);
+ }
+ for (String actorId : evaluateRecipients(bcc.getActors(), execution)) {
+ Collection<User> users = resolveUsers(identitySession, actorId);
+ for (User user : users) {
+ email.addBcc(user.getEmailAddress(), recipientNameBuilder.buildName(user));
+ }
+ }
+ }
+ }
+
+ private String evaluateExpression(String expression, OpenExecution execution) {
+ ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
+ return scriptManager
+ .evaluateExpression(expression, execution, template.getLanguage())
+ .toString();
+ }
+
+ private String[] evaluateRecipients(String recipients, OpenExecution execution) {
+ return evaluateExpression(recipients, execution).split("[,|\\s]+");
+ }
+
+ private static Collection<User> resolveUsers(IdentitySession identitySession, String actorId) {
+ // first, try to resolve actorId as user
+ User user = identitySession.findUserById(actorId);
+ if (user != null)
+ return Collections.singleton(user);
+
+ // next, try to resolve as group
+ Group group = identitySession.findGroupById(actorId);
+ if (group != null)
+ return identitySession.findUsersByGroup(actorId);
+
+ // give up
+ return Collections.emptySet();
+ }
+
+ protected void fillSubject(OpenExecution execution, Email email) {
+ email.setSubject(evaluateExpression(template.getSubject(), execution));
+ }
+
+ protected void fillBody(OpenExecution execution, Email email) throws EmailException {
+ if (template.getHtml() == null) {
+ email.setMsg(evaluateExpression(template.getText(), execution));
+ }
+ else {
+ HtmlEmail htmlEmail = (HtmlEmail) email;
+ htmlEmail.setHtmlMsg(evaluateExpression(template.getHtml(), execution));
+ htmlEmail.setTextMsg(evaluateExpression(template.getText(), execution));
+ }
+ }
+
+ protected void addAttachments(OpenExecution execution, Email email) throws EmailException {
+ List<AttachmentTemplate> attachmentTemplates = template.getAttachmentTemplates();
+ if (attachmentTemplates.isEmpty())
+ return;
+
+ MultiPartEmail multiPartEmail = (MultiPartEmail) email;
+ for (AttachmentTemplate attachmentTemplate : attachmentTemplates) {
+ EmailAttachment attachment = new EmailAttachment();
+ attachment.setDisposition(EmailAttachment.ATTACHMENT);
+
+ // name
+ String name = attachmentTemplate.getName();
+ if (name != null)
+ attachment.setName(evaluateExpression(name, execution));
+
+ // description
+ String description = attachmentTemplate.getDescription();
+ if (description != null)
+ attachment.setDescription(evaluateExpression(description, execution));
+
+ // file
+ String file = attachmentTemplate.getFile();
+ if (file != null) {
+ File targetFile = new File(evaluateExpression(file, execution));
+ if (!targetFile.isFile()) {
+ throw new EmailException("could not fetch attachment from " + targetFile);
+ }
+ attachment.setPath(targetFile.getPath());
+ // extract attachment name from file
+ if (name == null)
+ attachment.setName(targetFile.getName());
+ }
+ else {
+ URL targetUrl;
+ // url
+ String url = attachmentTemplate.getUrl();
+ if (url != null) {
+ try {
+ targetUrl = new URL(evaluateExpression(url, execution));
+ }
+ catch (MalformedURLException e) {
+ throw new EmailException("could not fetch attachment from " + url, e);
+ }
+ }
+ // resource
+ else {
+ String resource = attachmentTemplate.getResource();
+ targetUrl =
+ Environment.getCurrent().getClassLoader().getResource(
+ evaluateExpression(resource, execution));
+ if (targetUrl == null) {
+ throw new EmailException("could not fetch attachment from " + resource);
+ }
+ }
+ attachment.setURL(targetUrl);
+ // extract attachment name from url
+ if (name == null) {
+ String resourceName = extractResourceName(targetUrl);
+ attachment.setName(resourceName);
+ }
+ }
+
+ multiPartEmail.attach(attachment);
+ }
+ }
+
+ private static String extractResourceName(URL url) {
+ String path = url.getPath();
+ if (path == null || path.length() == 0)
+ return null;
+
+ // skip trailing slash
+ int sepIndex = path.lastIndexOf('/', path.length() - 1);
+ if (sepIndex == -1)
+ return null;
+
+ return path.substring(sepIndex);
+ }
+}
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailTemplate.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailTemplate.java 2009-04-15 20:09:56 UTC (rev 4558)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailTemplate.java 2009-04-16 08:17:49 UTC (rev 4559)
@@ -37,11 +37,11 @@
private String name;
private String language;
- private Map<RecipientType, RecipientTemplate> recipientTemplates;
+ private Map<RecipientType, RecipientTemplate> recipientTemplates = new HashMap<RecipientType, RecipientTemplate>();
private String subject;
private String text;
private String html;
- private List<AttachmentTemplate> attachmentTemplates;
+ private List<AttachmentTemplate> attachmentTemplates = new ArrayList<AttachmentTemplate>();
/**
* Name of this template, useful for referencing it from mail activities.
@@ -66,12 +66,10 @@
}
public RecipientTemplate getRecipientTemplate(RecipientType recipientType) {
- return recipientTemplates != null ? recipientTemplates.get(recipientType) : null;
+ return recipientTemplates.get(recipientType);
}
public void setRecipientTemplate(RecipientType recipientType, RecipientTemplate recipientTemplate) {
- if (recipientTemplates == null)
- recipientTemplates = new HashMap<RecipientType, RecipientTemplate>();
recipientTemplates.put(recipientType, recipientTemplate);
}
@@ -128,7 +126,6 @@
}
public void addAttachmentTemplate(AttachmentTemplate attachmentTemplate) {
- if (attachmentTemplates == null) attachmentTemplates = new ArrayList<AttachmentTemplate>();
attachmentTemplates.add(attachmentTemplate);
}
}
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/RecipientTemplate.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/RecipientTemplate.java 2009-04-15 20:09:56 UTC (rev 4558)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/RecipientTemplate.java 2009-04-16 08:17:49 UTC (rev 4559)
@@ -21,9 +21,6 @@
*/
package org.jbpm.pvm.internal.email.impl;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Template for email recipients, either addresses or actors.
*
@@ -31,24 +28,23 @@
*/
public class RecipientTemplate {
- private List<String> addresses;
- private List<String> actors;
+ private String addresses;
+ private String actors;
- public List<String> getAddresses() {
- return addresses;
- }
+ public String getAddresses() {
+ return addresses;
+ }
- public void addAddress(String address) {
- if (addresses == null) addresses = new ArrayList<String>();
- addresses.add(address);
- }
+ public void setAddresses(String addresses) {
+ this.addresses = addresses;
+ }
- public List<String> getActors() {
- return actors;
- }
+ public String getActors() {
+ return actors;
+ }
- public void addActor(String actor) {
- if (actors == null) actors = new ArrayList<String>();
- actors.add(actor);
- }
+ public void setActors(String actors) {
+ this.actors = actors;
+ }
+
}
Added: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/MailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/MailProducer.java (rev 0)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/MailProducer.java 2009-04-16 08:17:49 UTC (rev 4559)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbpm.pvm.internal.email.spi;
+
+import org.apache.commons.mail.Email;
+import org.jbpm.model.OpenExecution;
+
+/**
+ * Pluggable control object for creating emails from templates.
+ *
+ * @author Brad Davis
+ * @author Alejandro Guizar
+ */
+public interface MailProducer {
+
+ Email produce(OpenExecution execution);
+
+}
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/MailSession.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/MailSession.java 2009-04-15 20:09:56 UTC (rev 4558)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/MailSession.java 2009-04-16 08:17:49 UTC (rev 4559)
@@ -4,6 +4,13 @@
import org.apache.commons.mail.Email;
+/**
+ * Pluggable control object for sending emails.
+ *
+ * @author Brad Davis
+ */
public interface MailSession {
- public void send(Collection<Email> emails);
+
+ void send(Collection<Email> emails);
+
}
Added: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/RecipientNameBuilder.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/RecipientNameBuilder.java (rev 0)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/RecipientNameBuilder.java 2009-04-16 08:17:49 UTC (rev 4559)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbpm.pvm.internal.email.spi;
+
+import org.jbpm.identity.User;
+
+/**
+ * Function to create email recipient names from {@linkplain User user} entities. The following two
+ * strategies are representative.
+ * <ul>
+ * <li>Albert Einstein (given name + ' ' + family name)</li>
+ * <li>Einstein, Albert (family name + ", " + given name)</li>
+ * </ul>
+ *
+ * @author Alejandro Guizar
+ */
+public interface RecipientNameBuilder {
+
+ String buildName(User user);
+
+}
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java 2009-04-15 20:09:56 UTC (rev 4558)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java 2009-04-16 08:17:49 UTC (rev 4559)
@@ -37,9 +37,10 @@
protected int dbversion;
protected String id;
- protected String password;
protected String givenName;
protected String familyName;
+ protected String emailAddress;
+ protected String password;
public UserImpl() {
}
@@ -59,8 +60,11 @@
public String getFamilyName() {
return familyName;
}
-
- public String toString() {
+ public String getEmailAddress() {
+ return emailAddress;
+ }
+
+ public String toString() {
if ( (givenName!=null)
&& (familyName!=null)
) {
@@ -78,7 +82,10 @@
public void setFamilyName(String familyName) {
this.familyName = familyName;
}
- public String getPassword() {
+ public void setEmailAddress(String emailAddress) {
+ this.emailAddress = emailAddress;
+ }
+ public String getPassword() {
return password;
}
public void setPassword(String password) {
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java 2009-04-15 20:09:56 UTC (rev 4558)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java 2009-04-16 08:17:49 UTC (rev 4559)
@@ -32,7 +32,6 @@
import org.jbpm.activity.ActivityBehaviour;
import org.jbpm.env.Context;
import org.jbpm.env.Environment;
-import org.jbpm.env.EnvironmentFactory;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
import org.jbpm.pvm.internal.model.ProcessElementImpl;
@@ -703,7 +702,7 @@
if (wireDefinition!=null) {
String name = wireDefinition.getDescriptorName(type);
if (name!=null) {
- return (T) get(name);
+ return type.cast(get(name));
}
}
return null;
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailTemplateBinding.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailTemplateBinding.java 2009-04-15 20:09:56 UTC (rev 4558)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailTemplateBinding.java 2009-04-16 08:17:49 UTC (rev 4559)
@@ -142,22 +142,12 @@
ObjectDescriptor recipientDescriptor = new ObjectDescriptor(RecipientTemplate.class);
String addresses = XmlUtil.attribute(element, "addresses");
- if (addresses != null) recipientDescriptor.addInjection("addresses", parseTokens(addresses));
+ if (addresses != null) recipientDescriptor.addInjection("addresses", new StringDescriptor(addresses));
String actors = XmlUtil.attribute(element, "actors");
- if (actors != null) recipientDescriptor.addInjection("actors", parseTokens(actors));
+ if (actors != null) recipientDescriptor.addInjection("actors", new StringDescriptor(actors));
return recipientDescriptor;
}
- private static ListDescriptor parseTokens(String tokens) {
- List<Descriptor> tokenDescriptors = new ArrayList<Descriptor>();
- for (String token : tokens.split("[,|\\s]+")) {
- tokenDescriptors.add(new StringDescriptor(token));
- }
- ListDescriptor listDescriptor = new ListDescriptor();
- listDescriptor.setValueDescriptors(tokenDescriptors);
- return listDescriptor;
- }
-
}
17 years
JBoss JBPM SVN: r4558 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/model and 3 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-15 16:09:56 -0400 (Wed, 15 Apr 2009)
New Revision: 4558
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java
Log:
JBPM-2029 renamed Execution.findExecutionIn to findActiveExecutionIn
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java 2009-04-15 20:01:24 UTC (rev 4557)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java 2009-04-15 20:09:56 UTC (rev 4558)
@@ -195,5 +195,5 @@
/** indicates if this execution has a child execution with the given executionName */
boolean hasExecution(String executionName);
- Execution findExecutionIn(String activityName);
+ Execution findActiveExecutionIn(String activityName);
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java 2009-04-15 20:01:24 UTC (rev 4557)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java 2009-04-15 20:09:56 UTC (rev 4558)
@@ -147,5 +147,5 @@
/** the child execution for the given name or null in case such execution doesn't exist. */
OpenExecution getExecution(String name);
- OpenExecution findExecutionIn(String activityName);
+ OpenExecution findActiveExecutionIn(String activityName);
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java 2009-04-15 20:01:24 UTC (rev 4557)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java 2009-04-15 20:09:56 UTC (rev 4558)
@@ -31,7 +31,7 @@
Execution processInstance = executionService.startProcessInstanceByKey("TimerTransition");
- String executionId = processInstance.findExecutionIn("guardedWait").getId();
+ String executionId = processInstance.findActiveExecutionIn("guardedWait").getId();
executionService.signalExecutionById(executionId, "go on");
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-04-15 20:01:24 UTC (rev 4557)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-04-15 20:09:56 UTC (rev 4558)
@@ -862,7 +862,7 @@
);
}
- public ExecutionImpl findExecutionIn(String activityName) {
+ public ExecutionImpl findActiveExecutionIn(String activityName) {
if ( activityName.equals(this.activityName)
&& state.equals(STATE_ACTIVE)) {
return this;
@@ -870,7 +870,7 @@
if (executions!=null) {
for (ExecutionImpl childExecution: executions) {
- ExecutionImpl found = childExecution.findExecutionIn(activityName);
+ ExecutionImpl found = childExecution.findActiveExecutionIn(activityName);
if (found!=null) {
return found;
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java 2009-04-15 20:01:24 UTC (rev 4557)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java 2009-04-15 20:09:56 UTC (rev 4558)
@@ -61,10 +61,10 @@
processInstance = executionService.findExecutionById(processInstance.getId());
- assertNotNull(processInstance.findExecutionIn("s11"));
- assertNotNull(processInstance.findExecutionIn("s12"));
- assertNotNull(processInstance.findExecutionIn("s21"));
- assertNotNull(processInstance.findExecutionIn("s22"));
+ assertNotNull(processInstance.findActiveExecutionIn("s11"));
+ assertNotNull(processInstance.findActiveExecutionIn("s12"));
+ assertNotNull(processInstance.findActiveExecutionIn("s21"));
+ assertNotNull(processInstance.findActiveExecutionIn("s22"));
processInstance = executionService.findExecutionById(processInstance.getId());
17 years
JBoss JBPM SVN: r4557 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/model and 13 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-15 16:01:24 -0400 (Wed, 15 Apr 2009)
New Revision: 4557
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeVariableDeclarationTest.java
jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionBasedConcurrencyTest.java
Log:
JBPM-2029 exposing the full execution hierarchy for obtaining wait state executions
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -22,7 +22,13 @@
package org.jbpm;
import java.io.Serializable;
+import java.util.Collection;
+import java.util.Map;
+import org.jbpm.client.ClientExecution;
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.model.ObservableElement;
+
/** a runtime path of execution.
*
* <h3 id="state">State of an execution</h3>
@@ -160,4 +166,34 @@
* priority integer value, but then, the UI will have to display it as
* an integer and not the named value.*/
int getPriority();
+
+ // execution hierarchy access ///////////////////////////////////////////////
+
+ /** the main path of execution in the <a href="package-summary.html#basicexecutionstructure">execution
+ * structure</a>. Null will be returned in case this execution itself is the
+ * main execution path. */
+ Execution getProcessInstance();
+
+ /** the parent execution in the <a href="package-summary.html#basicexecutionstructure">execution
+ * structure</a>. Null will be returned in case this execution itself is the
+ * main execution path. */
+ Execution getParent();
+
+ /** the child executions in the <a href="package-summary.html#basicexecutionstructure">execution
+ * structure</a>. Can be null and can be an empty collection. */
+ Collection<Execution> getExecutions();
+
+ /** maps child execution names to execution objects. In case multiple executions
+ * have the same name, the first one is taken. Can be null or can be an empty
+ * map. The first execution without a name is also included with null as the key.
+ */
+ Map<String, Execution> getExecutionsMap();
+
+ /** the child execution for the given name or null in case such execution doesn't exist. */
+ Execution getExecution(String name);
+
+ /** indicates if this execution has a child execution with the given executionName */
+ boolean hasExecution(String executionName);
+
+ Execution findExecutionIn(String activityName);
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -80,14 +80,11 @@
* process versions with the same name. */
Execution startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables, String processInstanceKey);
- /** the execution that is uniquely defined by the process definition and the business key. */
- Execution findExecutionByKey(String processDefinitionName, String processInstanceKey);
-
- /** the execution that is uniquely defined by the process definition and the business key. */
+ /** the execution that is uniquely defined by the process execution id. */
Execution findExecutionById(String executionId);
/** this method returns this execution and all its child executions recursively. */
- List<Execution> findExecutionsById(String executionId);
+ List<Execution> findExecutionsById(String processDefinitionId);
/** provides an external trigger to an execution. */
Execution signalExecutionById(String executionId);
@@ -102,21 +99,6 @@
Execution signalExecutionById(String executionId, Map<String, Object> parameters);
-
- /** provides a named external trigger to an execution. */
- Execution signalExecutionByKey(String processDefinitionKey, String executionKey);
-
- /** provides a named external trigger to an execution. */
- Execution signalExecutionByKey(String processDefinitionKey, String executionKey, String signalName);
-
- /** provides a named external trigger to an execution with parameters. */
- Execution signalExecutionByKey(String processDefinitionKey, String executionKey, Map<String, Object> parameters);
-
- /** provides a named external trigger to an execution with parameters. */
- Execution signalExecutionByKey(String processDefinitionKey, String executionKey, String signalName, Map<String, Object> parameters);
-
-
-
/** search for executions with criteria */
ExecutionQuery createExecutionQuery();
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -115,34 +115,6 @@
* the given type name. */
void createVariable(String key, Object value, String typeName);
- // execution hierarchy access ///////////////////////////////////////////////
-
- /** the main path of execution in the <a href="package-summary.html#basicexecutionstructure">execution
- * structure</a>. Null will be returned in case this execution itself is the
- * main execution path. */
- OpenExecution getProcessInstance();
-
- /** the parent execution in the <a href="package-summary.html#basicexecutionstructure">execution
- * structure</a>. Null will be returned in case this execution itself is the
- * main execution path. */
- OpenExecution getParent();
-
- /** the child executions in the <a href="package-summary.html#basicexecutionstructure">execution
- * structure</a>. Can be null and can be an empty collection. */
- Collection<OpenExecution> getExecutions();
-
- /** maps child execution names to execution objects. In case multiple executions
- * have the same name, the first one is taken. Can be null or can be an empty
- * map. The first execution without a name is also included with null as the key.
- */
- Map<String, OpenExecution> getExecutionsMap();
-
- /** the child execution for the given name or null in case such execution doesn't exist. */
- OpenExecution getExecution(String name);
-
- /** indicates if this execution has a child execution with the given executionName */
- boolean hasExecution(String executionName);
-
// timer access /////////////////////////////////////////////////////////////
/** indicates if this execution scope has timers */
@@ -159,4 +131,21 @@
* priority integer value, but then, the UI will have to display it as
* an integer and not the named value.*/
void setPriority(int priority);
+
+ // execution hierarchy access ///////////////////////////////////////////////
+
+ /** the main path of execution in the <a href="package-summary.html#basicexecutionstructure">execution
+ * structure</a>. Null will be returned in case this execution itself is the
+ * main execution path. */
+ OpenExecution getProcessInstance();
+
+ /** the parent execution in the <a href="package-summary.html#basicexecutionstructure">execution
+ * structure</a>. Null will be returned in case this execution itself is the
+ * main execution path. */
+ OpenExecution getParent();
+
+ /** the child execution for the given name or null in case such execution doesn't exist. */
+ OpenExecution getExecution(String name);
+
+ OpenExecution findExecutionIn(String activityName);
}
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml 2009-04-15 20:01:24 UTC (rev 4557)
@@ -69,7 +69,8 @@
<list name="executions"
cascade="all-delete-orphan"
- inverse="false">
+ inverse="false"
+ lazy="false">
<key column="PARENT_" foreign-key="FK_EXEC_PARENT" />
<list-index column="PARENT_IDX_" />
<one-to-many class="ExecutionImpl" />
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -25,13 +25,15 @@
assertEquals("escalation", processInstance.getActivityName());
}
-/*
+
public void testTimerTransitionTakeTransition() {
deployJpdlResource("org/jbpm/examples/timer/transition/process.jpdl.xml");
Execution processInstance = executionService.startProcessInstanceByKey("TimerTransition");
+
+ String executionId = processInstance.findExecutionIn("guardedWait").getId();
- executionService.signalExecutionById(processInstance.getId()+".guardedWait", "go on");
+ executionService.signalExecutionById(executionId, "go on");
processInstance = executionService.findExecutionById(processInstance.getId());
@@ -43,5 +45,4 @@
assertEquals(new ArrayList<Job>(), new ArrayList<Job>(jobs));
}
-*/
}
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml 2009-04-15 20:01:24 UTC (rev 4557)
@@ -69,7 +69,8 @@
<list name="executions"
cascade="all-delete-orphan"
- inverse="false">
+ inverse="false"
+ lazy="false">
<key column="PARENT_" foreign-key="FK_EXEC_PARENT" />
<list-index column="PARENT_IDX_" />
<one-to-many class="ExecutionImpl" />
Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -31,6 +31,7 @@
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
+import org.jbpm.Execution;
import org.jbpm.ProcessDefinition;
import org.jbpm.model.OpenExecution;
import org.jbpm.model.Transition;
@@ -69,10 +70,10 @@
OpenExecution topLevelExecution = e0.getProcessInstance();
TokenReference tok = execution2TokenReference(topLevelExecution);
- Collection<OpenExecution> childExecutions = topLevelExecution.getExecutions();
+ Collection<Execution> childExecutions = topLevelExecution.getExecutions();
if(childExecutions!=null)
{
- for(OpenExecution childExecution : childExecutions)
+ for(Execution childExecution : childExecutions)
{
TokenReference childTok = execution2TokenReference(childExecution);
tok.getChildren().add(childTok);
@@ -84,7 +85,7 @@
return ref;
}
- private static TokenReference execution2TokenReference(OpenExecution topLevelExecution)
+ private static TokenReference execution2TokenReference(Execution topLevelExecution)
{
TokenReference tok = new TokenReference();
tok.setName(topLevelExecution.getName());
@@ -93,7 +94,9 @@
// transitions
List<String> availableSignals = new ArrayList<String>();
- for(Transition t : topLevelExecution.getActivity().getOutgoingTransitions())
+
+ OpenExecution openTopLevelExecution = (OpenExecution) topLevelExecution;
+ for(Transition t : openTopLevelExecution.getActivity().getOutgoingTransitions())
{
availableSignals.add(t.getName());
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -72,7 +72,7 @@
List<OpenExecution> findJoinedExecutions(OpenExecution execution, Activity join) {
List<OpenExecution> joinedExecutions = new ArrayList<OpenExecution>();
- scanRecursive(execution.getProcessInstance(), join, joinedExecutions);
+ scanRecursive((OpenExecution)execution.getProcessInstance(), join, joinedExecutions);
return joinedExecutions;
}
@@ -81,7 +81,7 @@
if (join.equals(execution.getActivity())) {
joinedExecutions.add(execution);
}
- Collection<OpenExecution> childExecutions = execution.getExecutions();
+ Collection<OpenExecution> childExecutions = (Collection)execution.getExecutions();
if (childExecutions!=null) {
for (OpenExecution childExecution: childExecutions) {
scanRecursive(childExecution, join, joinedExecutions);
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml 2009-04-15 20:01:24 UTC (rev 4557)
@@ -69,7 +69,8 @@
<list name="executions"
cascade="all-delete-orphan"
- inverse="false">
+ inverse="false"
+ lazy="false">
<key column="PARENT_" foreign-key="FK_EXEC_PARENT" />
<list-index column="PARENT_IDX_" />
<one-to-many class="ExecutionImpl" />
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -28,10 +28,7 @@
import org.jbpm.Execution;
import org.jbpm.JbpmException;
import org.jbpm.client.ClientExecution;
-import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
-import org.jbpm.model.Activity;
-import org.jbpm.model.OpenExecution;
import org.jbpm.session.PvmDbSession;
@@ -62,20 +59,13 @@
return executions;
}
- public void scanExecutions(OpenExecution execution, List<Execution> executions) {
+ public void scanExecutions(Execution execution, List<Execution> executions) {
executions.add(execution);
- // initialize activity relation. this is necessary for the method
- // Execution.getActivityName()
- Activity activity = execution.getActivity();
- if (activity!=null) {
- activity.getName();
- }
-
- Collection<OpenExecution> childExecutions = execution.getExecutions();
+ Collection<Execution> childExecutions = execution.getExecutions();
if (childExecutions!=null) {
- for (OpenExecution childExecution: childExecutions) {
+ for (Execution childExecution: childExecutions) {
scanExecutions(childExecution, executions);
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -157,7 +157,7 @@
* that not all executions are forced to have a name and duplicates are allowed.
* In case the {@link #executions} change, the executionsMap can be nulled or
* also updated (but a check needs to be added whether it exists). */
- protected transient Map<String, OpenExecution> executionsMap = null;
+ protected transient Map<String, Execution> executionsMap = null;
/** the queue of atomic operations to be performed for this execution. */
protected Queue<AtomicOperation> atomicOperations;
@@ -809,7 +809,7 @@
/** @see Execution#getExecution(String) */
public ExecutionImpl getExecution(String name) {
- Map<String, OpenExecution> executionsMap = getExecutionsMap();
+ Map<String, Execution> executionsMap = getExecutionsMap();
return (ExecutionImpl) (executionsMap!=null ? executionsMap.get(name) : null);
}
@@ -838,12 +838,12 @@
((ExecutionImpl)parent).removeExecution(child);
}
- public Map<String, OpenExecution> getExecutionsMap() {
+ public Map<String, Execution> getExecutionsMap() {
if ( (executionsMap==null)
&& (executions!=null)
) {
// initialize executionsMap cache
- executionsMap = new HashMap<String, OpenExecution>();
+ executionsMap = new HashMap<String, Execution>();
for(ExecutionImpl execution: executions) {
String executionName = execution.getName();
// the next test makes sure that the first execution wins
@@ -861,7 +861,25 @@
&& executionsMap.containsKey(name)
);
}
-
+
+ public ExecutionImpl findExecutionIn(String activityName) {
+ if ( activityName.equals(this.activityName)
+ && state.equals(STATE_ACTIVE)) {
+ return this;
+ }
+
+ if (executions!=null) {
+ for (ExecutionImpl childExecution: executions) {
+ ExecutionImpl found = childExecution.findExecutionIn(activityName);
+ if (found!=null) {
+ return found;
+ }
+ }
+ }
+
+ return null;
+ }
+
// sub process creation /////////////////////////////////////////////////////
public ClientProcessInstance createSubProcessInstance(ClientProcessDefinition processDefinition) {
@@ -1056,7 +1074,7 @@
public ObservableElement getEventSource() {
return eventSource;
}
- public Collection<OpenExecution> getExecutions() {
+ public Collection<Execution> getExecutions() {
return (Collection) executions;
}
public String getName() {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -97,29 +97,7 @@
return commandService.execute(new SignalCmd(executionId, null, parameters));
}
-
- public Execution signalExecutionByKey(String processDefinitionKey, String executionKey) {
- return signalExecutionById(processDefinitionKey+"."+executionKey, null, null);
- }
-
- public Execution signalExecutionByKey(String processDefinitionKey, String executionKey, String signalName) {
- return signalExecutionById(processDefinitionKey+"."+executionKey, signalName, null);
- }
-
- public Execution signalExecutionByKey(String processDefinitionKey, String executionKey, String signalName, Map<String, Object> parameters) {
- return signalExecutionById(processDefinitionKey+"."+executionKey, signalName, parameters);
- }
-
- public Execution signalExecutionByKey(String processDefinitionKey, String executionKey, Map<String, Object> parameters) {
- return signalExecutionById(processDefinitionKey+"."+executionKey, null, parameters);
- }
-
-
- public Execution findExecutionByKey(String processDefinitionName, String key) {
- return commandService.execute(new FindExecutionCmd(processDefinitionName, key));
- }
-
public Execution findExecutionById(String executionId) {
return commandService.execute(new FindExecutionCmd(executionId));
}
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml 2009-04-15 20:01:24 UTC (rev 4557)
@@ -69,7 +69,8 @@
<list name="executions"
cascade="all-delete-orphan"
- inverse="false">
+ inverse="false"
+ lazy="false">
<key column="PARENT_" foreign-key="FK_EXEC_PARENT" />
<list-index column="PARENT_IDX_" />
<one-to-many class="ExecutionImpl" />
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbpm.test.execution;
+
+import java.util.HashMap;
+
+import org.jbpm.Execution;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExecutionEagerLoadingTest extends JbpmTestCase {
+
+ public void testEagerLoading() {
+ deployJpdlXmlString(
+ "<process name='p'>" +
+ " <start>" +
+ " <transition to='f' />" +
+ " </start>" +
+ " <fork name='f'>" +
+ " <transition to='f1' />" +
+ " <transition to='f2' />" +
+ " </fork>" +
+ " <fork name='f1'>" +
+ " <transition to='s11' />" +
+ " <transition to='s12' />" +
+ " </fork>" +
+ " <fork name='f2'>" +
+ " <transition to='s21' />" +
+ " <transition to='s22' />" +
+ " </fork>" +
+ " <state name ='s11' />" +
+ " <state name ='s12' />" +
+ " <state name ='s21' />" +
+ " <state name ='s22' />" +
+ "</process>"
+ );
+
+ Execution processInstance = executionService.startProcessInstanceByKey("p");
+
+ processInstance = executionService.findExecutionById(processInstance.getId());
+
+ assertNotNull(processInstance.findExecutionIn("s11"));
+ assertNotNull(processInstance.findExecutionIn("s12"));
+ assertNotNull(processInstance.findExecutionIn("s21"));
+ assertNotNull(processInstance.findExecutionIn("s22"));
+
+ processInstance = executionService.findExecutionById(processInstance.getId());
+
+ assertEquals(6, processInstance.getExecutions().size());
+
+ processInstance = executionService.findExecutionById(processInstance.getId());
+
+ assertEquals(1, processInstance.getExecutionsMap().size());
+
+ processInstance = executionService.findExecutionById(processInstance.getId());
+
+ assertNotNull(processInstance.getExecution(null));
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -35,35 +35,6 @@
*/
public class SignalExecutionTest extends JbpmTestCase {
- public void testSignalExecutionByKey() {
- deployJpdlXmlString(
- "<process name='Insurance claim' key='ICL'>" +
- " <start>" +
- " <transition to='a' />" +
- " </start>" +
- " <state name='a'>" +
- " <transition to='b' />" +
- " </state>" +
- " <state name='b'>" +
- " <transition to='c' />" +
- " </state>" +
- " <state name='c' />" +
- "</process>"
- );
-
- Execution execution = executionService.startProcessInstanceByKey("ICL", "82436");
-
- assertEquals("a", execution.getActivityName());
-
- execution = executionService.signalExecutionByKey("ICL", "82436");
-
- assertEquals("b", execution.getActivityName());
-
- execution = executionService.signalExecutionByKey("ICL", "82436");
-
- assertEquals("c", execution.getActivityName());
- }
-
public void testSignalExecutionById() {
deployJpdlXmlString(
"<process name='Insurance claim' key='ICL'>" +
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml 2009-04-15 20:01:24 UTC (rev 4557)
@@ -69,7 +69,8 @@
<list name="executions"
cascade="all-delete-orphan"
- inverse="false">
+ inverse="false"
+ lazy="false">
<key column="PARENT_" foreign-key="FK_EXEC_PARENT" />
<list-index column="PARENT_IDX_" />
<one-to-many class="ExecutionImpl" />
Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeVariableDeclarationTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeVariableDeclarationTest.java 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeVariableDeclarationTest.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -126,7 +126,7 @@
expectedVariables.put("flight", "B52");
assertEquals(expectedVariables, processInstance.getVariables());
- OpenExecution outerExecution = processInstance.getExecution("outer");
+ OpenExecution outerExecution = (OpenExecution) processInstance.getExecution("outer");
expectedVariables.put("duration", "22 minutes");
assertEquals(expectedVariables, outerExecution.getVariables());
Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionBasedConcurrencyTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionBasedConcurrencyTest.java 2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionBasedConcurrencyTest.java 2009-04-15 20:01:24 UTC (rev 4557)
@@ -94,7 +94,7 @@
if (join.equals(execution.getActivity())) {
joinedExecutions.add(execution);
}
- Collection<OpenExecution> childExecutions = execution.getExecutions();
+ Collection<OpenExecution> childExecutions = (List)execution.getExecutions();
if (childExecutions!=null) {
for (OpenExecution childExecution: childExecutions) {
scanRecursive(childExecution, join, joinedExecutions);
17 years
JBoss JBPM SVN: r4556 - in projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client: v2 and 1 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-15 08:43:05 -0400 (Wed, 15 Apr 2009)
New Revision: 4556
Added:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/events/
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/events/BootstrapEvent.java
Modified:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainViewAction.java
Log:
Added bootstrap event: authentication, config, urlBuilder
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainView.java 2009-04-15 12:31:41 UTC (rev 4555)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainView.java 2009-04-15 12:43:05 UTC (rev 4556)
@@ -40,6 +40,7 @@
*/
public class MainView extends Composite implements ApplicationContext
{
+
private HTML status = new HTML();
private Header header;
private Menu menu;
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java 2009-04-15 12:31:41 UTC (rev 4555)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java 2009-04-15 12:43:05 UTC (rev 4556)
@@ -41,6 +41,7 @@
import org.jboss.bpm.console.client.Authentication;
import org.jboss.bpm.console.client.ConsoleConfig;
import org.jboss.bpm.console.client.URLBuilder;
+import org.jboss.bpm.console.client.v2.events.BootstrapEvent;
import org.jboss.bpm.console.client.util.ConsoleLog;
/**
@@ -149,7 +150,9 @@
window.hide();
// assemble main view
- controller.handleEvent( new Event("loginSuccessful", auth) );
+ controller.handleEvent( new Event("loginSuccessful",
+ new BootstrapEvent(auth, urlBuilder, config))
+ );
}
public void onLoginFailed(Request request, Throwable t)
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainView.java 2009-04-15 12:31:41 UTC (rev 4555)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainView.java 2009-04-15 12:43:05 UTC (rev 4556)
@@ -21,18 +21,193 @@
*/
package org.jboss.bpm.console.client.v2;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.RootPanel;
import com.mvc4g.client.ViewInterface;
import com.mvc4g.client.Controller;
+import org.gwt.mosaic.ui.client.MessageBox;
+import org.gwt.mosaic.ui.client.Viewport;
+import org.gwt.mosaic.ui.client.layout.BorderLayout;
+import static org.gwt.mosaic.ui.client.layout.BorderLayout.Region;
+import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+import org.jboss.bpm.console.client.*;
/**
+ * The main composite that assembles the gwt console application.
+ *
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class MainView implements ViewInterface
+public class MainView extends Composite implements ApplicationContext, ViewInterface
{
+
+ public final static String NAME = "mainView";
+
+ private HTML status = new HTML();
+ private Header header;
+ private Menu menu;
+ private Workspace workspace;
+
+ private URLBuilder urlBuilder;
+ private Authentication auth;
+
+ private ConsoleConfig config;
+
private Controller controller;
+ private boolean isInitialized;
+
+ public void init(Authentication auth, URLBuilder urlBuilder, ConsoleConfig config)
+ {
+ this.auth = auth;
+ this.config = config;
+ this.urlBuilder = urlBuilder;
+
+ isInitialized = true;
+ }
+
+ public void display()
+ {
+ if(!isInitialized)
+ throw new IllegalStateException("Not initalized");
+
+ Viewport viewport = new Viewport();
+
+ LayoutPanel layout = createLayout();
+ viewport.add(layout);
+
+ RootPanel.get().add(viewport);
+ }
+
public void setController(Controller controller)
{
this.controller = controller;
}
+
+ private LayoutPanel createLayout()
+ {
+ final LayoutPanel layoutPanel = new LayoutPanel(new BorderLayout());
+
+ // header
+ header = new Header(this, auth.getUsername(), auth.getRolesAssigned());
+ layoutPanel.add(header, new BorderLayoutData(Region.NORTH, 50));
+
+ // menu
+ menu = new Menu(this);
+ layoutPanel.add(menu, new BorderLayoutData(Region.WEST, 200));
+
+ // workspace
+ workspace = createWorkspace(layoutPanel);
+ layoutPanel.add(workspace, new BorderLayoutData(Region.CENTER, false));
+
+ //layoutPanel.add(b2, new BorderLayoutData(Region.SOUTH, 10, 200));
+ //layoutPanel.add(b3, new BorderLayoutData(Region.EAST, 10, 200));
+
+ return layoutPanel;
+ }
+
+ private Workspace createWorkspace(LayoutPanel layoutPanel)
+ {
+ Workspace workspace = new Workspace(menu);
+ WorkspaceLauncher launcher = GWT.create(WorkspaceLauncher.class);
+ launcher.launch(this, workspace);
+ return workspace;
+ }
+
+ /*private Panel createMainPanel()
+ {
+ Panel mainPanel = new Panel();
+ mainPanel.setBorder(false);
+ mainPanel.setPaddings(5); // outer most padding
+ mainPanel.setLayout(new FitLayout());
+ mainPanel.setWidth(UIConstants.OVERALL_WIDTH);
+ mainPanel.setHeight(UIConstants.OVERALL_WIDTH);
+ mainPanel.setAutoWidth(false);
+ return mainPanel;
+ }
+
+ private void assembleMainApplication(Panel mainPanel)
+ {
+ Panel borderPanel = new Panel();
+ borderPanel.setBorder(false);
+ borderPanel.setLayout(new BorderLayout());
+
+ // ------------------------------------------
+
+ header = new Header(this);
+ borderPanel.add(header, new BorderLayoutData(RegionPosition.NORTH));
+ header.setUserInfo(auth.getUsername(), auth.getRolesAssigned());
+
+ // ------------------------------------------
+
+ menu = new Menu(this);
+ BorderLayoutData menuData = new BorderLayoutData(RegionPosition.WEST);
+ menuData.setSplit(false);
+ menuData.setMinSize(UIConstants.MAIN_MENU_MIN);
+ menuData.setMaxSize(UIConstants.MAIN_MENU_MAX);
+ menuData.setMargins(new Margins(0, 5, 0, 0));
+ borderPanel.add(menu, menuData);
+
+ // ------------------------------------------
+
+ workspace = new Workspace(menu);
+ WorkspaceLauncher launcher = GWT.create(WorkspaceLauncher.class);
+ launcher.launch(this, workspace);
+
+ borderPanel.add(workspace, new BorderLayoutData(RegionPosition.CENTER));
+
+ // ------------------------------------------
+
+ mainPanel.add(borderPanel);
+ } */
+
+ public void addEditor(Editor editor)
+ {
+ ConsoleLog.debug("Add editor " + editor.getEditorId());
+ workspace.addEditor(editor, true);
+ }
+
+ public boolean hasEditor(String id)
+ {
+ return workspace.hasEditor(id);
+ }
+
+ public void showEditor(String id)
+ {
+ workspace.showEditor(id);
+ }
+
+ public URLBuilder getUrlBuilder()
+ {
+ return this.urlBuilder;
+ }
+
+ public void displayMessage(final String message, final boolean isError)
+ {
+ status.setText(message);
+
+ if(isError)
+ MessageBox.error("Error", message);
+ else
+ MessageBox.alert("Alert", message);
+ }
+
+ public Authentication getAuthentication()
+ {
+ return auth;
+ }
+
+ public ConsoleConfig getConfig()
+ {
+ return config;
+ }
+
+ public Workspace getWorkpace()
+ {
+ return workspace;
+ }
}
+
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainViewAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainViewAction.java 2009-04-15 12:31:41 UTC (rev 4555)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainViewAction.java 2009-04-15 12:43:05 UTC (rev 4556)
@@ -23,6 +23,7 @@
import com.mvc4g.client.ActionInterface;
import com.mvc4g.client.Controller;
+import org.jboss.bpm.console.client.v2.events.BootstrapEvent;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
@@ -31,6 +32,14 @@
{
public void execute(Controller controller, Object object)
{
- System.out.println("MainViewAction:" + object);
+ BootstrapEvent bootstrap = (BootstrapEvent)object;
+ MainView mainView = (MainView)controller.getView(MainView.NAME);
+ mainView.init(
+ bootstrap.getAuth(),
+ bootstrap.getUrlBuilder(),
+ bootstrap.getConfig()
+ );
+
+ mainView.display();
}
}
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/events/BootstrapEvent.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/events/BootstrapEvent.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/events/BootstrapEvent.java 2009-04-15 12:43:05 UTC (rev 4556)
@@ -0,0 +1,58 @@
+/*
+ * 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.v2.events;
+
+import org.jboss.bpm.console.client.Authentication;
+import org.jboss.bpm.console.client.URLBuilder;
+import org.jboss.bpm.console.client.ConsoleConfig;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class BootstrapEvent
+{
+ Authentication auth;
+ URLBuilder urlBuilder;
+ ConsoleConfig config;
+
+ public BootstrapEvent(Authentication auth, URLBuilder urlBuilder, ConsoleConfig config)
+ {
+ this.auth = auth;
+ this.urlBuilder = urlBuilder;
+ this.config = config;
+ }
+
+ public Authentication getAuth()
+ {
+ return auth;
+ }
+
+ public URLBuilder getUrlBuilder()
+ {
+ return urlBuilder;
+ }
+
+ public ConsoleConfig getConfig()
+ {
+ return config;
+ }
+}
17 years
JBoss JBPM SVN: r4555 - in projects/gwt-console/branches/hbraun: plugin-example and 6 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-15 08:31:41 -0400 (Wed, 15 Apr 2009)
New Revision: 4555
Added:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainViewAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditorNavigation.java
projects/gwt-console/branches/hbraun/war/src/main/resources/mvc4g-conf.xml
Modified:
projects/gwt-console/branches/hbraun/plugin-example/plugin-example.iml
projects/gwt-console/branches/hbraun/pom.xml
projects/gwt-console/branches/hbraun/war/pom.xml
projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml
projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg
Log:
MVC revamp, first cut
Modified: projects/gwt-console/branches/hbraun/plugin-example/plugin-example.iml
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-example/plugin-example.iml 2009-04-15 08:24:49 UTC (rev 4554)
+++ projects/gwt-console/branches/hbraun/plugin-example/plugin-example.iml 2009-04-15 12:31:41 UTC (rev 4555)
@@ -9,7 +9,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="rpc" />
+ <orderEntry type="module" module-name="toplevel" />
<orderEntry type="module" module-name="plugin-api" />
<orderEntry type="module-library">
<library name="M2 Dep: javax.xml.bind:jaxb-api:jar:2.1:compile">
@@ -68,8 +68,44 @@
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: com.gwtext:gwtext:jar:2.0.5:provided">
+ <library name="M2 Dep: com.googlecode.gwtmosaic:gwt-mosaic-gwtx:jar:0.1.9:compile">
<CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/com/googlecode/gwtmosaic/gwt-mosaic-gwtx/0.1.9/gwt-mosaic-gwtx-0.1.9.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="M2 Dep: com.googlecode.gwtmosaic:gwt-mosaic-dnd:jar:0.1.9:compile">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/com/googlecode/gwtmosaic/gwt-mosaic-dnd/0.1.9/gwt-mosaic-dnd-0.1.9.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="M2 Dep: com.googlecode.gwtmosaic:gwt-mosaic:jar:0.1.9:compile">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/com/googlecode/gwtmosaic/gwt-mosaic/0.1.9/gwt-mosaic-0.1.9.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="M2 Dep: com.googlecode.gwtmosaic:gwt-mosaic-incubator:jar:0.1.9:compile">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/com/googlecode/gwtmosaic/gwt-mosaic-incubator/0.1.9/gwt-mosaic-incubator-0.1.9.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="M2 Dep: com.gwtext:gwtext:jar:2.0.5:compile">
+ <CLASSES>
<root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/com/gwtext/gwtext/2.0.5/gwtext-2.0.5.jar!/" />
</CLASSES>
<JAVADOC />
Modified: projects/gwt-console/branches/hbraun/pom.xml
===================================================================
--- projects/gwt-console/branches/hbraun/pom.xml 2009-04-15 08:24:49 UTC (rev 4554)
+++ projects/gwt-console/branches/hbraun/pom.xml 2009-04-15 12:31:41 UTC (rev 4555)
@@ -19,6 +19,8 @@
<commons.fileupload.version>1.2.1</commons.fileupload.version>
<commons.io.version>1.3.2</commons.io.version>
<commons.logging.version>1.1.1</commons.logging.version>
+ <commons-lang.version>2.4</commons-lang.version>
+ <commons-config.version>1.6</commons-config.version>
<gson.version>1.2.2</gson.version>
<gwt.version>1.5.3</gwt.version>
<gwtext.version>2.0.5</gwtext.version>
@@ -30,6 +32,7 @@
<jboss.common.version>2.2.7.GA</jboss.common.version>
<jbpm.version>3.3.1.GA</jbpm.version>
<junit.version>3.8.1</junit.version>
+ <mvc4g.version>1.0.0-jboss</mvc4g.version>
<resteasy.version>1.0.2.GA</resteasy.version>
<stax-api.version>1.0-2</stax-api.version>
</properties>
@@ -46,6 +49,18 @@
<dependencyManagement>
<dependencies>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>${commons-lang.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>${commons-config.version}</version>
+ </dependency>
+
<!-- GWT related -->
<dependency>
<groupId>com.google.gwt</groupId>
@@ -94,12 +109,17 @@
<artifactId>gwt-mosaic-incubator</artifactId>
<version>${gwt-mosaic.version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>com.googlecode.gwtmosaic</groupId>
<artifactId>gwt-mosaic-gwtx</artifactId>
<version>${gwt-mosaic.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.googlecode.mvc4g</groupId>
+ <artifactId>mvc4g</artifactId>
+ <version>${mvc4g.version}</version>
+ </dependency>
<!-- Other -->
<dependency>
Modified: projects/gwt-console/branches/hbraun/war/pom.xml
===================================================================
--- projects/gwt-console/branches/hbraun/war/pom.xml 2009-04-15 08:24:49 UTC (rev 4554)
+++ projects/gwt-console/branches/hbraun/war/pom.xml 2009-04-15 12:31:41 UTC (rev 4555)
@@ -97,9 +97,25 @@
<artifactId>gwt-mosaic-gwtx</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.googlecode.mvc4g</groupId>
+ <artifactId>mvc4g</artifactId>
+
+ </dependency>
+
<!-- 3rd party -->
<dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
<scope>provided</scope>
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginAction.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginAction.java 2009-04-15 12:31:41 UTC (rev 4555)
@@ -0,0 +1,38 @@
+/*
+ * 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.v2;
+
+import com.mvc4g.client.ActionInterface;
+import com.mvc4g.client.Controller;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class LoginAction implements ActionInterface
+{
+
+ public void execute(Controller controller, Object object)
+ {
+ LoginView loginView = (LoginView)controller.getView(LoginView.NAME);
+ loginView.display();
+ }
+}
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java 2009-04-15 12:31:41 UTC (rev 4555)
@@ -0,0 +1,193 @@
+/*
+ * 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.v2;
+
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.user.client.WindowCloseListener;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.core.client.GWT;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.ViewInterface;
+import com.mvc4g.client.Event;
+import org.gwt.mosaic.forms.client.builder.DefaultFormBuilder;
+import org.gwt.mosaic.forms.client.layout.FormLayout;
+import org.gwt.mosaic.ui.client.WindowPanel;
+import org.gwt.mosaic.ui.client.layout.BorderLayout;
+import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.jboss.bpm.console.client.Authentication;
+import org.jboss.bpm.console.client.ConsoleConfig;
+import org.jboss.bpm.console.client.URLBuilder;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class LoginView implements ViewInterface
+{
+ public final static String NAME = "loginView";
+
+ private Controller controller;
+
+ private ConsoleConfig config;
+ private URLBuilder urlBuilder;
+ private Authentication auth;
+
+ private WindowPanel window = null;
+ private TextBox usernameInput;
+ private TextBox passwordInput;
+
+ public final static String[] KNOWN_ROLES = {"admin", "manager", "user"};
+
+
+ public LoginView()
+ {
+ config = new ConsoleConfig();
+
+ // setup
+
+ if (!GWT.isScript())
+ {
+ String proxyUrl = GWT.getModuleBaseURL() + "xhp";
+ config.setConsoleServerUrl(proxyUrl);
+ }
+
+ ConsoleLog.debug("Console server: " + config.getConsoleServerUrl());
+ ConsoleLog.debug("Report server: " + config.getReportServerUrl());
+
+ urlBuilder = new URLBuilder(config);
+
+ }
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+ public void display()
+ {
+ createLayoutWindowPanel();
+ window.center();
+ }
+
+ /**
+ * The 'layout' window panel.
+ */
+ private void createLayoutWindowPanel() {
+ window = new WindowPanel("jBPM Management Console");
+ window.setAnimationEnabled(false);
+ window.setSize("320px", "180px");
+
+ LayoutPanel panel = new LayoutPanel();
+ window.setWidget(panel);
+ createLayoutContent(panel);
+
+ window.addWindowCloseListener(new WindowCloseListener() {
+ public void onWindowClosed() {
+ window = null;
+ }
+
+ public String onWindowClosing() {
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Create content for layout.
+ */
+ private void createLayoutContent(LayoutPanel layoutPanel) {
+
+ layoutPanel.setLayout(new BorderLayout());
+ layoutPanel.setPadding(5);
+
+ final Button submit = new Button("Submit");
+ submit.addClickListener(new ClickListener()
+ {
+
+ public void onClick(Widget widget)
+ {
+ String user = usernameInput.getText();
+ String pass = passwordInput.getText();
+
+ String url = urlBuilder.getUserInRoleURL(KNOWN_ROLES);
+ auth = new Authentication(url);
+ auth.setCallback(
+ new Authentication.AuthCallback()
+ {
+
+ public void onLoginSuccess(Request request, Response response)
+ {
+ // clear the form
+ usernameInput.setText("");
+ passwordInput.setText("");
+
+ // display main console
+ window.hide();
+
+ // assemble main view
+ controller.handleEvent( new Event("loginSuccessful", auth) );
+ }
+
+ public void onLoginFailed(Request request, Throwable t)
+ {
+ // auth failed
+ ConsoleLog.error("Authentication failed.", t);
+ }
+ }
+ );
+
+ auth.doLogin(user, pass);
+ }
+ });
+
+ layoutPanel.add(createForm(), new BorderLayoutData(BorderLayout.Region.CENTER, 10, 200));
+ layoutPanel.add(submit, new BorderLayoutData(BorderLayout.Region.SOUTH, 10, 200));
+
+ }
+
+ private Widget createForm()
+ {
+ FormLayout layout = new FormLayout(
+ "right:pref, 10px, left:pref:grow", // 3 columns
+ "pref, pref, 5px, pref"); // 4 rows
+
+ DefaultFormBuilder builder = new DefaultFormBuilder(layout);
+ builder.appendSeparator("Login");
+
+ usernameInput = new TextBox();
+ builder.append("Username:", usernameInput);
+ builder.nextLine();
+
+ builder.nextLine(); // empty space
+
+ passwordInput = new TextBox();
+ builder.append("Password:", passwordInput);
+ builder.nextLine();
+
+ return builder.getPanel();
+ }
+}
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainView.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainView.java 2009-04-15 12:31:41 UTC (rev 4555)
@@ -0,0 +1,38 @@
+/*
+ * 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.v2;
+
+import com.mvc4g.client.ViewInterface;
+import com.mvc4g.client.Controller;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class MainView implements ViewInterface
+{
+ private Controller controller;
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+}
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainViewAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainViewAction.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainViewAction.java 2009-04-15 12:31:41 UTC (rev 4555)
@@ -0,0 +1,36 @@
+/*
+ * 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.v2;
+
+import com.mvc4g.client.ActionInterface;
+import com.mvc4g.client.Controller;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class MainViewAction implements ActionInterface
+{
+ public void execute(Controller controller, Object object)
+ {
+ System.out.println("MainViewAction:" + object);
+ }
+}
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java 2009-04-15 12:31:41 UTC (rev 4555)
@@ -0,0 +1,64 @@
+/*
+ * 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.v2.process;
+
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.Editor;
+import org.jboss.bpm.console.client.MenuSection;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ProcessEditor extends Editor
+{
+ public final static String ID = "org.jboss.bpm.process.ProcessEditor";
+
+ public ProcessEditor(ApplicationContext applicationContext)
+ {
+ super(applicationContext);
+ }
+
+ public String getEditorId()
+ {
+ return ID;
+ }
+
+ public String getTitle()
+ {
+ return "Processes";
+ }
+
+ public String getIconCSS()
+ {
+ return "bpm-process-icon";
+ }
+
+ public MenuSection provideMenuSection()
+ {
+ return new MenuSection(
+ "Process Management",
+ "bpm-process-icon",
+ new ProcessEditorNavigation(appContext)
+ );
+ }
+}
+
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditorNavigation.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditorNavigation.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditorNavigation.java 2009-04-15 12:31:41 UTC (rev 4555)
@@ -0,0 +1,63 @@
+/*
+ * 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.v2.process;
+
+import com.google.gwt.user.client.ui.Tree;
+import com.google.gwt.user.client.ui.TreeItem;
+import com.google.gwt.user.client.ui.TreeListener;
+import org.jboss.bpm.console.client.Workspace;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.process.ProcessEditor;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ProcessEditorNavigation extends Tree
+{
+
+ public ProcessEditorNavigation(final ApplicationContext appContext)
+ {
+ super.setTitle("Processes");
+
+ TreeItem root = addItem("Process Definitions");
+ TreeItem definitions = root.addItem("View definitions");
+
+ addTreeListener(
+ new TreeListener()
+ {
+ public void onTreeItemSelected(TreeItem treeItem)
+ {
+ if("View definitions".equals(treeItem.getText()))
+ {
+ Workspace workspace = appContext.getWorkpace();
+ workspace.showEditor(ProcessEditor.ID);
+ }
+ }
+
+ public void onTreeItemStateChanged(TreeItem treeItem)
+ {
+
+ }
+ }
+ );
+ }
+}
Added: projects/gwt-console/branches/hbraun/war/src/main/resources/mvc4g-conf.xml
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/resources/mvc4g-conf.xml (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/resources/mvc4g-conf.xml 2009-04-15 12:31:41 UTC (rev 4555)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ Console MVC configuration
+ Further explanations canbe found here:
+ http://code.google.com/p/mvc4g
+ -->
+<mvc4g>
+ <controller name="mainController" class="com.mvc4g.client.Controller">
+ <views>
+ <view name="loginView" class="org.jboss.bpm.console.client.v2.LoginView" />
+ <view name="mainView" class="org.jboss.bpm.console.client.v2.MainView" />
+ </views>
+ <actions>
+ <action name="login" class="org.jboss.bpm.console.client.v2.LoginAction" />
+ <action name="loginSuccessful" class="org.jboss.bpm.console.client.v2.MainViewAction" />
+ </actions>
+ </controller>
+
+ <start controllerName="mainController" actionName="login" />
+
+</mvc4g>
\ No newline at end of file
Modified: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml 2009-04-15 08:24:49 UTC (rev 4554)
+++ projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml 2009-04-15 12:31:41 UTC (rev 4555)
@@ -20,6 +20,9 @@
<inherits name='org.gwt.mosaic.ui.UI'/>
<inherits name="org.gwt.mosaic.forms.Forms"/>
+ <!-- mvc4g -->
+ <inherits name='com.mvc4g.Mvc4gModule'/>
+
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
@@ -46,7 +49,7 @@
<set-property name="log_WindowLogger" value="DISABLED" />
<!-- Specify the app entry point class. -->
- <entry-point class='org.jboss.bpm.console.client.Application' />
+ <entry-point class='com.mvc4g.client.Mvc4gEntryPoint' />
<servlet path="/xhp" class="jmaki.xhp.XmlHttpProxyServlet"/>
Modified: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg 2009-04-15 08:24:49 UTC (rev 4554)
+++ projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg 2009-04-15 12:31:41 UTC (rev 4555)
@@ -1,4 +1,4 @@
-org.jboss.bpm.console.client.process.ProcessEditor
+org.jboss.bpm.console.client.v2.process.ProcessEditor
org.jboss.bpm.console.client.task.TaskEditor
# not yet implemented in jBPM4
17 years