JBoss JBPM SVN: r2570 - jbpm3/trunk/modules/core/src/main/java/org/jbpm/command.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-10-21 11:56:41 -0400 (Tue, 21 Oct 2008)
New Revision: 2570
Added:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstancesCommand.java
Log:
Retrieve instance by ID. Added DeleteProcessDefinition command
Added: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java (rev 0)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java 2008-10-21 15:56:41 UTC (rev 2570)
@@ -0,0 +1,49 @@
+/*
+ * 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.jbpm.command;
+
+import org.jbpm.JbpmContext;
+import org.jbpm.graph.def.ProcessDefinition;
+
+/**
+ * Delete a proces definition by ID
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class DeleteProcessdefinitionCommand extends AbstractGetObjectBaseCommand {
+
+ private static final long serialVersionUID = -1908847549444051495L;
+
+ private long id;
+
+ public DeleteProcessdefinitionCommand(long id) {
+ super();
+ this.id = id;
+ }
+
+ public Object execute(JbpmContext jbpmContext) throws Exception
+ {
+ jbpmContext.getGraphSession().deleteProcessDefinition(id);
+ return Boolean.TRUE;
+ }
+
+}
Property changes on: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstancesCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstancesCommand.java 2008-10-21 15:16:57 UTC (rev 2569)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstancesCommand.java 2008-10-21 15:56:41 UTC (rev 2570)
@@ -10,154 +10,194 @@
/**
* This command can retrieve all process instances (e.g. for admin client).
- *
+ *
* You have the possibility to filter the command, therefor use the available
* attributes
- *
+ *
* @author Bernd Ruecker (bernd.ruecker(a)camunda.com)
*/
public class GetProcessInstancesCommand extends AbstractGetObjectBaseCommand {
- private static final long serialVersionUID = -5601050489405283851L;
+ private static final long serialVersionUID = -5601050489405283851L;
- /*
- * is true, only the running process instances are retrieved (ended and
- * canceled ones are skipped)
- */
- private boolean onlyRunning = true;
+ /*
+ * is true, only the running process instances are retrieved (ended and
+ * canceled ones are skipped)
+ */
+ private boolean onlyRunning = true;
- /*
- * if given, only processes with start date >= given date are shown
- */
- private Date fromStartDate;
+ /*
+ * if given, only processes with start date >= given date are shown
+ */
+ private Date fromStartDate;
- /*
- * if given, only processes with start date <= given date are shown
- */
- private Date untilStartDate;
+ /*
+ * if given, only processes with start date <= given date are shown
+ */
+ private Date untilStartDate;
- /*
- * if given, only processes with this name are retrieved
- */
- private String processName;
+ /*
+ * if given, only processes with this name are retrieved
+ */
+ private String processName;
- /*
- * if given, only processes with this name are retrieved
- */
- private String stateName;
+ private long processId = -1;
+ /*
+ * if given, only processes with this name are retrieved
+ */
+ private String stateName;
- private transient boolean firstExpression = true;
+ private String version = null;
- private String getConcatExpression() {
- if (firstExpression) {
- firstExpression = false;
- return " where ";
- }
- return " and ";
- }
+ private transient boolean firstExpression = true;
- public Object execute(JbpmContext jbpmContext) throws Exception {
- setJbpmContext(jbpmContext);
- firstExpression = true;
- StringBuffer queryText = new StringBuffer("select pi" + " from org.jbpm.graph.exe.ProcessInstance as pi ");
+ private String getConcatExpression() {
+ if (firstExpression) {
+ firstExpression = false;
+ return " where ";
+ }
+ return " and ";
+ }
- if (onlyRunning) {
- queryText.append(getConcatExpression()).append(" pi.end = null");
- }
+ public Object execute(JbpmContext jbpmContext) throws Exception {
+ setJbpmContext(jbpmContext);
+ firstExpression = true;
+ StringBuffer queryText = new StringBuffer("select pi" + " from org.jbpm.graph.exe.ProcessInstance as pi ");
- if (fromStartDate != null) {
- queryText.append(getConcatExpression()).append(" pi.start >= :from ");
- }
- if (untilStartDate != null) {
- queryText.append(getConcatExpression()).append(" pi.start <= :until ");
- }
+ if (onlyRunning) {
+ queryText.append(getConcatExpression()).append(" pi.end = null");
+ }
- // name
- if (processName != null && processName.length() > 0) {
- queryText.append(getConcatExpression()).append(" pi.processDefinition.name = :processDefinitionName ");
- }
+ if (fromStartDate != null) {
+ queryText.append(getConcatExpression()).append(" pi.start >= :from ");
+ }
+ if (untilStartDate != null) {
+ queryText.append(getConcatExpression()).append(" pi.start <= :until ");
+ }
+ if (version != null) {
+ queryText.append(getConcatExpression()).append(" pi.version = :version ");
+ }
- // TODO: this code only fecthes root tokens, child-tokens has to be
- // considered too!
- if (stateName != null && stateName.length() > 0) {
- queryText.append(getConcatExpression()).append(" pi.rootToken.node.name = :nodeName ");
- }
+ // name
+ if(processId!=-1)
+ {
+ queryText.append(getConcatExpression()).append(" pi.processDefinition.id = :processId ");
+ }
+ else if (processName != null && processName.length() > 0) {
+ queryText.append(getConcatExpression()).append(" pi.processDefinition.name = :processDefinitionName ");
+ }
- queryText.append(" order by pi.start desc");
+ // TODO: this code only fecthes root tokens, child-tokens has to be
+ // considered too!
+ if (stateName != null && stateName.length() > 0) {
+ queryText.append(getConcatExpression()).append(" pi.rootToken.node.name = :nodeName ");
+ }
- Query query = jbpmContext.getSession().createQuery(queryText.toString());
+ queryText.append(" order by pi.start desc");
- if (fromStartDate != null) {
- query.setTimestamp("from", fromStartDate);
- }
- if (untilStartDate != null) {
- query.setTimestamp("until", untilStartDate);
- }
+ Query query = jbpmContext.getSession().createQuery(queryText.toString());
- if (processName != null && processName.length() > 0) {
- query.setString("processDefinitionName", processName);
- }
+ if (fromStartDate != null) {
+ query.setTimestamp("from", fromStartDate);
+ }
+ if (untilStartDate != null) {
+ query.setTimestamp("until", untilStartDate);
+ }
- if (stateName != null && stateName.length() > 0) {
- query.setString("nodeName", stateName);
- }
+ if(processId!=-1)
+ {
+ query.setLong("processId", processId);
+ }
+ if (processName != null && processName.length() > 0) {
+ query.setString("processDefinitionName", processName);
+ }
- return retrieveProcessInstanceDetails(query.list());
- }
+ if (stateName != null && stateName.length() > 0) {
+ query.setString("nodeName", stateName);
+ }
- /**
- * access everything on all processInstance objects, which is not in the
- * default fetch group from hibernate, but needs to be accesible from the
- * client
- *
- * overwrite this, if you need more details in your client
- */
- public List retrieveProcessInstanceDetails(List processInstanceList) {
- Iterator it = processInstanceList.iterator();
- while (it.hasNext()) {
- retrieveProcessInstance((ProcessInstance) it.next());
- }
- return processInstanceList;
- }
+ if(version!=null)
+ {
+ query.setString("version", version);
+ }
- public Date getFromStartDate() {
- return fromStartDate;
- }
+ return retrieveProcessInstanceDetails(query.list());
+ }
- public void setFromStartDate(Date fromStartDate) {
- this.fromStartDate = fromStartDate;
- }
+ /**
+ * access everything on all processInstance objects, which is not in the
+ * default fetch group from hibernate, but needs to be accesible from the
+ * client
+ *
+ * overwrite this, if you need more details in your client
+ */
+ public List retrieveProcessInstanceDetails(List processInstanceList) {
+ Iterator it = processInstanceList.iterator();
+ while (it.hasNext()) {
+ retrieveProcessInstance((ProcessInstance) it.next());
+ }
+ return processInstanceList;
+ }
- public boolean isOnlyRunning() {
- return onlyRunning;
- }
+ public Date getFromStartDate() {
+ return fromStartDate;
+ }
- public void setOnlyRunning(boolean onlyRunning) {
- this.onlyRunning = onlyRunning;
- }
+ public void setFromStartDate(Date fromStartDate) {
+ this.fromStartDate = fromStartDate;
+ }
- public String getProcessName() {
- return processName;
- }
+ public boolean isOnlyRunning() {
+ return onlyRunning;
+ }
- public void setProcessName(String processName) {
- this.processName = processName;
- }
+ public void setOnlyRunning(boolean onlyRunning) {
+ this.onlyRunning = onlyRunning;
+ }
- public String getStateName() {
- return stateName;
- }
+ public String getProcessName() {
+ return processName;
+ }
- public void setStateName(String stateName) {
- this.stateName = stateName;
- }
+ public void setProcessName(String processName) {
+ this.processName = processName;
+ }
- public Date getUntilStartDate() {
- return untilStartDate;
- }
+ public String getStateName() {
+ return stateName;
+ }
- public void setUntilStartDate(Date untilStartDate) {
- this.untilStartDate = untilStartDate;
- }
+ public void setStateName(String stateName) {
+ this.stateName = stateName;
+ }
+ public Date getUntilStartDate() {
+ return untilStartDate;
+ }
+
+ public void setUntilStartDate(Date untilStartDate) {
+ this.untilStartDate = untilStartDate;
+ }
+
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(String version)
+ {
+ this.version = version;
+ }
+
+
+ public long getProcessId()
+ {
+ return processId;
+ }
+
+ public void setProcessId(long processId)
+ {
+ this.processId = processId;
+ }
}
17 years, 6 months
JBoss JBPM SVN: r2569 - in jbpm3/trunk/modules/core: src/main/java/org/jbpm/mail and 1 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-21 11:16:57 -0400 (Tue, 21 Oct 2008)
New Revision: 2569
Removed:
jbpm3/trunk/modules/core/src/test/java/org/jbpm/mail/RealServerMailTestCase.java
Modified:
jbpm3/trunk/modules/core/pom.xml
jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail/Mail.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/mail/MailTest.java
Log:
[JBPM-1722] Fix or remove mail tests
Modified: jbpm3/trunk/modules/core/pom.xml
===================================================================
--- jbpm3/trunk/modules/core/pom.xml 2008-10-21 13:41:46 UTC (rev 2568)
+++ jbpm3/trunk/modules/core/pom.xml 2008-10-21 15:16:57 UTC (rev 2569)
@@ -197,10 +197,6 @@
<!-- https://jira.jboss.org/jira/browse/JBPM-1721 -->
<exclude>org/jbpm/job/executor/JobLoadJoinTest.java</exclude>
<exclude>org/jbpm/job/executor/JobLoadSubProcessTest.java</exclude>
- <!-- https://jira.jboss.org/jira/browse/JBPM-1722 -->
- <exclude>org/jbpm/mail/MailTest.java</exclude>
- <exclude>org/jbpm/mail/TaskMailTest.java</exclude>
- <exclude>org/jbpm/mail/RealServerMailTestCase.java</exclude>
<!-- https://jira.jboss.org/jira/browse/JBPM-1723 -->
<exclude>org/jbpm/perf/PerfWithoutDbTest.java</exclude>
<exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
@@ -236,10 +232,6 @@
<!-- https://jira.jboss.org/jira/browse/JBPM-1721 -->
<exclude>org/jbpm/job/executor/JobLoadJoinTest.java</exclude>
<exclude>org/jbpm/job/executor/JobLoadSubProcessTest.java</exclude>
- <!-- https://jira.jboss.org/jira/browse/JBPM-1722 -->
- <exclude>org/jbpm/mail/MailTest.java</exclude>
- <exclude>org/jbpm/mail/TaskMailTest.java</exclude>
- <exclude>org/jbpm/mail/RealServerMailTestCase.java</exclude>
<!-- https://jira.jboss.org/jira/browse/JBPM-1723 -->
<exclude>org/jbpm/perf/PerfWithoutDbTest.java</exclude>
<exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
@@ -275,10 +267,6 @@
<!-- https://jira.jboss.org/jira/browse/JBPM-1721 -->
<exclude>org/jbpm/job/executor/JobLoadJoinTest.java</exclude>
<exclude>org/jbpm/job/executor/JobLoadSubProcessTest.java</exclude>
- <!-- https://jira.jboss.org/jira/browse/JBPM-1722 -->
- <exclude>org/jbpm/mail/MailTest.java</exclude>
- <exclude>org/jbpm/mail/TaskMailTest.java</exclude>
- <exclude>org/jbpm/mail/RealServerMailTestCase.java</exclude>
<!-- https://jira.jboss.org/jira/browse/JBPM-1723 -->
<exclude>org/jbpm/perf/PerfWithoutDbTest.java</exclude>
<exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
@@ -316,10 +304,6 @@
<!-- https://jira.jboss.org/jira/browse/JBPM-1721 -->
<exclude>org/jbpm/job/executor/JobLoadJoinTest.java</exclude>
<exclude>org/jbpm/job/executor/JobLoadSubProcessTest.java</exclude>
- <!-- https://jira.jboss.org/jira/browse/JBPM-1722 -->
- <exclude>org/jbpm/mail/MailTest.java</exclude>
- <exclude>org/jbpm/mail/TaskMailTest.java</exclude>
- <exclude>org/jbpm/mail/RealServerMailTestCase.java</exclude>
<!-- https://jira.jboss.org/jira/browse/JBPM-1723 -->
<exclude>org/jbpm/perf/PerfWithoutDbTest.java</exclude>
<exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
@@ -358,10 +342,6 @@
<!-- https://jira.jboss.org/jira/browse/JBPM-1721 -->
<exclude>org/jbpm/job/executor/JobLoadJoinTest.java</exclude>
<exclude>org/jbpm/job/executor/JobLoadSubProcessTest.java</exclude>
- <!-- https://jira.jboss.org/jira/browse/JBPM-1722 -->
- <exclude>org/jbpm/mail/MailTest.java</exclude>
- <exclude>org/jbpm/mail/TaskMailTest.java</exclude>
- <exclude>org/jbpm/mail/RealServerMailTestCase.java</exclude>
<!-- https://jira.jboss.org/jira/browse/JBPM-1723 -->
<exclude>org/jbpm/perf/PerfWithoutDbTest.java</exclude>
<exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail/Mail.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail/Mail.java 2008-10-21 13:41:46 UTC (rev 2568)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/mail/Mail.java 2008-10-21 15:16:57 UTC (rev 2569)
@@ -107,7 +107,7 @@
}
}
if (bcc!=null) {
- String resolvedTo = evaluate(to);
+ String resolvedTo = evaluate(bcc);
recipients.addAll(tokenize(resolvedTo));
}
if (JbpmConfiguration.Configs.hasObject("jbpm.mail.bcc.address")) {
@@ -170,13 +170,13 @@
}
public static void send(Properties mailServerProperties, String fromAddress, List recipients, List bccRecipients, String subject, String text) {
- if ( (recipients==null)
- || (recipients.isEmpty())
+ if ( ((recipients==null) || (recipients.isEmpty()))
+ && ((bccRecipients==null) || (bccRecipients.isEmpty()))
) {
log.debug("skipping mail because there are no recipients");
return;
}
- log.debug("sending email to '"+recipients+"' about '"+subject+"'");
+ log.debug("sending email to '"+recipients+"' "+(bccRecipients!=null ? "and in bcc to '"+bccRecipients+"' " : "")+"about '"+subject+"'");
Session session = Session.getDefaultInstance(mailServerProperties, null);
MimeMessage message = new MimeMessage(session);
try {
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/mail/MailTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/mail/MailTest.java 2008-10-21 13:41:46 UTC (rev 2568)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/mail/MailTest.java 2008-10-21 15:16:57 UTC (rev 2569)
@@ -81,26 +81,20 @@
}
public void testMailWithBccAddress() {
- String to = "sample.shipper(a)example.domain";
String bcc = "bcc(a)example.domain";
String subject = "latest news";
String text = "roy is assurancetourix";
- Mail mail = new Mail(null, null, to, null, bcc, subject, text);
+ Mail mail = new Mail(null, null, null, null, bcc, subject, text);
mail.send();
- assertTrue(server.getReceivedEmailSize() == 2);
+ assertEquals(1, server.getReceivedEmailSize());
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email1 = (SmtpMessage) emailIter.next();
assertEquals("latest news", email1.getHeaderValue("Subject"));
assertEquals("roy is assurancetourix", email1.getBody());
- assertEquals("sample.shipper(a)example.domain", email1.getHeaderValue("To"));
-
- SmtpMessage email2 = (SmtpMessage) emailIter.next();
- assertEquals("latest news", email2.getHeaderValue("Subject"));
- assertEquals("roy is assurancetourix", email2.getBody());
- assertEquals("bcc(a)example.domain", email2.getHeaderValue("To"));
-}
+ assertNull(email1.getHeaderValue("To"));
+ }
public void testMailNodeAttributes() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
Deleted: jbpm3/trunk/modules/core/src/test/java/org/jbpm/mail/RealServerMailTestCase.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/mail/RealServerMailTestCase.java 2008-10-21 13:41:46 UTC (rev 2568)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/mail/RealServerMailTestCase.java 2008-10-21 15:16:57 UTC (rev 2569)
@@ -1,86 +0,0 @@
-package org.jbpm.mail;
-
-import org.jbpm.AbstractJbpmTestCase;
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.svc.Service;
-import org.jbpm.svc.ServiceFactory;
-
-public class RealServerMailTestCase extends AbstractJbpmTestCase {
-
- public static class TestAddressResolver implements AddressResolver, ServiceFactory, Service {
- private static final long serialVersionUID = 1L;
- public Object resolveAddress(String actorId) {
- return actorId+"@localhost";
- }
- public Service openService() {
- return this;
- }
- public void close() {
- }
- }
-
-
- static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
- "<jbpm-configuration>" +
- " <jbpm-context>" +
- " <service name='addressresolver' factory='org.jbpm.mail.RealServerMailTestCase$TestAddressResolver' />" +
- " </jbpm-context>" +
- " <string name='resource.mail.properties' value='org/jbpm/mail/test.mail.properties' />" +
- " <bean name='jbpm.variable.resolver' class='org.jbpm.jpdl.el.impl.JbpmVariableResolver' singleton='true' />" +
- " <string name='resource.hibernate.cfg.xml' value='hibernate.cfg.xml' />" +
- " <string name='resource.business.calendar' value='org/jbpm/calendar/jbpm.business.calendar.properties' />" +
- " <string name='resource.default.modules' value='org/jbpm/graph/def/jbpm.default.modules.properties' />" +
- " <string name='resource.converter' value='org/jbpm/db/hibernate/jbpm.converter.properties' />" +
- " <string name='resource.action.types' value='org/jbpm/graph/action/action.types.xml' />" +
- " <string name='resource.node.types' value='org/jbpm/graph/node/node.types.xml' />" +
- " <string name='resource.parsers' value='org/jbpm/jpdl/par/jbpm.parsers.xml' />" +
- " <string name='resource.varmapping' value='org/jbpm/context/exe/jbpm.varmapping.xml' />" +
- " <string name='resource.repository.cfg.xml' value='repository.cfg.xml' />" +
- "</jbpm-configuration>"
- );
-
- JbpmContext jbpmContext = null;
-
- protected void setUp() throws Exception
- {
- super.setUp();
- jbpmContext = jbpmConfiguration.createJbpmContext();
- }
-
- protected void tearDown() throws Exception
- {
- jbpmContext.close();
- super.tearDown();
- }
-
- public void testSimplMail() {
- String actors = "sample.manager@localhost";
- String subject = "latest news";
- String text = "roy is assurancetourix";
-
- Mail mail = new Mail(null, actors, null, subject, text);
- mail.send();
- }
-
- public void testMailNodeElements() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <start-state>" +
- " <transition to='send email' />" +
- " </start-state>" +
- " <mail-node name='send email' actors='manager'>" +
- " <subject>readmylips</subject>" +
- " <text><![CDATA[ no \n more \n taxes ]]></text>" +
- " <transition to='end' />" +
- " </mail-node>" +
- " <end-state name='end' />" +
- "</process-definition>"
- );
- ProcessInstance processInstance = new ProcessInstance(processDefinition);
- processInstance.signal();
- }
-
-}
17 years, 6 months
JBoss JBPM SVN: r2568 - in jbpm3/trunk/modules: enterprise/jar/scripts and 2 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-10-21 09:41:46 -0400 (Tue, 21 Oct 2008)
New Revision: 2568
Added:
jbpm3/trunk/modules/enterprise/jar/src/main/etc/hibernate.extra.hbm.xml
Removed:
jbpm3/trunk/modules/enterprise/jar/src/test/resources/hibernate.extra.hbm.xml
Modified:
jbpm3/trunk/modules/distribution/src/main/resources/installer/install-definition.xml
jbpm3/trunk/modules/enterprise/jar/scripts/assembly-config.xml
Log:
Make hibernate.extra.hbm.xml part of the distribution
Modified: jbpm3/trunk/modules/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- jbpm3/trunk/modules/distribution/src/main/resources/installer/install-definition.xml 2008-10-21 13:03:44 UTC (rev 2567)
+++ jbpm3/trunk/modules/distribution/src/main/resources/installer/install-definition.xml 2008-10-21 13:41:46 UTC (rev 2568)
@@ -165,6 +165,7 @@
<fileset dir="@{deploy.artifacts.dir}/resources/jbpm-enterprise-config" targetdir="${installPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
override="true">
<include name="jbpm.cfg.xml" />
+ <include name="hibernate.extra.hbm.xml" />
</fileset>
<file src="@{deploy.artifacts.dir}/lib/jbpm-identity-service.zip" targetdir="${installPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
unpack="true" override="true" />
Modified: jbpm3/trunk/modules/enterprise/jar/scripts/assembly-config.xml
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/scripts/assembly-config.xml 2008-10-21 13:03:44 UTC (rev 2567)
+++ jbpm3/trunk/modules/enterprise/jar/scripts/assembly-config.xml 2008-10-21 13:41:46 UTC (rev 2568)
@@ -11,6 +11,7 @@
<outputDirectory>/</outputDirectory>
<includes>
<include>jbpm.cfg.xml</include>
+ <include>hibernate.extra.hbm.xml</include>
</includes>
</fileSet>
</fileSets>
Added: jbpm3/trunk/modules/enterprise/jar/src/main/etc/hibernate.extra.hbm.xml
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/main/etc/hibernate.extra.hbm.xml (rev 0)
+++ jbpm3/trunk/modules/enterprise/jar/src/main/etc/hibernate.extra.hbm.xml 2008-10-21 13:41:46 UTC (rev 2568)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+
+ <!-- ################################################## -->
+ <!-- # Additional mappings defined per module go here # -->
+ <!-- ################################################## -->
+
+</hibernate-mapping>
Property changes on: jbpm3/trunk/modules/enterprise/jar/src/main/etc/hibernate.extra.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm3/trunk/modules/enterprise/jar/src/test/resources/hibernate.extra.hbm.xml
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/resources/hibernate.extra.hbm.xml 2008-10-21 13:03:44 UTC (rev 2567)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/resources/hibernate.extra.hbm.xml 2008-10-21 13:41:46 UTC (rev 2568)
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping>
-
- <!-- ################################################## -->
- <!-- # Additional mappings defined per module go here # -->
- <!-- ################################################## -->
-
-</hibernate-mapping>
17 years, 6 months
JBoss JBPM SVN: r2567 - jbpm3/trunk/modules/core/src/test/java/org/jbpm/job/executor.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-21 09:03:44 -0400 (Tue, 21 Oct 2008)
New Revision: 2567
Modified:
jbpm3/trunk/modules/core/src/test/java/org/jbpm/job/executor/JobLoadJoinTest.java
Log:
[JBPM-1721] added cleanup and verified exception mentioned in issue.
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/job/executor/JobLoadJoinTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/job/executor/JobLoadJoinTest.java 2008-10-21 12:43:40 UTC (rev 2566)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/job/executor/JobLoadJoinTest.java 2008-10-21 13:03:44 UTC (rev 2567)
@@ -45,29 +45,6 @@
int processes = 20;
int maxWait = 20000;
- deployProcess();
-
- getJbpmConfiguration().startJobExecutor();
-
- Set expectedProcesses = new HashSet();
- for (int i = 0; i < processes; i++)
- {
- Integer number = new Integer(i);
- expectedProcesses.add(number);
- Thread thread = new StartNewExecutionThread(getJbpmConfiguration(), number);
- thread.start();
- }
-
- while (!expectedProcesses.equals(finishedProcesses) && !timeout(maxWait))
- {
- Thread.sleep(200);
- }
- log.info("number of finished processes: " + finishedProcesses);
- log.info("number of expected processes: " + expectedProcesses);
- assertEquals(expectedProcesses, finishedProcesses);
- }
-
- public void deployProcess() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition name='asyncjoin' initial='yenom'>" +
" <node name='yenom' async='true'>" +
@@ -96,17 +73,40 @@
"</process-definition>"
);
- JbpmContext jbpmContext = getJbpmConfiguration().createJbpmContext();
- try
- {
- jbpmContext.deployProcessDefinition(processDefinition);
+ jbpmContext.deployProcessDefinition(processDefinition);
+ long processDefinitionId = processDefinition.getId();
+
+ commitAndCloseSession();
+
+ try {
+ getJbpmConfiguration().startJobExecutor();
+
+ Set expectedProcesses = new HashSet();
+ for (int i = 0; i < processes; i++)
+ {
+ Integer number = new Integer(i);
+ expectedProcesses.add(number);
+ Thread thread = new StartNewExecutionThread(getJbpmConfiguration(), number);
+ thread.start();
+ }
+
+ while (!expectedProcesses.equals(finishedProcesses) && !timeout(maxWait))
+ {
+ Thread.sleep(200);
+ }
+ log.info("number of finished processes: " + finishedProcesses);
+ log.info("number of expected processes: " + expectedProcesses);
+ assertEquals(expectedProcesses, finishedProcesses);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+
+ } finally {
+ beginSessionTransaction();
+ graphSession.deleteProcessDefinition(processDefinitionId);
}
- finally
- {
- jbpmContext.close();
- }
}
-
+
public static class StartNewExecutionThread extends Thread
{
Integer number;
17 years, 6 months
JBoss JBPM SVN: r2566 - jbpm3/trunk/modules/identity/src/main/resources.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-21 08:43:40 -0400 (Tue, 21 Oct 2008)
New Revision: 2566
Added:
jbpm3/trunk/modules/identity/src/main/resources/hibernate.extra.hbm.xml
Log:
added missing hibernate.extra.hbm.xml
Added: jbpm3/trunk/modules/identity/src/main/resources/hibernate.extra.hbm.xml
===================================================================
--- jbpm3/trunk/modules/identity/src/main/resources/hibernate.extra.hbm.xml (rev 0)
+++ jbpm3/trunk/modules/identity/src/main/resources/hibernate.extra.hbm.xml 2008-10-21 12:43:40 UTC (rev 2566)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+
+ <!-- ################################################## -->
+ <!-- # Additional mappings defined per module go here # -->
+ <!-- ################################################## -->
+
+</hibernate-mapping>
17 years, 6 months
JBoss JBPM SVN: r2565 - jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/exe.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-21 08:28:45 -0400 (Tue, 21 Oct 2008)
New Revision: 2565
Modified:
jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/exe/BusinessKeyDbTest.java
Log:
[JBPM-1741] Cleanup BusinessKeyDbTest
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/exe/BusinessKeyDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/exe/BusinessKeyDbTest.java 2008-10-21 11:58:14 UTC (rev 2564)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/exe/BusinessKeyDbTest.java 2008-10-21 12:28:45 UTC (rev 2565)
@@ -30,6 +30,7 @@
}
finally
{
+ newTransaction();
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
@@ -37,27 +38,25 @@
public void testDuplicateBusinessKeyInDifferentProcesses()
{
- if (true)
- {
- System.out.println("FIXME [JBPM-1741]: Cleanup BusinessKeyDbTest");
- return;
- }
-
ProcessDefinition processDefinitionOne = new ProcessDefinition("businesskeytest1");
processDefinitionOne = saveAndReload(processDefinitionOne);
+ long processDefinitionIdOne = processDefinitionOne.getId();
ProcessDefinition processDefinitionTwo = new ProcessDefinition("businesskeytest2");
processDefinitionTwo = saveAndReload(processDefinitionTwo);
+ long processDefinitionIdTwo = processDefinitionTwo.getId();
try
{
jbpmContext.newProcessInstanceForUpdate("businesskeytest1").setKey("duplicatekey");
+ newTransaction();
jbpmContext.newProcessInstanceForUpdate("businesskeytest2").setKey("duplicatekey");
}
finally
{
- jbpmContext.getGraphSession().deleteProcessDefinition(processDefinitionOne.getId());
- jbpmContext.getGraphSession().deleteProcessDefinition(processDefinitionTwo.getId());
+ newTransaction();
+ graphSession.deleteProcessDefinition(processDefinitionIdOne);
+ graphSession.deleteProcessDefinition(processDefinitionIdTwo);
}
}
}
17 years, 6 months
JBoss JBPM SVN: r2564 - jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-21 07:58:14 -0400 (Tue, 21 Oct 2008)
New Revision: 2564
Modified:
jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java
Log:
[JBPM-1736] Cleanup JBPM983Test
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java 2008-10-21 11:42:08 UTC (rev 2563)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java 2008-10-21 11:58:14 UTC (rev 2564)
@@ -113,73 +113,45 @@
public void testConcurrentJobs() throws Exception
{
- if (true)
- {
- System.out.println("FIXME [JBPM-1736]: Cleanup JBPM983Test");
- return;
- }
-
assertTrue(getJbpmConfiguration().getJobExecutor().getNbrOfThreads() > 1);
- log.info("### TEST: deploy + start processes ###");
-
ProcessDefinition subProcessDefinition = ProcessDefinition.parseXmlString(SUBPROCESS_XML);
+ jbpmContext.deployProcessDefinition(subProcessDefinition);
+
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(PROCESS_XML);
+ jbpmContext.deployProcessDefinition(processDefinition);
- JbpmContext jbpmContext = getJbpmConfiguration().createJbpmContext();
- try
- {
- jbpmContext.deployProcessDefinition(subProcessDefinition);
- jbpmContext.deployProcessDefinition(processDefinition);
- }
- finally
- {
- jbpmContext.close();
- }
+ newTransaction();
+
+ try {
+ // create test properties
+ Map testVariables = new HashMap();
+ testVariables.put("test", "true");
- // create test properties
- Map testVariables = new HashMap();
- testVariables.put("test", "true");
-
- final int processCount = 10;
- long[] piIds = new long[processCount];
- for (int i = 0; i < processCount; i++)
- {
- log.info("#################### TEST: starting process " + i + " ####################");
-
- jbpmContext = getJbpmConfiguration().createJbpmContext();
- try
+ final int processCount = 10;
+ long[] piIds = new long[processCount];
+ for (int i = 0; i < processCount; i++)
{
ProcessInstance pi = jbpmContext.newProcessInstanceForUpdate("superprocess");
pi.getContextInstance().addVariables(testVariables);
pi.signal();
piIds[i] = pi.getId();
+
+ newTransaction();
}
- finally
- {
- jbpmContext.close();
- }
- }
- for (int i = 0; i < processCount; i++)
- {
- log.info("### TEST: wait for process completion ###");
-
- long piId = piIds[i];
- waitFor(piId);
-
- jbpmContext = getJbpmConfiguration().createJbpmContext();
- try
+ for (int i = 0; i < processCount; i++)
{
+ long piId = piIds[i];
+ waitFor(piId);
+
ProcessInstance pi = jbpmContext.loadProcessInstance(piId);
assertEquals("end-state-success", pi.getRootToken().getNode().getName());
}
- finally
- {
- jbpmContext.close();
- }
-
- log.info("#################### TEST: finished ####################");
+ } finally {
+ newTransaction();
+ graphSession.deleteProcessDefinition(processDefinition);
+ graphSession.deleteProcessDefinition(subProcessDefinition);
}
}
@@ -187,8 +159,10 @@
{
final int endTimeout = 30;
long startTime = System.currentTimeMillis();
+
+ boolean processInstanceHasEnded = false;
- while (true)
+ while (! processInstanceHasEnded)
{
if (System.currentTimeMillis() - startTime > endTimeout * 1000)
{
@@ -196,27 +170,19 @@
return;
}
+ newTransaction();
+
+ processInstanceHasEnded = jbpmContext.loadProcessInstance(piId).hasEnded();
+
log.info("waiting for workflow completion....");
try
{
- Thread.sleep(1000);
+ Thread.sleep(200);
}
catch (InterruptedException e)
{
log.error("wait for workflow was interruputed", e);
- fail();
}
-
- JbpmContext jbpmContext = getJbpmConfiguration().createJbpmContext();
- try
- {
- if (jbpmContext.loadProcessInstance(piId).hasEnded())
- break;
- }
- finally
- {
- jbpmContext.close();
- }
}
}
17 years, 6 months
JBoss JBPM SVN: r2563 - in jbpm3/trunk/modules/core/src: main/java/org/jbpm/logging/log and 5 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-21 07:42:08 -0400 (Tue, 21 Oct 2008)
New Revision: 2563
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/GraphSession.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/JbpmSchema.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/logging/log/ProcessLog.java
jbpm3/trunk/modules/core/src/main/resources/hibernate.common.xml
jbpm3/trunk/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
jbpm3/trunk/modules/core/src/main/resources/org/jbpm/graph/log/ActionLog.hbm.xml
jbpm3/trunk/modules/core/src/main/resources/org/jbpm/graph/log/SignalLog.hbm.xml
jbpm3/trunk/modules/core/src/main/resources/org/jbpm/graph/log/TransitionLog.hbm.xml
jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/node/ProcessStateDbTest.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1452/JBPM1452Test.java
Log:
[JBPM-1735] Cleanup ProcessStateDbTest
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java 2008-10-21 08:46:20 UTC (rev 2562)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java 2008-10-21 11:42:08 UTC (rev 2563)
@@ -21,12 +21,16 @@
*/
package org.jbpm.db;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
+import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.jbpm.AbstractJbpmTestCase;
import org.jbpm.JbpmConfiguration;
@@ -37,13 +41,15 @@
import org.jbpm.job.Job;
import org.jbpm.job.executor.JobExecutor;
import org.jbpm.logging.log.ProcessLog;
+import org.jbpm.persistence.db.DbPersistenceService;
+import org.jbpm.persistence.db.DbPersistenceServiceFactory;
import org.jbpm.taskmgmt.exe.TaskInstance;
public abstract class AbstractDbTestCase extends AbstractJbpmTestCase
{
private static Log log = LogFactory.getLog(AbstractDbTestCase.class);
- private JbpmConfiguration jbpmConfiguration;
+ protected JbpmConfiguration jbpmConfiguration;
protected JbpmContext jbpmContext;
protected SchemaExport schemaExport;
@@ -68,55 +74,37 @@
{
resetMembers();
closeJbpmContext();
+ ensureCleanDatabase();
- if (hasLeftOverRecords())
- {
- dropSchema();
- // Failing here, will probably hide a potential previous failure.
- // Is there a better way to fail without hiding a potential cause?
- fail("Test failed to cleanup database records");
- }
-
super.tearDown();
}
- private boolean hasLeftOverRecords()
+ private void ensureCleanDatabase()
{
- boolean foundLeftOvers = false;
- JbpmContext jbpmContext = getJbpmConfiguration().createJbpmContext();
- Session session = jbpmContext.getSession();
- try
- {
- if (session.createQuery("from " + ProcessDefinition.class.getName()).list().size() > 0)
- {
- System.err.println("FIXME: left over ProcessDefinition after: " + getShortName());
- foundLeftOvers = true;
+ boolean hasLeftOvers = false;
+
+ DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) getJbpmConfiguration().getServiceFactory("persistence");
+ Configuration configuration = dbPersistenceServiceFactory.getConfiguration();
+ JbpmSchema jbpmSchema = new JbpmSchema(configuration);
+
+ Map jbpmTablesRecordCount = jbpmSchema.getJbpmTablesRecordCount();
+ Iterator iter = jbpmTablesRecordCount.entrySet().iterator();
+ while (iter.hasNext()) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ String tableName = (String) entry.getKey();
+ Integer count = (Integer) entry.getValue();
+
+ if ( (count==null)
+ || (count != 0)
+ ) {
+ hasLeftOvers = true;
+ System.err.println("FIXME: "+getClass().getName()+"."+getName()+" left "+count+" records in " + tableName);
}
- if (session.createQuery("from " + ProcessInstance.class.getName()).list().size() > 0)
- {
- System.err.println("FIXME: left over ProcessInstance after: " + getShortName());
- foundLeftOvers = true;
- }
- if (session.createQuery("from " + ProcessLog.class.getName()).list().size() > 0)
- {
- System.err.println("FIXME: left over ProcessLog after: " + getShortName());
- foundLeftOvers = true;
- }
- if (session.createQuery("from " + Token.class.getName()).list().size() > 0)
- {
- System.err.println("FIXME: left over Token after: " + getShortName());
- foundLeftOvers = true;
- }
}
- catch (Exception ex)
- {
- System.err.println("FIXME: cannot query left overs: " + ex);
+
+ if (hasLeftOvers) {
+ jbpmSchema.cleanSchema();
}
- finally
- {
- jbpmContext.close();
- }
- return foundLeftOvers;
}
public void beginSessionTransaction()
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/GraphSession.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/GraphSession.java 2008-10-21 08:46:20 UTC (rev 2562)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/GraphSession.java 2008-10-21 11:42:08 UTC (rev 2563)
@@ -29,6 +29,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.Query;
@@ -38,6 +39,7 @@
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
import org.jbpm.graph.node.ProcessState;
+import org.jbpm.logging.log.ProcessLog;
/**
* are the graph related database operations.
@@ -226,12 +228,10 @@
if (processDefinition==null) throw new JbpmException("processDefinition is null in JbpmSession.deleteProcessDefinition()");
try {
// delete all the process instances of this definition
- List processInstances = findProcessInstances(processDefinition.getId());
- if (processInstances!=null) {
- Iterator iter = processInstances.iterator();
- while (iter.hasNext()) {
- deleteProcessInstance((ProcessInstance) iter.next());
- }
+ ProcessInstance processInstance = findNextProcessInstance(processDefinition.getId());
+ while (processInstance!=null) {
+ deleteProcessInstance(processInstance);
+ processInstance = findNextProcessInstance(processDefinition.getId());
}
List referencingProcessStates = findReferencingProcessStates(processDefinition);
@@ -251,6 +251,13 @@
}
}
+ protected ProcessInstance findNextProcessInstance(long processDefinitionId) {
+ Query query = session.getNamedQuery("GraphSession.findAllProcessInstancesForADefinition");
+ query.setLong("processDefinitionId", processDefinitionId);
+ query.setMaxResults(1);
+ return (ProcessInstance) query.uniqueResult();
+ }
+
protected List findReferencingProcessStates(ProcessDefinition subProcessDefinition) {
Query query = session.getNamedQuery("GraphSession.findReferencingProcessStates");
query.setEntity("subProcessDefinition", subProcessDefinition);
@@ -379,52 +386,51 @@
public void deleteProcessInstance(ProcessInstance processInstance, boolean includeTasks, boolean includeJobs) {
if (processInstance==null) throw new JbpmException("processInstance is null in JbpmSession.deleteProcessInstance()");
+ log.debug("deleting process instance "+processInstance.getId());
+
try {
- // find the tokens
- Query query = session.getNamedQuery("GraphSession.findTokensForProcessInstance");
- query.setEntity("processInstance", processInstance);
- List tokens = query.list();
-
- if (!tokens.isEmpty()) {
- // deleteSubProcesses
- Iterator iter = tokens.iterator();
- while (iter.hasNext()) {
- Token token = (Token) iter.next();
- deleteSubProcesses(token);
- }
- }
-
// jobs
if (includeJobs) {
- query = session.getNamedQuery("GraphSession.deleteJobsForProcessInstance");
+ log.debug("deleting jobs for process instance "+processInstance.getId());
+ Query query = session.getNamedQuery("GraphSession.deleteJobsForProcessInstance");
query.setEntity("processInstance", processInstance);
query.executeUpdate();
}
// tasks
if (includeTasks) {
- query = session.getNamedQuery("GraphSession.findTaskInstanceIdsForProcessInstance");
+ Query query = session.getNamedQuery("GraphSession.findTaskInstanceIdsForProcessInstance");
query.setEntity("processInstance", processInstance);
List taskInstanceIds = query.list();
- query = session.getNamedQuery("GraphSession.deleteTaskInstancesById");
- query.setParameterList("taskInstanceIds", taskInstanceIds);
- }
-
- if (!tokens.isEmpty()) {
- // delete the logs for all the process instance's tokens
- query = session.getNamedQuery("GraphSession.selectLogsForTokens");
- query.setParameterList("tokens", tokens);
- List logs = query.list();
- Iterator iter = logs.iterator();
- while (iter.hasNext()) {
- session.delete(iter.next());
+ if ( (taskInstanceIds!=null)
+ && (!taskInstanceIds.isEmpty())
+ ) {
+ log.debug("deleting tasks "+taskInstanceIds+" for process instance "+processInstance.getId());
+ query = session.getNamedQuery("GraphSession.deleteTaskInstancesById");
+ query.setParameterList("taskInstanceIds", taskInstanceIds);
}
}
- // then delete the process instance
+ // delete the logs
+ log.debug("deleting logs for process instance "+processInstance.getId());
+ deleteLogs(processInstance);
+
+ // delete the tokens and subprocess instances
+ log.debug("deleting subprocesses for process instance "+processInstance.getId());
+ deleteSubProcesses(processInstance.getRootToken());
+
+ // null out the parent process token
+ Token superProcessToken = processInstance.getSuperProcessToken();
+ if (superProcessToken!=null) {
+ log.debug("nulling property subProcessInstance in superProcessToken "+superProcessToken.getId()+" which is referencing the process instance "+processInstance.getId()+" which is being deleted");
+ superProcessToken.setSubProcessInstance(null);
+ }
+
+ // add the process instance
+ log.debug("hibernate session delete for process instance "+processInstance.getId());
session.delete(processInstance);
-
+
} catch (Exception e) {
log.error(e);
jbpmSession.handleException();
@@ -432,33 +438,40 @@
}
}
- void deleteSubProcesses(Token token) {
- Query query = session.getNamedQuery("GraphSession.findSubProcessInstances");
- query.setEntity("processInstance", token.getProcessInstance());
- List processInstances = query.list();
-
- if (processInstances == null || processInstances.isEmpty()) {
- return;
- }
-
- Iterator iter = processInstances.iterator();
+ void deleteLogs(ProcessInstance processInstance) {
+ Query query = session.getNamedQuery("GraphSession.findLogsForProcessInstance");
+ query.setEntity("processInstance", processInstance);
+ List logs = query.list();
+ Iterator iter = logs.iterator();
while (iter.hasNext()) {
- ProcessInstance subProcessInstance = (ProcessInstance) iter.next();
- subProcessInstance.setSuperProcessToken(null);
- token.setSubProcessInstance(null);
- deleteProcessInstance(subProcessInstance);
- session.flush();
+ ProcessLog processLog = (ProcessLog) iter.next();
+ session.delete(processLog);
}
-
- if (token.getChildren()!=null) {
- iter = token.getChildren().values().iterator();
+ }
+
+ void deleteSubProcesses(Token token) {
+ if (token!=null) {
+ Query query = session.getNamedQuery("GraphSession.findSubProcessInstances");
+ query.setEntity("processInstance", token.getProcessInstance());
+ List processInstances = query.list();
+
+ if (processInstances == null || processInstances.isEmpty()) {
+ log.debug("no subprocesses to delete for token "+token.getId());
+ return;
+ }
+
+ Iterator iter = processInstances.iterator();
while (iter.hasNext()) {
- Token child = (Token) iter.next();
- deleteSubProcesses(child);
+ ProcessInstance subProcessInstance = (ProcessInstance) iter.next();
+ subProcessInstance.setSuperProcessToken(null);
+ token.setSubProcessInstance(null);
+ log.debug("deleting sub process "+subProcessInstance.getId());
+ deleteProcessInstance(subProcessInstance);
}
}
}
+
public static class AverageNodeTimeEntry {
private long nodeId;
private String nodeName;
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/JbpmSchema.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/JbpmSchema.java 2008-10-21 08:46:20 UTC (rev 2562)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/JbpmSchema.java 2008-10-21 11:42:08 UTC (rev 2563)
@@ -35,8 +35,10 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import org.apache.commons.logging.Log;
@@ -115,6 +117,8 @@
{
if (cleanSql == null)
{
+ new SchemaExport(configuration);
+
String catalog = properties.getProperty(Environment.DEFAULT_CATALOG);
String schema = properties.getProperty(Environment.DEFAULT_SCHEMA);
@@ -132,25 +136,16 @@
{
ForeignKey fk = (ForeignKey)subIter.next();
- // Prevent NPE in ForeignKey.isPhysicalConstraint
- // http://opensource.atlassian.com/projects/hibernate/browse/HHH-3479
- if (fk.getReferencedTable() != null)
+ if (fk.isPhysicalConstraint())
{
- if (fk.isPhysicalConstraint())
- {
- // collect the drop foreign key constraint sql
- String sqlDropString = fk.sqlDropString(dialect, catalog, schema);
- dropForeignKeysSql.add(sqlDropString);
+ // collect the drop foreign key constraint sql
+ String sqlDropString = fk.sqlDropString(dialect, catalog, schema);
+ dropForeignKeysSql.add(sqlDropString);
- // and collect the create foreign key constraint sql
- String sqlCreateString = fk.sqlCreateString(dialect, mapping, catalog, schema);
- createForeignKeysSql.add(sqlCreateString);
- }
+ // and collect the create foreign key constraint sql
+ String sqlCreateString = fk.sqlCreateString(dialect, mapping, catalog, schema);
+ createForeignKeysSql.add(sqlCreateString);
}
- else
- {
- System.out.println("NoReferencedTable: " + fk);
- }
}
}
}
@@ -210,7 +205,41 @@
}
return jbpmTableNames;
}
+
+ public Map getJbpmTablesRecordCount() {
+ Map recordCounts = new HashMap();
+
+ String sql = null;
+
+ try
+ {
+ Iterator iter = getJbpmTables().iterator();
+ createConnection();
+ while (iter.hasNext()) {
+ statement = connection.createStatement();
+ String tableName = (String) iter.next();
+ sql = "SELECT COUNT(*) FROM "+tableName;
+ ResultSet resultSet = statement.executeQuery(sql);
+ resultSet.next();
+ int count = resultSet.getInt(1);
+ resultSet.close();
+ statement.close();
+ recordCounts.put(tableName, count);
+ }
+ }
+ catch (SQLException e)
+ {
+ throw new JbpmException("couldn't execute sql '" + sql + "'", e);
+ }
+ finally
+ {
+ closeConnection();
+ }
+
+ return recordCounts;
+ }
+
public void dropSchema()
{
execute(getDropSql());
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/logging/log/ProcessLog.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/logging/log/ProcessLog.java 2008-10-21 08:46:20 UTC (rev 2562)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/logging/log/ProcessLog.java 2008-10-21 11:42:08 UTC (rev 2563)
@@ -82,4 +82,7 @@
public int getIndex() {
return index;
}
+ public List getChildren() {
+ return null;
+ }
}
Modified: jbpm3/trunk/modules/core/src/main/resources/hibernate.common.xml
===================================================================
--- jbpm3/trunk/modules/core/src/main/resources/hibernate.common.xml 2008-10-21 08:46:20 UTC (rev 2562)
+++ jbpm3/trunk/modules/core/src/main/resources/hibernate.common.xml 2008-10-21 11:42:08 UTC (rev 2563)
@@ -25,7 +25,7 @@
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<!-- logging properties -->
- <property name="hibernate.format_sql">true</property>
+ <property name="hibernate.format_sql">false</property>
<property name="hibernate.use_sql_comments">true</property>
<!-- ############################################ -->
Modified: jbpm3/trunk/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
===================================================================
--- jbpm3/trunk/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2008-10-21 08:46:20 UTC (rev 2562)
+++ jbpm3/trunk/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2008-10-21 11:42:08 UTC (rev 2563)
@@ -133,14 +133,6 @@
]]>
</query>
- <query name="GraphSession.findTokensForProcessInstance">
- <![CDATA[
- select token
- from org.jbpm.graph.exe.Token token
- where token.processInstance = :processInstance
- ]]>
- </query>
-
<query name="GraphSession.findTokensForProcessInNode">
<![CDATA[
select token
@@ -158,15 +150,16 @@
and processInstance.key = :key
]]>
</query>
-
- <query name="GraphSession.selectLogsForTokens">
+
+ <query name="GraphSession.findLogsForProcessInstance">
<![CDATA[
select pl
from org.jbpm.logging.log.ProcessLog as pl
- where pl.token in (:tokens)
+ where pl.token.processInstance = :processInstance
]]>
</query>
+
<query name="GraphSession.findTaskInstanceIdsForProcessInstance">
<![CDATA[
select t
Modified: jbpm3/trunk/modules/core/src/main/resources/org/jbpm/graph/log/ActionLog.hbm.xml
===================================================================
--- jbpm3/trunk/modules/core/src/main/resources/org/jbpm/graph/log/ActionLog.hbm.xml 2008-10-21 08:46:20 UTC (rev 2562)
+++ jbpm3/trunk/modules/core/src/main/resources/org/jbpm/graph/log/ActionLog.hbm.xml 2008-10-21 11:42:08 UTC (rev 2563)
@@ -7,7 +7,7 @@
<hibernate-mapping auto-import="false" default-access="field">
<subclass name="org.jbpm.graph.log.ActionLog"
- extends="org.jbpm.logging.log.ProcessLog"
+ extends="org.jbpm.logging.log.CompositeLog"
discriminator-value="A">
<property name="exception" column="EXCEPTION_" type="text"/>
Modified: jbpm3/trunk/modules/core/src/main/resources/org/jbpm/graph/log/SignalLog.hbm.xml
===================================================================
--- jbpm3/trunk/modules/core/src/main/resources/org/jbpm/graph/log/SignalLog.hbm.xml 2008-10-21 08:46:20 UTC (rev 2562)
+++ jbpm3/trunk/modules/core/src/main/resources/org/jbpm/graph/log/SignalLog.hbm.xml 2008-10-21 11:42:08 UTC (rev 2563)
@@ -7,7 +7,7 @@
<hibernate-mapping auto-import="false" default-access="field">
<subclass name="org.jbpm.graph.log.SignalLog"
- extends="org.jbpm.logging.log.ProcessLog"
+ extends="org.jbpm.logging.log.CompositeLog"
discriminator-value="S">
<many-to-one name="transition" column="TRANSITION_" class="org.jbpm.graph.def.Transition" foreign-key="FK_LOG_TRANSITION" />
</subclass>
Modified: jbpm3/trunk/modules/core/src/main/resources/org/jbpm/graph/log/TransitionLog.hbm.xml
===================================================================
--- jbpm3/trunk/modules/core/src/main/resources/org/jbpm/graph/log/TransitionLog.hbm.xml 2008-10-21 08:46:20 UTC (rev 2562)
+++ jbpm3/trunk/modules/core/src/main/resources/org/jbpm/graph/log/TransitionLog.hbm.xml 2008-10-21 11:42:08 UTC (rev 2563)
@@ -7,7 +7,7 @@
<hibernate-mapping auto-import="false" default-access="field">
<subclass name="org.jbpm.graph.log.TransitionLog"
- extends="org.jbpm.logging.log.ProcessLog"
+ extends="org.jbpm.logging.log.CompositeLog"
discriminator-value="T">
<many-to-one name="transition"
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/node/ProcessStateDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/node/ProcessStateDbTest.java 2008-10-21 08:46:20 UTC (rev 2562)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/node/ProcessStateDbTest.java 2008-10-21 11:42:08 UTC (rev 2563)
@@ -54,6 +54,74 @@
}
}
+ public void testRecursiveProcessDefinition()
+ {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
+ "<process-definition name='recursive process'>" +
+ " <start-state>" +
+ " <transition to='first wait' />" +
+ " </start-state>" +
+ " <state name='first wait'>" +
+ " <transition to='subprocessnode' />" +
+ " <transition name='done' to='end' />" +
+ " </state>" +
+ " <process-state name='subprocessnode'>" +
+ " <sub-process name='recursive process' />" +
+ " <transition to='end' />" +
+ " </process-state>" +
+ " <end-state name='end' />" +
+ "</process-definition>"
+ );
+
+ processDefinition = saveAndReload(processDefinition);
+ try
+ {
+ ProcessInstance superProcessInstance = processDefinition.createProcessInstance();
+ superProcessInstance.signal();
+ superProcessInstance.signal();
+
+ superProcessInstance = saveAndReload(superProcessInstance);
+
+ Token superToken = superProcessInstance.getRootToken();
+ assertEquals("subprocessnode", superToken.getNode().getName());
+
+ ProcessInstance subProcessInstance = superToken.getSubProcessInstance();
+ assertNotNull(subProcessInstance);
+ assertEquals("recursive process", subProcessInstance.getProcessDefinition().getName());
+ Token subToken = subProcessInstance.getRootToken();
+
+ assertEquals("first wait", subToken.getNode().getName());
+
+ subProcessInstance.signal("done");
+
+ subProcessInstance = saveAndReload(subProcessInstance);
+ superProcessInstance = graphSession.loadProcessInstance(superProcessInstance.getId());
+
+ assertTrue(subProcessInstance.hasEnded());
+ assertTrue(superProcessInstance.hasEnded());
+
+ }
+ finally
+ {
+ newTransaction();
+ try {
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+ } catch (RuntimeException e) {
+ e.printStackTrace();
+ } finally {
+ newTransaction();
+ }
+ }
+ }
+
+ public void testMultipleRecursiveProcessDefinitions() {
+ for (int i=0; i<30; i++) {
+ testRecursiveProcessDefinition();
+ newTransaction();
+ }
+ }
+
+
public void testProcessStateSubProcessDefinition()
{
// create the subprocess
@@ -108,6 +176,41 @@
}
}
+ public void testSubProcessBindingWithLatestVersion()
+ {
+ jbpmContext.deployProcessDefinition(new ProcessDefinition("the multiversion subprocess"));
+ jbpmContext.deployProcessDefinition(new ProcessDefinition("the multiversion subprocess"));
+ jbpmContext.deployProcessDefinition(new ProcessDefinition("the multiversion subprocess"));
+
+ newTransaction();
+
+ ProcessDefinition processDefinitionTwo = ProcessDefinition.parseXmlString(
+ "<process-definition>" +
+ " <process-state name='the sub process state'>" +
+ " <sub-process name='the multiversion subprocess'/>" +
+ " </process-state>" +
+ "</process-definition>"
+ );
+ processDefinitionTwo = saveAndReload(processDefinitionTwo);
+ try
+ {
+ ProcessState processState = (ProcessState) processDefinitionTwo.getNode("the sub process state");
+ assertEquals("the multiversion subprocess", processState.getSubProcessDefinition().getName() );
+ assertEquals(3, processState.getSubProcessDefinition().getVersion() );
+ }
+ finally
+ {
+ newTransaction();
+ ProcessDefinition processDefinition = graphSession.findProcessDefinition("the multiversion subprocess", 1);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ processDefinition = graphSession.findProcessDefinition("the multiversion subprocess", 2);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ processDefinition = graphSession.findProcessDefinition("the multiversion subprocess", 3);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ graphSession.deleteProcessDefinition(processDefinitionTwo.getId());
+ }
+ }
+
public void testAverageSubProcess()
{
ProcessDefinition subProcessDefinition = ProcessDefinition.parseXmlString(
@@ -223,91 +326,6 @@
}
}
- public void testSubProcessBindingWithLatestVersion()
- {
- ProcessDefinition processDefinitionOne = new ProcessDefinition("the multiversion subprocess");
- jbpmContext.deployProcessDefinition(processDefinitionOne);
- jbpmContext.deployProcessDefinition(processDefinitionOne);
- jbpmContext.deployProcessDefinition(processDefinitionOne);
-
- newTransaction();
-
- ProcessDefinition processDefinitionTwo = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <process-state name='the sub process state'>" +
- " <sub-process name='the multiversion subprocess'/>" +
- " </process-state>" +
- "</process-definition>"
- );
- processDefinitionTwo = saveAndReload(processDefinitionTwo);
- try
- {
- ProcessState processState = (ProcessState) processDefinitionTwo.getNode("the sub process state");
- assertEquals("the multiversion subprocess", processState.getSubProcessDefinition().getName() );
- assertEquals(3, processState.getSubProcessDefinition().getVersion() );
- }
- finally
- {
- newTransaction();
- jbpmContext.getGraphSession().deleteProcessDefinition(processDefinitionOne.getId());
- jbpmContext.getGraphSession().deleteProcessDefinition(processDefinitionTwo.getId());
- }
- }
-
- public void testRecursiveProcessDefinition()
- {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition name='recursive process'>" +
- " <start-state>" +
- " <transition to='first wait' />" +
- " </start-state>" +
- " <state name='first wait'>" +
- " <transition to='subprocessnode' />" +
- " <transition name='done' to='end' />" +
- " </state>" +
- " <process-state name='subprocessnode'>" +
- " <sub-process name='recursive process' />" +
- " <transition to='end' />" +
- " </process-state>" +
- " <end-state name='end' />" +
- "</process-definition>"
- );
-
- processDefinition = saveAndReload(processDefinition);
- try
- {
- ProcessInstance superProcessInstance = new ProcessInstance(processDefinition);
- superProcessInstance.signal();
- superProcessInstance.signal();
-
- superProcessInstance = saveAndReload(superProcessInstance);
-
- Token superToken = superProcessInstance.getRootToken();
- assertEquals("subprocessnode", superToken.getNode().getName());
-
- ProcessInstance subProcessInstance = superToken.getSubProcessInstance();
- assertNotNull(subProcessInstance);
- assertEquals("recursive process", subProcessInstance.getProcessDefinition().getName());
- Token subToken = subProcessInstance.getRootToken();
-
- assertEquals("first wait", subToken.getNode().getName());
-
- subProcessInstance.signal("done");
-
- subProcessInstance = saveAndReload(subProcessInstance);
- superProcessInstance = graphSession.loadProcessInstance(superProcessInstance.getId());
-
- assertTrue(subProcessInstance.hasEnded());
- assertTrue(superProcessInstance.hasEnded());
-
- }
- finally
- {
- newTransaction();
- jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
- }
- }
-
public void testSubProcessLogs() {
ProcessDefinition subProcessDefinition = ProcessDefinition.parseXmlString(
"<process-definition name='subprocess'>" +
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1452/JBPM1452Test.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1452/JBPM1452Test.java 2008-10-21 08:46:20 UTC (rev 2562)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1452/JBPM1452Test.java 2008-10-21 11:42:08 UTC (rev 2563)
@@ -36,13 +36,23 @@
*/
public class JBPM1452Test extends AbstractDbTestCase
{
- @Override
+
+ static{
+ // making sure System.err and System.out are synchronized
+ System.setErr(System.out);
+ }
+
+@Override
protected JbpmConfiguration getJbpmConfiguration()
{
- return JbpmConfiguration.parseXmlString(
- "<jbpm-configuration>" +
- " <null name='jbpm.job.executor' />" +
- "</jbpm-configuration>");
+ if (jbpmConfiguration == null)
+ {
+ jbpmConfiguration = JbpmConfiguration.parseXmlString(
+ "<jbpm-configuration>" +
+ " <null name='jbpm.job.executor' />" +
+ "</jbpm-configuration>");
+ }
+ return jbpmConfiguration;
}
public void testNoJobExecutor()
@@ -52,8 +62,15 @@
assertTrue("expected object factory to have object jbpm.job.executor", objectFactory.hasObject("jbpm.job.executor"));
assertNull(objectFactory.createObject("jbpm.job.executor"));
// start and end a process instance, no exception should be thrown
- jbpmContext.deployProcessDefinition(new ProcessDefinition("Audit"));
- ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("Audit");
- processInstance.end();
+ ProcessDefinition processDefinition = new ProcessDefinition("Audit");
+ jbpmContext.deployProcessDefinition(processDefinition);
+ try {
+ jbpmContext.newProcessInstanceForUpdate("Audit");
+ } catch(Throwable t) {
+ t.printStackTrace();
+ } finally {
+ newTransaction();
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ }
}
}
17 years, 6 months
JBoss JBPM SVN: r2562 - in jbpm3/branches/tbaeyens/modules/core/src: test/java/org/jbpm/graph/node and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-21 04:46:20 -0400 (Tue, 21 Oct 2008)
New Revision: 2562
Modified:
jbpm3/branches/tbaeyens/modules/core/src/main/java/org/jbpm/db/GraphSession.java
jbpm3/branches/tbaeyens/modules/core/src/test/java/org/jbpm/graph/node/ProcessStateDbTest.java
Log:
final delete process instance fix
Modified: jbpm3/branches/tbaeyens/modules/core/src/main/java/org/jbpm/db/GraphSession.java
===================================================================
--- jbpm3/branches/tbaeyens/modules/core/src/main/java/org/jbpm/db/GraphSession.java 2008-10-20 15:16:51 UTC (rev 2561)
+++ jbpm3/branches/tbaeyens/modules/core/src/main/java/org/jbpm/db/GraphSession.java 2008-10-21 08:46:20 UTC (rev 2562)
@@ -228,12 +228,10 @@
if (processDefinition==null) throw new JbpmException("processDefinition is null in JbpmSession.deleteProcessDefinition()");
try {
// delete all the process instances of this definition
- List processInstances = findProcessInstances(processDefinition.getId());
- if (processInstances!=null) {
- Iterator iter = processInstances.iterator();
- while (iter.hasNext()) {
- deleteProcessInstance((ProcessInstance) iter.next());
- }
+ ProcessInstance processInstance = findNextProcessInstance(processDefinition.getId());
+ while (processInstance!=null) {
+ deleteProcessInstance(processInstance);
+ processInstance = findNextProcessInstance(processDefinition.getId());
}
List referencingProcessStates = findReferencingProcessStates(processDefinition);
@@ -253,6 +251,13 @@
}
}
+ protected ProcessInstance findNextProcessInstance(long processDefinitionId) {
+ Query query = session.getNamedQuery("GraphSession.findAllProcessInstancesForADefinition");
+ query.setLong("processDefinitionId", processDefinitionId);
+ query.setMaxResults(1);
+ return (ProcessInstance) query.uniqueResult();
+ }
+
protected List findReferencingProcessStates(ProcessDefinition subProcessDefinition) {
Query query = session.getNamedQuery("GraphSession.findReferencingProcessStates");
query.setEntity("subProcessDefinition", subProcessDefinition);
@@ -382,7 +387,7 @@
public void deleteProcessInstance(ProcessInstance processInstance, boolean includeTasks, boolean includeJobs) {
if (processInstance==null) throw new JbpmException("processInstance is null in JbpmSession.deleteProcessInstance()");
log.debug("deleting process instance "+processInstance.getId());
- session.flush();
+
try {
// jobs
if (includeJobs) {
@@ -390,7 +395,6 @@
Query query = session.getNamedQuery("GraphSession.deleteJobsForProcessInstance");
query.setEntity("processInstance", processInstance);
query.executeUpdate();
- session.flush();
}
// tasks
@@ -406,19 +410,26 @@
query = session.getNamedQuery("GraphSession.deleteTaskInstancesById");
query.setParameterList("taskInstanceIds", taskInstanceIds);
}
- session.flush();
}
// delete the logs
+ log.debug("deleting logs for process instance "+processInstance.getId());
deleteLogs(processInstance);
// delete the tokens and subprocess instances
+ log.debug("deleting subprocesses for process instance "+processInstance.getId());
deleteSubProcesses(processInstance.getRootToken());
+ // null out the parent process token
+ Token superProcessToken = processInstance.getSuperProcessToken();
+ if (superProcessToken!=null) {
+ log.debug("nulling property subProcessInstance in superProcessToken "+superProcessToken.getId()+" which is referencing the process instance "+processInstance.getId()+" which is being deleted");
+ superProcessToken.setSubProcessInstance(null);
+ }
+
// add the process instance
- log.debug("deleting process instance "+processInstance.getId());
+ log.debug("hibernate session delete for process instance "+processInstance.getId());
session.delete(processInstance);
- session.flush();
} catch (Exception e) {
log.error(e);
Modified: jbpm3/branches/tbaeyens/modules/core/src/test/java/org/jbpm/graph/node/ProcessStateDbTest.java
===================================================================
--- jbpm3/branches/tbaeyens/modules/core/src/test/java/org/jbpm/graph/node/ProcessStateDbTest.java 2008-10-20 15:16:51 UTC (rev 2561)
+++ jbpm3/branches/tbaeyens/modules/core/src/test/java/org/jbpm/graph/node/ProcessStateDbTest.java 2008-10-21 08:46:20 UTC (rev 2562)
@@ -119,8 +119,9 @@
}
public void testMultipleRecursiveProcessDefinitions() {
- for (int i=0; i<20; i++) {
+ for (int i=0; i<30; i++) {
testRecursiveProcessDefinition();
+ newTransaction();
}
}
17 years, 6 months
JBoss JBPM SVN: r2561 - jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-10-20 11:16:51 -0400 (Mon, 20 Oct 2008)
New Revision: 2561
Modified:
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
Log:
Upload form validation
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java 2008-10-20 14:35:06 UTC (rev 2560)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java 2008-10-20 15:16:51 UTC (rev 2561)
@@ -24,10 +24,7 @@
import com.google.gwt.user.client.ui.HTML;
import com.gwtext.client.core.Connection;
import com.gwtext.client.core.EventObject;
-import com.gwtext.client.widgets.Button;
-import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.Toolbar;
-import com.gwtext.client.widgets.ToolbarButton;
+import com.gwtext.client.widgets.*;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.form.Form;
import com.gwtext.client.widgets.form.FormPanel;
@@ -111,8 +108,13 @@
{
public boolean doBeforeAction(Form form)
- {
- // TODO: validation
+ {
+ if(form.findField("file").getValueAsString().equals(""))
+ {
+ MessageBox.alert("Please provide a process definition file");
+ return false;
+ }
+
return true;
}
17 years, 6 months