JBoss JBPM SVN: r5772 - jbpm4/trunk/modules/devguide/src/main/docbook/en/modules.
by do-not-reply@jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-10-22 21:59:01 -0400 (Thu, 22 Oct 2009)
New Revision: 5772
Modified:
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml
Log:
added a section about instance migration
Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml 2009-10-22 12:55:53 UTC (rev 5771)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml 2009-10-23 01:59:01 UTC (rev 5772)
@@ -691,7 +691,201 @@
</para>
</section>
</section>
+
+ <section id="instancemigration">
+ <title>Instance Migration</title>
+ <para>By default the behaviour of jBPM upon redeployment is to start new process instances with the newly deployed version.
+ Also, it is possible to start new process instances using a specified older version if needed. The existing running
+ process instances always keep running following the definition that they were started in. But what when a customer
+ or some piece of legislation mandates that this behaviour is not enough? We could e.g. think of a situation where
+ process instances do not make sense anymore when a new definition is deployed. In this case these instances should be
+ ended. In another situation it might be needed that all (or even some particular) instances are migrated and moved
+ to the newly deployed definition. jBPM contains a tool that exactly supports these use cases.</para>
+ <para>Before delving into the details of the instance migration tool, we have to warn the reader. Though we did a
+ reasonable attempt at trying to understand the different use cases, there are certainly a number of situations that
+ are not yet covered. We welcome any feedback around these use cases very eagerly.</para>
+ <para>For all the examples that follow, we will start from the same original process definition:
+ <programlisting>
+<process name="foobar">
+ <start>
+ <transition to="a"/>
+ </start>
+ <state name="a">
+ <transition to="b">
+ </state>
+ <state name="b">
+ <transition to="c"/>
+ </state>
+ <state name="c">
+ <transition to="end"/>
+ </state>
+ <end name="end"/>
+</process>
+ </programlisting>
+ </para>
+
+ <section>
+ <title>Simple Migration</title>
+ <para>The first obvious use case that we wanted to cover is where a new version of a process is deployed for
+ which one of the following statements is true:
+ <itemizedlist>
+ <listitem>the structure of the process is completely the same</listitem>
+ <listitem>only new nodes have been added but all the nodes from the previous definition still exist</listitem>
+ </itemizedlist>
+ This use case might be useful if for instance event handler names change between versions, if new processing
+ has to be inserted or if new paths of execution have to be added. Consider the following modification of the
+ above process definition to indicate that running instances have to be migrated:
+ <programlisting>
+<process name="foobar">
+ <start>
+ <transition to="a"/>
+ </start>
+ <state name="a">
+ <transition to="b">
+ </state>
+ <state name="b">
+ <transition to="c"/>
+ </state>
+ <state name="c">
+ <transition to="end"/>
+ </state>
+ <end name="end"/>
+ <migrate-instances/>
+</process>
+ </programlisting>
+ When this second process is deployed the running instances of the previous version - and only of the previous
+ version - will be migrated to the new version. We"ll explain later what to do if you want more than only the
+ instances of the previous version to be migrated. Assume that when deploying the second version there would
+ be one process instance in the state "a" and one process instance in the state "b". The following snippet
+ in a unit test would be valid:
+ <programlisting>
+ ProcessDefinition pd1 = deployProcessDefinition("foobar", originalVersion);
+ ProcessInstance pi1 = startAndSignal(pd1, "a");
+ ProcessInstance pi2 = startAndSignal(pd1, "b");
+ ProcessDefinition pd2 = deployProcessDefinition("foobar", versionWithSimpleMigration);
+ pi1 = executionService.findProcessInstanceById(pi1.getId());
+ pi2 = executionService.findProcessInstanceById(pi2.getId());
+ assertEquals(pd2.getId(), pi1.getProcessDefinitionId());
+ assertEquals(pd2.getId(), pi2.getProcessDefinitionId());
+ assertEquals(pi1, pi1.findActiveExecutionIn("a"));
+ assertEquals(pi2, pi2.findActiveExecutionIn("b"));
+ </programlisting>
+ </para>
+ </section>
+ <section>
+ <title>Ending Running Instances</title>
+ <para>The second use case is when the instances of the previous process definition have to be ended.
+ The way to indicate this would be to add the action attribute to the migrate-instances tag with the
+ value of "end".
+ <programlisting>
+<process name="foobar">
+ ...
+ <migrate-instances action="end"/>
+</process>
+ </programlisting>
+ If we take the situation from above with one process in state "a" and another in state "b"
+ the two processes would be ended as can be seen in the following snippet:
+ <programlisting>
+ ProcessDefinition pd1 = deployProcessDefinition("foobar", originalVersion);
+ ProcessInstance pi1 = startAndSignal(pd1, "a");
+ ProcessInstance pi2 = startAndSignal(pd1, "b");
+ ProcessDefinition pd2 = deployProcessDefinition("foobar", versionWithSimpleAbortion);
+ pi1 = executionService.findProcessInstanceById(pi1.getId());
+ pi2 = executionService.findProcessInstanceById(pi2.getId());
+ assertNull(pi1);
+ assertNull(pi2);
+ </programlisting>
+ </para>
+ </section>
+
+ <section>
+ <title>Version Ranges</title>
+ <para>So far I have showed you how instances of the previously deployed version - and only that one -
+ could be either migrated or ended. But what to do when you want to perform these actions on process
+ instances of other already deployed versions. This can be done by making use of the versions attribute
+ of the migrate-instances tag. This attribute lets you specify a range of versions that need to be
+ migrated (or ended). Consider the following process definition:
+ <programlisting>
+<process name="foobar">
+ <start>
+ <transition to="a"/>
+ </start>
+ <state name="a">
+ <transition to="b">
+ </state>
+ <state name="b">
+ <transition to="c"/>
+ </state>
+ <state name="c">
+ <transition to="end"/>
+ </state>
+ <end name="end"/>
+ <migrate-instances versions="2..3"/>
+</process>
+ </programlisting>
+ Imagine a situation where we would deploy the original process definition 4 times in a row and for each
+ deployment start a process instance that waits in state "a". Then we deploy the above version
+ of the process definition with instance migration. The result will be that instance 2 and instance 3
+ will be migrated while instance 1 and instance 4 will keep running following their original definition.
+ This is shown in the snippet below:
+ <programlisting>
+ ProcessDefinition pd1 = deployProcessDefinition("foobar", originalVersion);
+ ProcessInstance pi1 = startAndSignal(pd1, "a");
+ ProcessDefinition pd2 = deployProcessDefinition("foobar", originalVersion);
+ ProcessInstance pi2 = startAndSignal(pd2, "a");
+ ProcessDefinition pd3 = deployProcessDefinition("foobar", originalVersion);
+ ProcessInstance pi3 = startAndSignal(pd3, "a");
+ ProcessDefinition pd4 = deployProcessDefinition("foobar", originalVersion);
+ ProcessInstance pi4 = startAndSignal(pd4, "a");
+ ProcessDefinition pd5 = deployProcessDefinition("foobar", versionWithAbsoluteVersionRange);
+ pi1 = executionService.findProcessInstanceById(pi1.getId());
+ pi2 = executionService.findProcessInstanceById(pi2.getId());
+ pi3 = executionService.findProcessInstanceById(pi3.getId());
+ pi4 = executionService.findProcessInstanceById(pi4.getId());
+ assertEquals(pd1.getId(), pi1.getProcessDefinitionId());
+ assertEquals(pd5.getId(), pi2.getProcessDefinitionId());
+ assertEquals(pd5.getId(), pi3.getProcessDefinitionId());
+ assertEquals(pd4.getId(), pi4.getProcessDefinitionId());
+ </programlisting>
+ A number of variants exist for the versions attribute. The example above uses an absolute version range.
+ It is also possible to use an expression of the form x-n to indicate a version number relative to the
+ last deployed version. So if you want to only migrate instances from the last two versions you could
+ use the following expression for the versions attribute:
+ <programlisting>
+<process name="foobar">
+ ...
+ <migrate-instances versions="x-2..x"/>
+</process>
+ </programlisting>
+ You can also mix and match the absolute and the relative specifications. E.g. if you would like to
+ migrate all the instances of all the versions to the newly deployed version you can use the following:
+ <programlisting>
+<process name="foobar">
+ ...
+ <migrate-instances versions="1..x"/>
+</process>
+ </programlisting>
+ And for this last example you can also use the "*" wildcard notation:
+ <programlisting>
+<process name="foobar">
+ ...
+ <migrate-instances versions="*"/>
+</process>
+ </programlisting>
+ </para>
+ </section>
+
+ <section>
+ <title>Activity Mappings</title>
+ </section>
+
+ <section>
+ <title>Migration Handlers</title>
+ </section>
+
+ </section>
+
<section>
<title>User object caching</title>
<para>As indicated in section "User code" in the Users guide, instantiated user objects
16 years, 6 months
JBoss JBPM SVN: r5771 - in jbpm4/trunk/modules: examples and 5 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-10-22 08:55:53 -0400 (Thu, 22 Oct 2009)
New Revision: 5771
Added:
jbpm4/trunk/modules/examples/src/test/resources/process_forms.css
Modified:
jbpm4/trunk/modules/db/jbpm4-db.iml
jbpm4/trunk/modules/examples/jbpm4-examples.iml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/request_vacation.ftl
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/verify_request.ftl
jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/AbstractFormDispatcher.java
jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/ProcessFormDispatcher.java
jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/TaskFormDispatcher.java
jbpm4/trunk/modules/test-base/test-base.iml
jbpm4/trunk/modules/test-db/jbpm4-test-db.iml
Log:
Fix BPMC-21: CSS for task forms
Modified: jbpm4/trunk/modules/db/jbpm4-db.iml
===================================================================
--- jbpm4/trunk/modules/db/jbpm4-db.iml 2009-10-22 09:06:27 UTC (rev 5770)
+++ jbpm4/trunk/modules/db/jbpm4-db.iml 2009-10-22 12:55:53 UTC (rev 5771)
@@ -11,9 +11,8 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="pvm" />
<orderEntry type="module" module-name="toplevel" />
- <orderEntry type="module" module-name="api" />
- <orderEntry type="module" module-name="test-base" />
<orderEntry type="module" module-name="jpdl" />
+ <orderEntry type="module" module-name="test-base" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep: antlr:antlr:jar:2.7.6:compile">
<CLASSES>
Modified: jbpm4/trunk/modules/examples/jbpm4-examples.iml
===================================================================
--- jbpm4/trunk/modules/examples/jbpm4-examples.iml 2009-10-22 09:06:27 UTC (rev 5770)
+++ jbpm4/trunk/modules/examples/jbpm4-examples.iml 2009-10-22 12:55:53 UTC (rev 5771)
@@ -10,10 +10,9 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="pvm" exported="" />
- <orderEntry type="module" module-name="toplevel" />
- <orderEntry type="module" module-name="api" />
- <orderEntry type="module" module-name="test-base" />
- <orderEntry type="module" module-name="jpdl" />
+ <orderEntry type="module" module-name="toplevel" exported="" />
+ <orderEntry type="module" module-name="jpdl" exported="" />
+ <orderEntry type="module" module-name="test-base" exported="" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep: jboss:jboss-j2ee:jar:4.2.2.GA:compile">
<CLASSES>
@@ -392,39 +391,39 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module-library">
- <library name="M2 Dep: antlr:antlr:jar:2.7.6:test">
+ <orderEntry type="module-library" exported="">
+ <library name="M2 Dep: junit:junit:jar:3.8.2:runtime">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar!/" />
</CLASSES>
<JAVADOC />
- <SOURCES />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/junit/junit/3.8.2/junit-3.8.2-sources.jar!/" />
+ </SOURCES>
</library>
</orderEntry>
- <orderEntry type="module-library">
- <library name="M2 Dep: commons-collections:commons-collections:jar:3.1:test">
+ <orderEntry type="module-library" exported="">
+ <library name="M2 Dep: antlr:antlr:jar:2.7.6:runtime">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar!/" />
</CLASSES>
<JAVADOC />
- <SOURCES>
- <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1-sources.jar!/" />
- </SOURCES>
+ <SOURCES />
</library>
</orderEntry>
- <orderEntry type="module-library">
- <library name="M2 Dep: junit:junit:jar:3.8.2:runtime">
+ <orderEntry type="module-library" exported="">
+ <library name="M2 Dep: commons-collections:commons-collections:jar:3.1:runtime">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/junit/junit/3.8.2/junit-3.8.2-sources.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1-sources.jar!/" />
</SOURCES>
</library>
</orderEntry>
- <orderEntry type="module-library">
- <library name="M2 Dep: org.hibernate:hibernate-core:jar:3.3.1.GA:test">
+ <orderEntry type="module-library" exported="">
+ <library name="M2 Dep: org.hibernate:hibernate-core:jar:3.3.1.GA:runtime">
<CLASSES>
<root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/org/hibernate/hibernate-core/3.3.1.GA/hibernate-core-3.3.1.GA.jar!/" />
</CLASSES>
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/request_vacation.ftl
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/request_vacation.ftl 2009-10-22 09:06:27 UTC (rev 5770)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/request_vacation.ftl 2009-10-22 12:55:53 UTC (rev 5771)
@@ -1,4 +1,9 @@
<html>
+<head>
+ <style type="text/css">
+ ${CSS!".body {font-family:sans-serif;}"}
+ </style>
+</head>
<body>
<form action="${form.action}" method="POST" enctype="multipart/form-data">
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/verify_request.ftl
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/verify_request.ftl 2009-10-22 09:06:27 UTC (rev 5770)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/verify_request.ftl 2009-10-22 12:55:53 UTC (rev 5771)
@@ -1,4 +1,9 @@
<html>
+<head>
+ <style type="text/css">
+ ${CSS!".body {font-family:sans-serif;}"}
+ </style>
+</head>
<body>
<form action="${form.action}" method="POST" enctype="multipart/form-data">
Added: jbpm4/trunk/modules/examples/src/test/resources/process_forms.css
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/process_forms.css (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/process_forms.css 2009-10-22 12:55:53 UTC (rev 5771)
@@ -0,0 +1,5 @@
+
+body {
+ font-family:sans-serif;
+ background-color: #ffffff;
+}
\ No newline at end of file
Modified: jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/AbstractFormDispatcher.java
===================================================================
--- jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/AbstractFormDispatcher.java 2009-10-22 09:06:27 UTC (rev 5770)
+++ jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/AbstractFormDispatcher.java 2009-10-22 12:55:53 UTC (rev 5771)
@@ -21,23 +21,14 @@
*/
package org.jbpm.integration.console.forms;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
+import java.io.*;
import java.util.Map;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.naming.InitialContext;
-import org.jbpm.api.Configuration;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.*;
import freemarker.template.DefaultObjectWrapper;
import freemarker.template.Template;
@@ -54,6 +45,8 @@
// private static final Log log =
// LogFactory.getLog(AbstractFormDispatcher.class);
+ public static final String PROCESSFORMS_CSS = "process_forms.css";
+
protected final static String WEB_CONTEXT = "/gwt-console-server/rs";
protected ProcessEngine processEngine;
@@ -147,4 +140,35 @@
return merged;
}
+
+ protected String streamToString(InputStream is)
+ {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+ StringBuilder sb = new StringBuilder();
+ String line = null;
+
+ try
+ {
+ while ((line = reader.readLine()) != null)
+ {
+ sb.append(line + "\n");
+ }
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Failed to read " + PROCESSFORMS_CSS, e);
+ }
+ finally
+ {
+ try
+ {
+ is.close();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Failed to close stream " + PROCESSFORMS_CSS, e);
+ }
+ }
+ return sb.toString();
+ }
}
Modified: jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/ProcessFormDispatcher.java
===================================================================
--- jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/ProcessFormDispatcher.java 2009-10-22 09:06:27 UTC (rev 5770)
+++ jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/ProcessFormDispatcher.java 2009-10-22 12:55:53 UTC (rev 5771)
@@ -21,6 +21,12 @@
*/
package org.jbpm.integration.console.forms;
+import org.jboss.bpm.console.server.plugin.FormAuthorityRef;
+import org.jboss.bpm.console.server.plugin.FormDispatcherPlugin;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.RepositoryService;
+
+import javax.activation.DataHandler;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
@@ -28,13 +34,6 @@
import java.util.List;
import java.util.Map;
-import javax.activation.DataHandler;
-
-import org.jboss.bpm.console.server.plugin.FormAuthorityRef;
-import org.jboss.bpm.console.server.plugin.FormDispatcherPlugin;
-import org.jbpm.api.ProcessDefinition;
-import org.jbpm.api.RepositoryService;
-
/**
* Processes form data to start processes.
*
@@ -108,10 +107,25 @@
// outcome directive
renderContext.put(OUTCOME_DIRECTIVE_NAME, new OutcomeDirective());
+
+ // global css
+ InputStream css = loadCSS(procDef.getDeploymentId());
+ if(css!=null)
+ renderContext.put("CSS", streamToString(css));
result = processTemplate(startFormResourceName, template, renderContext);
}
return result;
}
+
+ private InputStream loadCSS(String deploymentId)
+ {
+ RepositoryService repoService = processEngine.getRepositoryService();
+
+ InputStream in = repoService.getResourceAsStream(
+ deploymentId, PROCESSFORMS_CSS
+ );
+ return in;
+ }
}
Modified: jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/TaskFormDispatcher.java
===================================================================
--- jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/TaskFormDispatcher.java 2009-10-22 09:06:27 UTC (rev 5770)
+++ jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/TaskFormDispatcher.java 2009-10-22 12:55:53 UTC (rev 5771)
@@ -22,6 +22,9 @@
package org.jbpm.integration.console.forms;
import java.io.InputStream;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
@@ -32,20 +35,16 @@
import org.jboss.bpm.console.server.plugin.FormAuthorityRef;
import org.jboss.bpm.console.server.plugin.FormDispatcherPlugin;
-import org.jbpm.api.Execution;
-import org.jbpm.api.ExecutionService;
-import org.jbpm.api.ProcessDefinition;
-import org.jbpm.api.RepositoryService;
-import org.jbpm.api.TaskService;
+import org.jbpm.api.*;
import org.jbpm.api.task.Task;
/**
* Processes form data to complete tasks.
- *
+ *
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
public class TaskFormDispatcher extends AbstractFormDispatcher implements FormDispatcherPlugin {
-
+
public TaskFormDispatcher() {
super();
}
@@ -78,14 +77,15 @@
TaskService taskService = processEngine.getTaskService();
ExecutionService executionService = processEngine.getExecutionService();
RepositoryService repoService = processEngine.getRepositoryService();
+
Task task = taskService.getTask(ref.getReferenceId());
String executionId = task.getExecutionId();
Execution execution = executionService.findExecutionById(executionId);
String procInstId = execution.getProcessInstance().getId();
ProcessDefinition procDef = repoService.createProcessDefinitionQuery()
- .processDefinitionId(execution.getProcessDefinitionId())
- .uniqueResult();
+ .processDefinitionId(execution.getProcessDefinitionId())
+ .uniqueResult();
// check if a template exists
String name = task.getFormResourceName();
@@ -119,10 +119,15 @@
OutcomeDirective outcomeDirective = new OutcomeDirective();
Set<String> outcomes = taskService.getOutcomes(task.getId());
for (String outcome : outcomes) {
- outcomeDirective.getValues().add(outcome);
+ outcomeDirective.getValues().add(outcome);
}
renderContext.put(OUTCOME_DIRECTIVE_NAME, outcomeDirective);
+ // global css
+ InputStream css = loadCSS(task.getExecutionId());
+ if(css!=null)
+ renderContext.put("CSS", streamToString(css));
+
// process variables
renderContext.putAll(processContext);
@@ -130,4 +135,19 @@
return result;
}
+ private InputStream loadCSS(String executionId)
+ {
+ RepositoryService repoService = processEngine.getRepositoryService();
+ ExecutionService execService = processEngine.getExecutionService();
+
+ ProcessInstance instance = execService.createProcessInstanceQuery()
+ .processInstanceId(executionId)
+ .uniqueResult();
+
+ ProcessDefinition definition = repoService.createProcessDefinitionQuery()
+ .processDefinitionId(instance.getProcessDefinitionId()).uniqueResult();
+
+ InputStream in = repoService.getResourceAsStream(definition.getDeploymentId(), PROCESSFORMS_CSS);
+ return in;
+ }
}
Modified: jbpm4/trunk/modules/test-base/test-base.iml
===================================================================
--- jbpm4/trunk/modules/test-base/test-base.iml 2009-10-22 09:06:27 UTC (rev 5770)
+++ jbpm4/trunk/modules/test-base/test-base.iml 2009-10-22 12:55:53 UTC (rev 5771)
@@ -9,7 +9,6 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="toplevel" exported="" />
- <orderEntry type="module" module-name="api" exported="" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep: dom4j:dom4j:jar:1.6.1:compile">
<CLASSES>
Modified: jbpm4/trunk/modules/test-db/jbpm4-test-db.iml
===================================================================
--- jbpm4/trunk/modules/test-db/jbpm4-test-db.iml 2009-10-22 09:06:27 UTC (rev 5770)
+++ jbpm4/trunk/modules/test-db/jbpm4-test-db.iml 2009-10-22 12:55:53 UTC (rev 5771)
@@ -11,9 +11,8 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="pvm" exported="" />
<orderEntry type="module" module-name="toplevel" />
- <orderEntry type="module" module-name="api" />
- <orderEntry type="module" module-name="test-base" />
<orderEntry type="module" module-name="jpdl" />
+ <orderEntry type="module" module-name="test-base" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep: jboss:jboss-j2ee:jar:4.2.2.GA:compile">
<CLASSES>
16 years, 6 months
JBoss JBPM SVN: r5769 - in jbpm4/trunk: modules/db/scripts and 5 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-10-22 04:49:29 -0400 (Thu, 22 Oct 2009)
New Revision: 5769
Added:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/JbpmVersion.java
jbpm4/trunk/qa/reinstall.jbpm.sh
Removed:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/
jbpm4/trunk/modules/db/src/main/resources/
jbpm4/trunk/modules/db/src/test/
Modified:
jbpm4/trunk/modules/db/.classpath
jbpm4/trunk/modules/db/pom.xml
jbpm4/trunk/modules/db/scripts/antrun-schema.xml
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
Log:
[JBPM-2509] remove old stuff, detect version 4.1, linux reinstall script
Modified: jbpm4/trunk/modules/db/.classpath
===================================================================
--- jbpm4/trunk/modules/db/.classpath 2009-10-21 17:15:41 UTC (rev 5768)
+++ jbpm4/trunk/modules/db/.classpath 2009-10-22 08:49:29 UTC (rev 5769)
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: jbpm4/trunk/modules/db/pom.xml
===================================================================
--- jbpm4/trunk/modules/db/pom.xml 2009-10-21 17:15:41 UTC (rev 5768)
+++ jbpm4/trunk/modules/db/pom.xml 2009-10-22 08:49:29 UTC (rev 5769)
@@ -28,14 +28,15 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <properties>
- <old.version>4.1</old.version>
- </properties>
-
<profiles>
<profile>
<id>upgrade</id>
+ <properties>
+ <old.version>4.1</old.version>
+ <old.scripts.directory>${project.build.directory}/create-drop-${old.version}</old.scripts.directory>
+ </properties>
+
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
@@ -55,6 +56,29 @@
<build>
<plugins>
<plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>previous-version</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-db</artifactId>
+ <version>${old.version}</version>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${old.scripts.directory}</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
@@ -65,9 +89,12 @@
</goals>
<configuration>
<tasks>
- <property name="upgrade.files.dest.dir"
- value="src/main/resources/db/upgrade-${old.version}-to-${version}" />
- <property name="database" value="${database}" />
+ <!-- keep directory properties, explicit paths are bad practice -->
+ <property name="project.output.dir" value="${project.build.outputDirectory}" />
+ <property name="old.scripts.dir" value="${old.scripts.directory}"/>
+ <!-- upgrade scripts could be written to distro directly -->
+ <property name="upgrade.scripts.dir"
+ value="${project.build.directory}/upgrade-${old.version}-to-${project.version}" />
<!-- for some reason that i don't get, the user.home must be passed explicitly -->
<property name="user.home" value="${user.home}" />
<ant antfile="scripts/antrun-schema.xml" target="schema-upgrade"
@@ -80,19 +107,6 @@
</plugins>
</build>
</profile>
-
- <profile>
- <id>no-database</id>
- <activation>
- <property>
- <name>!database</name>
- </property>
- </activation>
-
- <properties>
- <database>hsqldb</database>
- </properties>
- </profile>
</profiles>
<!-- Dependencies -->
@@ -115,7 +129,7 @@
</dependency>
</dependencies>
- <!-- build>
+ <build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
@@ -135,43 +149,7 @@
</execution>
</executions>
</plugin>
-
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>previous-version</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-db</artifactId>
- <version>${old.version}</version>
- </artifactItem>
- </artifactItems>
- <outputDirectory>target/test-classes/old-db</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemProperties>
- <property>
- <name>database</name>
- <value>${database}</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
-
</plugins>
- </build -->
+ </build>
</project>
\ No newline at end of file
Modified: jbpm4/trunk/modules/db/scripts/antrun-schema.xml
===================================================================
--- jbpm4/trunk/modules/db/scripts/antrun-schema.xml 2009-10-21 17:15:41 UTC (rev 5768)
+++ jbpm4/trunk/modules/db/scripts/antrun-schema.xml 2009-10-22 08:49:29 UTC (rev 5769)
@@ -19,13 +19,13 @@
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="maven.compile.classpath" />
- <mkdir dir="target/classes/db" />
+ <mkdir dir="${project.output.dir}" />
<create-ddl db="hsqldb" />
<create-ddl db="oracle" />
<create-ddl db="postgresql" />
<create-ddl db="mysql" />
- <replace file="target/classes/db/jbpm.mysql.create.sql"
+ <replace file="${project.output.dir}/jbpm.mysql.create.sql"
token="BLOB_VALUE_ blob"
value="BLOB_VALUE_ longblob" />
</target>
@@ -39,7 +39,7 @@
<echo>Schema Create @{db}</echo>
<echo>=====================</echo>
- <schemaexport output="target/classes/db/jbpm.(a){db}.create.sql"
+ <schemaexport output="${project.output.dir}/jbpm.(a){db}.create.sql"
create="yes"
drop="no"
config="../distro/src/main/files/install/src/cfg/hibernate/jdbc/(a){db}.hibernate.cfg.xml"
@@ -51,7 +51,7 @@
<echo>=====================</echo>
<echo>Schema Drop @{db}</echo>
<echo>=====================</echo>
- <schemaexport output="target/classes/db/jbpm.(a){db}.drop.sql"
+ <schemaexport output="${project.output.dir}/jbpm.(a){db}.drop.sql"
create="no"
drop="yes"
config="../distro/src/main/files/install/src/cfg/hibernate/jdbc/(a){db}.hibernate.cfg.xml"
@@ -77,7 +77,7 @@
<property file="${user.home}/.jbpm4/build.properties" />
<echo>upgrade.jdbc.properties.dir: ${upgrade.jdbc.properties.dir}</echo>
<property name="upgrade.jdbc.properties.dir" location="../../qa/jdbc" />
- <mkdir dir="${upgrade.files.dest.dir}" />
+ <mkdir dir="${upgrade.scripts.dir}" />
<antcall target="start.hsqldb" inheritrefs="true" />
<upgrade-ddl db="hsqldb" />
@@ -118,14 +118,14 @@
<sequential>
<property file="${upgrade.jdbc.properties.dir}/(a){db}.properties" prefix="@{db}." />
<echo />
- <echo>driver... ${(a){db}.jdbc.driver}</echo>
- <echo>url...... ${(a){db}.jdbc.url}</echo>
- <echo>username. ${(a){db}.jdbc.username}</echo>
+ <echo>driver. ${(a){db}.jdbc.driver}</echo>
+ <echo>url.... ${(a){db}.jdbc.url}</echo>
+ <echo>user... ${(a){db}.jdbc.username}</echo>
<echo>=====================</echo>
<echo>Dropping current schema @{db}</echo>
<echo>=====================</echo>
- <sql src="target/classes/db/jbpm.(a){db}.drop.sql"
+ <sql src="${project.output.dir}/jbpm.(a){db}.drop.sql"
url="${(a){db}.jdbc.url}"
driver="${(a){db}.jdbc.driver}"
userid="${(a){db}.jdbc.username}"
@@ -138,7 +138,7 @@
<echo>=====================</echo>
<echo>Creating old schema @{db}</echo>
<echo>=====================</echo>
- <sql src="target/test-classes/old-db/jbpm.(a){db}.create.sql"
+ <sql src="${old.scripts.dir}/jbpm.(a){db}.create.sql"
url="${(a){db}.jdbc.url}"
driver="${(a){db}.jdbc.driver}"
userid="${(a){db}.jdbc.username}"
@@ -158,7 +158,7 @@
<echo>=====================</echo>
<echo>Schema Upgrade @{db}</echo>
<echo>=====================</echo>
- <schemaupdate outputFile="${upgrade.files.dest.dir}/jbpm.(a){db}.upgrade.sql"
+ <schemaupdate outputFile="${upgrade.scripts.dir}/jbpm.(a){db}.upgrade.sql"
config="target/cfg/(a){db}.hibernate.cfg.xml"
properties="${upgrade.jdbc.properties.dir}/(a){db}.properties"
delimiter=";" />
@@ -167,7 +167,7 @@
<echo>=====================</echo>
<echo>Dropping old schema @{db}</echo>
<echo>=====================</echo>
- <sql src="target/test-classes/old-db/jbpm.(a){db}.drop.sql"
+ <sql src="${old.scripts.dir}/jbpm.(a){db}.drop.sql"
url="${(a){db}.jdbc.url}"
driver="${(a){db}.jdbc.driver}"
userid="${(a){db}.jdbc.username}"
Copied: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/JbpmVersion.java (from rev 5768, jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java)
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/JbpmVersion.java (rev 0)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/JbpmVersion.java 2009-10-22 08:49:29 UTC (rev 5769)
@@ -0,0 +1,46 @@
+/*
+ * 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.db;
+
+/**
+ * @author Tom Baeyens
+ */
+public enum JbpmVersion {
+
+ V_4_0, V_4_1, V_4_2;
+
+ public String toString() {
+ return "4." + ordinal();
+ }
+
+ public static JbpmVersion getJbpmVersion(String dbVersion) {
+ if (dbVersion.endsWith("-SNAPSHOT")) {
+ dbVersion = dbVersion.substring(0, dbVersion.length() - 9);
+ }
+ return dbVersion.startsWith("4.") && dbVersion.length() > 2 ? valueOf("V_4_"
+ + dbVersion.substring(2)) : null;
+ }
+
+ public boolean isEarlier(JbpmVersion other) {
+ return ordinal() < other.ordinal();
+ }
+}
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2009-10-21 17:15:41 UTC (rev 5768)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2009-10-22 08:49:29 UTC (rev 5769)
@@ -23,9 +23,10 @@
import java.util.List;
+import org.hibernate.HibernateException;
import org.hibernate.classic.Session;
+import org.hibernate.criterion.Restrictions;
import org.jbpm.api.JbpmException;
-import org.jbpm.db.internal.upgrade.JbpmVersion;
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.id.PropertyImpl;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
@@ -41,45 +42,44 @@
upgradeOperation.parseArgs(args);
HibernateOperation.executeInTransaction(upgradeOperation);
}
-
+
public String toString() {
- return "DB Upgrade to jBPM "+JpdlParser.CURRENT_VERSION_JBPM;
+ return "DB Upgrade to jBPM " + JpdlParser.CURRENT_VERSION_JBPM;
}
-
+
public void execute(Session session) {
JbpmVersion jbpmVersion = getJbpmVersion(session);
-
- if (jbpmVersion==JbpmVersion.V_4_2) {
+
+ if (jbpmVersion == JbpmVersion.V_4_2) {
throw new JbpmException("jBPM schema is already up to date");
}
-
+
if (jbpmVersion.isEarlier(JbpmVersion.V_4_1)) {
upgrade40To41(session);
}
-
+
if (jbpmVersion.isEarlier(JbpmVersion.V_4_2)) {
upgrade41To42(session);
}
}
private void upgrade40To41(Session session) {
- executeSqlResource("upgrade-4.0-to-4.1/jbpm."+database+".upgrade.sql", session);
+ executeSqlResource("upgrade-4.0-to-4.1/jbpm." + database + ".upgrade.sql", session);
}
private void upgrade41To42(Session session) {
- executeSqlResource("upgrade-4.1-to-4.2/jbpm."+database+".upgrade.sql", session);
+ executeSqlResource("upgrade-4.1-to-4.2/jbpm." + database + ".upgrade.sql", session);
addLangId(session);
PropertyImpl.upgradeProperties(session);
}
private void addLangId(Session session) {
// find deployments without a langid property
- List<DeploymentProperty> deploymentProperties = session.createQuery(
- "from "+DeploymentProperty.class.getName()+ " deploymentProperty " +
- "where deploymentProperty.key = '"+DeploymentImpl.KEY_PROCESS_DEFINITION_ID+"'"
- ).list();
-
- for (DeploymentProperty deploymentProperty: deploymentProperties) {
+ List<DeploymentProperty> deploymentProperties = session.createCriteria(DeploymentProperty.class)
+ .add(Restrictions.eq("key", DeploymentImpl.KEY_PROCESS_DEFINITION_ID))
+ .list();
+
+ for (DeploymentProperty deploymentProperty : deploymentProperties) {
String objectName = deploymentProperty.getObjectName();
deploymentProperty.getDeployment().setProcessLanguageId(objectName, "jpdl-4.0");
}
@@ -87,17 +87,25 @@
private static JbpmVersion getJbpmVersion(Session session) {
if (!PropertyImpl.propertiesTableExists(session)) {
- return JbpmVersion.V_4_0;
+ return variableClassNameColumnExists(session) ? JbpmVersion.V_4_1 : JbpmVersion.V_4_0;
}
String dbVersion = PropertyImpl.getDbVersion(session);
- if (dbVersion==null) {
- // property table exists, but no db version property is present
- // schema must have been updated moments ago
- return JbpmVersion.V_4_0;
+ if (dbVersion == null) {
+ throw new JbpmException("property table exists, but no db version property is present");
}
-
+
return JbpmVersion.getJbpmVersion(dbVersion);
}
+ private static boolean variableClassNameColumnExists(Session session) {
+ try {
+ session.createSQLQuery("select CLASSNAME_ from JBPM4_VARIABLE").list();
+ return true;
+ }
+ catch (HibernateException e) {
+ return false;
+ }
+ }
+
}
Added: jbpm4/trunk/qa/reinstall.jbpm.sh
===================================================================
--- jbpm4/trunk/qa/reinstall.jbpm.sh (rev 0)
+++ jbpm4/trunk/qa/reinstall.jbpm.sh 2009-10-22 08:49:29 UTC (rev 5769)
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# reinstalls jbpm
+
+echo 'make sure you have jbpm.parent.dir specified in your \${user.home}/.jbpm4/build.properties'
+mvn -U -Pdistro clean install
+ant -f qa/build.xml reinstall.jbpm
+
+echo
Property changes on: jbpm4/trunk/qa/reinstall.jbpm.sh
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years, 6 months
JBoss JBPM SVN: r5768 - jbpm4/trunk/modules/db/src/main/java/org/jbpm/db.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-21 13:15:41 -0400 (Wed, 21 Oct 2009)
New Revision: 5768
Modified:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
Log:
JBPM-2509 method renamings
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java 2009-10-21 16:26:54 UTC (rev 5767)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java 2009-10-21 17:15:41 UTC (rev 5768)
@@ -32,12 +32,12 @@
public static void main(String[] args) {
Create createOperation = new Create();
- createOperation.setArgs(args);
+ createOperation.parseArgs(args);
executeInTransaction(createOperation);
}
public void execute(Session session) {
- executeSqlUpdate("create/jbpm."+database+".create.sql", session);
+ executeSqlResource("create/jbpm."+database+".create.sql", session);
PropertyImpl.createProperties(session);
}
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java 2009-10-21 16:26:54 UTC (rev 5767)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java 2009-10-21 17:15:41 UTC (rev 5768)
@@ -47,7 +47,7 @@
public abstract void execute(Session session);
- public void setArgs(String[] args) {
+ public void parseArgs(String[] args) {
if (args==null || args.length==0) {
log("Syntax: java -cp ... "+getClass().getName()+" database [delimiter]");
log("where database is one of {oracle, postgresql, mysql, hsqldb}");
@@ -95,7 +95,7 @@
}
}
- public void executeSqlUpdate(String resource, Session session) {
+ public void executeSqlResource(String resource, Session session) {
InputStream stream = Upgrade.class.getClassLoader().getResourceAsStream(resource);
if (stream == null) {
throw new JbpmException("resource "+resource+" does not exist");
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2009-10-21 16:26:54 UTC (rev 5767)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2009-10-21 17:15:41 UTC (rev 5768)
@@ -38,7 +38,7 @@
public static void main(String[] args) {
Upgrade upgradeOperation = new Upgrade();
- upgradeOperation.setArgs(args);
+ upgradeOperation.parseArgs(args);
HibernateOperation.executeInTransaction(upgradeOperation);
}
@@ -63,11 +63,11 @@
}
private void upgrade40To41(Session session) {
- executeSqlUpdate("upgrade-4.0-to-4.1/jbpm."+database+".upgrade.sql", session);
+ executeSqlResource("upgrade-4.0-to-4.1/jbpm."+database+".upgrade.sql", session);
}
private void upgrade41To42(Session session) {
- executeSqlUpdate("upgrade-4.1-to-4.2/jbpm."+database+".upgrade.sql", session);
+ executeSqlResource("upgrade-4.1-to-4.2/jbpm."+database+".upgrade.sql", session);
addLangId(session);
PropertyImpl.upgradeProperties(session);
}
16 years, 6 months
JBoss JBPM SVN: r5767 - in jbpm4/trunk/modules: db/src/main/java/org/jbpm/db and 11 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-21 12:26:54 -0400 (Wed, 21 Oct 2009)
New Revision: 5767
Added:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java
jbpm4/trunk/modules/distro/src/main/files/install/src/db/
jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/
jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.hsqldb.create.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.mysql.create.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.oracle.create.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.postgresql.create.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/
jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.hsqldb.drop.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.mysql.drop.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.oracle.drop.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.postgresql.drop.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/
jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/
jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.hsqldb.upgrade.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.mysql.upgrade.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.oracle.upgrade.sql
jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.postgresql.upgrade.sql
Removed:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.hsqldb.upgrade.sql
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.mysql.upgrade.sql
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.oracle.upgrade.sql
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.postgresql.upgrade.sql
Modified:
jbpm4/trunk/modules/db/pom.xml
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
jbpm4/trunk/modules/distro/pom.xml
jbpm4/trunk/modules/distro/src/main/files/install/build.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
Log:
JBPM-2509 database upgrade work. linked install script with create and upgrade implementations.
Modified: jbpm4/trunk/modules/db/pom.xml
===================================================================
--- jbpm4/trunk/modules/db/pom.xml 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/db/pom.xml 2009-10-21 16:26:54 UTC (rev 5767)
@@ -115,7 +115,7 @@
</dependency>
</dependencies>
- <build>
+ <!-- build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
@@ -170,7 +170,8 @@
</systemProperties>
</configuration>
</plugin>
+
</plugins>
- </build>
+ </build -->
</project>
\ No newline at end of file
Copied: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java (from rev 5765, jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java)
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java (rev 0)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,47 @@
+/*
+ * 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.db;
+
+import org.hibernate.classic.Session;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.id.PropertyImpl;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class Create extends HibernateOperation {
+
+ public static void main(String[] args) {
+ Create createOperation = new Create();
+ createOperation.setArgs(args);
+ executeInTransaction(createOperation);
+ }
+
+ public void execute(Session session) {
+ executeSqlUpdate("create/jbpm."+database+".create.sql", session);
+ PropertyImpl.createProperties(session);
+ }
+
+ public String toString() {
+ return "jBPM "+JpdlParser.CURRENT_VERSION_JBPM+" DB Create";
+ }
+}
Property changes on: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java 2009-10-21 16:26:54 UTC (rev 5767)
@@ -1,41 +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.db;
-
-import org.jbpm.api.ProcessEngine;
-import org.jbpm.db.internal.upgrade.CreatePropertiesCmd;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
-
-/**
- * @author Alejandro Guizar
- */
-public class CreateProperties {
-
- public static void main(String[] args) {
- ProcessEngine processEngine = new ProcessEngineImpl()
- .skipDbCheck()
- .buildProcessEngine();
-
- // create properties
- processEngine.execute(new CreatePropertiesCmd());
- }
-}
Added: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java (rev 0)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,143 @@
+/*
+ * 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.db;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.classic.Session;
+import org.jbpm.api.JbpmException;
+import org.jbpm.internal.log.Jdk14LogFactory;
+import org.jbpm.pvm.internal.util.IoUtil;
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class HibernateOperation {
+
+ static{
+ Jdk14LogFactory.initializeJdk14Logging();
+ }
+
+ String database;
+ String delimiter;
+
+ public abstract void execute(Session session);
+
+ public void setArgs(String[] args) {
+ if (args==null || args.length==0) {
+ log("Syntax: java -cp ... "+getClass().getName()+" database [delimiter]");
+ log("where database is one of {oracle, postgresql, mysql, hsqldb}");
+ log("and delimiter is the db sql delimiter. default delimiter is ;");
+ return;
+ }
+
+ database = args[0];
+
+ delimiter = ";";
+ if (args.length>1) {
+ delimiter = args[1];
+ }
+ }
+
+ public static void executeInTransaction(HibernateOperation hibernateOperation) {
+ log("Starting "+hibernateOperation);
+ log(" database : "+hibernateOperation.database);
+ log(" delimiter: "+hibernateOperation.delimiter);
+
+ SessionFactory sessionFactory = new Configuration()
+ .configure("jbpm.hibernate.cfg.xml")
+ .buildSessionFactory();
+
+ Session session = sessionFactory.openSession();
+ Transaction transaction = null;
+ try {
+ transaction = session.beginTransaction();
+
+ hibernateOperation.execute(session);
+
+ transaction.commit();
+
+ log(hibernateOperation+" completed successfully.");
+
+ } catch (Exception e) {
+ if (transaction!=null){
+ transaction.rollback();
+ }
+ log("ERROR: "+hibernateOperation+" FAILED:");
+ e.printStackTrace();
+
+ } finally {
+ session.close();
+ }
+ }
+
+ public void executeSqlUpdate(String resource, Session session) {
+ InputStream stream = Upgrade.class.getClassLoader().getResourceAsStream(resource);
+ if (stream == null) {
+ throw new JbpmException("resource "+resource+" does not exist");
+ }
+
+ byte[] bytes = IoUtil.readBytes(stream);
+ String fileContents = new String(bytes);
+ List<String> commands = extractCommands(fileContents);
+
+ log("--- Executing DB Commands -------------------------");
+ for (String command: commands) {
+ log(command);
+ try {
+ int result = session.createSQLQuery(command).executeUpdate();
+ log("--- Result: "+result+" --------------------------");
+ } catch (Exception e) {
+ e.printStackTrace();
+ log("-----------------------------------------------");
+ }
+ }
+ }
+
+ public List<String> extractCommands(String fileContents) {
+ List<String> commands = new ArrayList<String>();
+ int i = 0;
+ while (i<fileContents.length()) {
+ int j = fileContents.indexOf(delimiter, i);
+ if (j==-1) {
+ j = fileContents.length();
+ } else {
+ j += delimiter.length();
+ }
+ String command = fileContents.substring(i, j).trim();
+ if (command.length()>0) {
+ commands.add(command);
+ }
+ i = j;
+ }
+ return commands;
+ }
+
+ public static void log(String msg) {
+ System.out.println(msg);
+ }
+}
Property changes on: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2009-10-21 16:26:54 UTC (rev 5767)
@@ -21,34 +21,83 @@
*/
package org.jbpm.db;
-import org.jbpm.api.ProcessEngine;
-import org.jbpm.db.internal.upgrade.AddLangIdCmd;
-import org.jbpm.db.internal.upgrade.GetJbpmVersionCmd;
+import java.util.List;
+
+import org.hibernate.classic.Session;
+import org.jbpm.api.JbpmException;
import org.jbpm.db.internal.upgrade.JbpmVersion;
-import org.jbpm.db.internal.upgrade.UpdateSchemaCmd;
-import org.jbpm.db.internal.upgrade.UpgradePropertiesCmd;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.id.PropertyImpl;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.pvm.internal.repository.DeploymentProperty;
/**
* @author Alejandro Guizar
*/
-public class Upgrade {
+public class Upgrade extends HibernateOperation {
public static void main(String[] args) {
- ProcessEngine processEngine = new ProcessEngineImpl()
- .skipDbCheck()
- .buildProcessEngine();
+ Upgrade upgradeOperation = new Upgrade();
+ upgradeOperation.setArgs(args);
+ HibernateOperation.executeInTransaction(upgradeOperation);
+ }
+
+ public String toString() {
+ return "DB Upgrade to jBPM "+JpdlParser.CURRENT_VERSION_JBPM;
+ }
+
+ public void execute(Session session) {
+ JbpmVersion jbpmVersion = getJbpmVersion(session);
+
+ if (jbpmVersion==JbpmVersion.V_4_2) {
+ throw new JbpmException("jBPM schema is already up to date");
+ }
+
+ if (jbpmVersion.isEarlier(JbpmVersion.V_4_1)) {
+ upgrade40To41(session);
+ }
+
+ if (jbpmVersion.isEarlier(JbpmVersion.V_4_2)) {
+ upgrade41To42(session);
+ }
+ }
- // update database schema
- processEngine.execute(new UpdateSchemaCmd());
+ private void upgrade40To41(Session session) {
+ executeSqlUpdate("upgrade-4.0-to-4.1/jbpm."+database+".upgrade.sql", session);
+ }
- // check whether database version predates engine version
- JbpmVersion currentVersion = processEngine.execute(new GetJbpmVersionCmd());
- if (currentVersion.isEarlier(JbpmVersion.V_4_2)) {
- // add property "langid" to each deployed process
- processEngine.execute(new AddLangIdCmd());
- // upgrade properties
- processEngine.execute(new UpgradePropertiesCmd());
+ private void upgrade41To42(Session session) {
+ executeSqlUpdate("upgrade-4.1-to-4.2/jbpm."+database+".upgrade.sql", session);
+ addLangId(session);
+ PropertyImpl.upgradeProperties(session);
+ }
+
+ private void addLangId(Session session) {
+ // find deployments without a langid property
+ List<DeploymentProperty> deploymentProperties = session.createQuery(
+ "from "+DeploymentProperty.class.getName()+ " deploymentProperty " +
+ "where deploymentProperty.key = '"+DeploymentImpl.KEY_PROCESS_DEFINITION_ID+"'"
+ ).list();
+
+ for (DeploymentProperty deploymentProperty: deploymentProperties) {
+ String objectName = deploymentProperty.getObjectName();
+ deploymentProperty.getDeployment().setProcessLanguageId(objectName, "jpdl-4.0");
}
}
+
+ private static JbpmVersion getJbpmVersion(Session session) {
+ if (!PropertyImpl.propertiesTableExists(session)) {
+ return JbpmVersion.V_4_0;
+ }
+
+ String dbVersion = PropertyImpl.getDbVersion(session);
+ if (dbVersion==null) {
+ // property table exists, but no db version property is present
+ // schema must have been updated moments ago
+ return JbpmVersion.V_4_0;
+ }
+
+ return JbpmVersion.getJbpmVersion(dbVersion);
+ }
+
}
Deleted: jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -1,3 +0,0 @@
-
- alter table JBPM4_VARIABLE
- add column CLASSNAME_ varchar(255);
Deleted: jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -1,3 +0,0 @@
-
- alter table JBPM4_VARIABLE
- add column CLASSNAME_ varchar(255);
Deleted: jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -1,3 +0,0 @@
-
- alter table JBPM4_VARIABLE
- add CLASSNAME_ varchar2(255 char);
Deleted: jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -1,3 +0,0 @@
-
- alter table JBPM4_VARIABLE
- add column CLASSNAME_ varchar(255);
Deleted: jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.hsqldb.upgrade.sql
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.hsqldb.upgrade.sql 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.hsqldb.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -1,7 +0,0 @@
-
- create table JBPM4_PROPERTY (
- KEY_ varchar(255) not null,
- VERSION_ integer not null,
- VALUE_ varchar(255),
- primary key (KEY_)
- );
Deleted: jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.mysql.upgrade.sql
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.mysql.upgrade.sql 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.mysql.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -1,7 +0,0 @@
-
- create table JBPM4_PROPERTY (
- KEY_ varchar(255) not null,
- VERSION_ integer not null,
- VALUE_ varchar(255),
- primary key (KEY_)
- ) type=InnoDB;
Deleted: jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.oracle.upgrade.sql
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.oracle.upgrade.sql 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.oracle.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -1,7 +0,0 @@
-
- create table JBPM4_PROPERTY (
- KEY_ varchar2(255 char) not null,
- VERSION_ number(10,0) not null,
- VALUE_ varchar2(255 char),
- primary key (KEY_)
- );
Deleted: jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.postgresql.upgrade.sql
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.postgresql.upgrade.sql 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.postgresql.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -1,7 +0,0 @@
-
- create table JBPM4_PROPERTY (
- KEY_ varchar(255) not null,
- VERSION_ int4 not null,
- VALUE_ varchar(255),
- primary key (KEY_)
- );
Modified: jbpm4/trunk/modules/distro/pom.xml
===================================================================
--- jbpm4/trunk/modules/distro/pom.xml 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/distro/pom.xml 2009-10-21 16:26:54 UTC (rev 5767)
@@ -156,10 +156,15 @@
<artifactId>ant</artifactId>
</dependency>
<dependency>
- <groupId>izpack</groupId>
- <artifactId>standalone-compiler</artifactId>
+ <groupId>org.freemarker</groupId>
+ <artifactId>freemarker</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.9.1</version>
+ </dependency>
+
<!-- Database Drivers -->
<dependency>
<groupId>mysql</groupId>
Modified: jbpm4/trunk/modules/distro/src/main/files/install/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2009-10-21 16:26:54 UTC (rev 5767)
@@ -582,20 +582,22 @@
<!-- ### CREATE JBPM SCHEMA ############################################# -->
<target name="create.jbpm.schema"
+ depends="create.cfg"
description="creates the jbpm tables in the database">
- <echo message="creating jbpm schema in db ${jdbc.url}" />
- <sql driver="${jdbc.driver}"
- url="${jdbc.url}"
- userid="${jdbc.username}"
- password="${jdbc.password}"
- onerror="continue"
- src="${jbpm.home}/install/src/db/jbpm.${database}.create.sql">
+ <echo message="creating jbpm schema..." />
+ <java classname="org.jbpm.db.Create">
+ <arg line="${database}" />
<classpath>
+ <pathelement location="${jbpm.home}/install/generated/cfg" />
+ <pathelement location="${jbpm.home}/install/src/db" />
+ <fileset dir="${jbpm.home}">
+ <include name="jbpm.jar"/>
+ </fileset>
<fileset dir="${jbpm.home}/lib">
<include name="*.jar"/>
</fileset>
</classpath>
- </sql>
+ </java>
</target>
<!-- ### UPGRADE JBPM SCHEMA ############################################# -->
@@ -604,8 +606,10 @@
description="Upgrades the jBPM tables in the database to the current version">
<echo message="upgrading jbpm schema..." />
<java classname="org.jbpm.db.Upgrade">
+ <arg line="${database}" />
<classpath>
<pathelement location="${jbpm.home}/install/generated/cfg" />
+ <pathelement location="${jbpm.home}/install/src/db" />
<fileset dir="${jbpm.home}">
<include name="jbpm.jar"/>
</fileset>
@@ -625,7 +629,7 @@
userid="${jdbc.username}"
password="${jdbc.password}"
onerror="continue"
- src="${jbpm.home}/install/src/db/jbpm.${database}.drop.sql">
+ src="${jbpm.home}/install/src/db/drop/jbpm.${database}.drop.sql">
<classpath>
<fileset dir="${jbpm.home}/lib">
<include name="*.jar"/>
Added: jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.hsqldb.create.sql
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.hsqldb.create.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.hsqldb.create.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,467 @@
+
+ create table JBPM4_DEPLOYMENT (
+ DBID_ bigint not null,
+ NAME_ longvarchar,
+ TIMESTAMP_ bigint,
+ STATE_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_DEPLOYPROP (
+ DBID_ bigint not null,
+ DEPLOYMENT_ bigint,
+ OBJNAME_ varchar(255),
+ KEY_ varchar(255),
+ STRINGVAL_ varchar(255),
+ LONGVAL_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_EXECUTION (
+ DBID_ bigint not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ ACTIVITYNAME_ varchar(255),
+ PROCDEFID_ varchar(255),
+ HASVARS_ bit,
+ NAME_ varchar(255),
+ KEY_ varchar(255),
+ ID_ varchar(255),
+ STATE_ varchar(255),
+ SUSPHISTSTATE_ varchar(255),
+ PRIORITY_ integer,
+ HISACTINST_ bigint,
+ PARENT_ bigint,
+ INSTANCE_ bigint,
+ SUPEREXEC_ bigint,
+ SUBPROCINST_ bigint,
+ PARENT_IDX_ integer,
+ primary key (DBID_),
+ unique (ID_)
+ );
+
+ create table JBPM4_HIST_ACTINST (
+ DBID_ bigint not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ HPROCI_ bigint,
+ TYPE_ varchar(255),
+ EXECUTION_ varchar(255),
+ ACTIVITY_NAME_ varchar(255),
+ START_ timestamp,
+ END_ timestamp,
+ DURATION_ bigint,
+ TRANSITION_ varchar(255),
+ NEXTIDX_ integer,
+ HTASK_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_DETAIL (
+ DBID_ bigint not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ USERID_ varchar(255),
+ TIME_ timestamp,
+ HPROCI_ bigint,
+ HPROCIIDX_ integer,
+ HACTI_ bigint,
+ HACTIIDX_ integer,
+ HTASK_ bigint,
+ HTASKIDX_ integer,
+ HVAR_ bigint,
+ HVARIDX_ integer,
+ MESSAGE_ longvarchar,
+ OLD_STR_ varchar(255),
+ NEW_STR_ varchar(255),
+ OLD_INT_ integer,
+ NEW_INT_ integer,
+ OLD_TIME_ timestamp,
+ NEW_TIME_ timestamp,
+ PARENT_ bigint,
+ PARENT_IDX_ integer,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_PROCINST (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ ID_ varchar(255),
+ PROCDEFID_ varchar(255),
+ KEY_ varchar(255),
+ START_ timestamp,
+ END_ timestamp,
+ DURATION_ bigint,
+ STATE_ varchar(255),
+ ENDACTIVITY_ varchar(255),
+ NEXTIDX_ integer,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_TASK (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ EXECUTION_ varchar(255),
+ OUTCOME_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ PRIORITY_ integer,
+ STATE_ varchar(255),
+ CREATE_ timestamp,
+ END_ timestamp,
+ DURATION_ bigint,
+ NEXTIDX_ integer,
+ SUPERTASK_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_VAR (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ PROCINSTID_ varchar(255),
+ EXECUTIONID_ varchar(255),
+ VARNAME_ varchar(255),
+ VALUE_ varchar(255),
+ HPROCI_ bigint,
+ HTASK_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_ID_GROUP (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ ID_ varchar(255),
+ NAME_ varchar(255),
+ TYPE_ varchar(255),
+ PARENT_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_ID_MEMBERSHIP (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ USER_ bigint,
+ GROUP_ bigint,
+ NAME_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_ID_USER (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ ID_ varchar(255),
+ PASSWORD_ varchar(255),
+ GIVENNAME_ varchar(255),
+ FAMILYNAME_ varchar(255),
+ BUSINESSEMAIL_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_JOB (
+ DBID_ bigint not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ DUEDATE_ timestamp,
+ STATE_ varchar(255),
+ ISEXCLUSIVE_ bit,
+ LOCKOWNER_ varchar(255),
+ LOCKEXPTIME_ timestamp,
+ EXCEPTION_ longvarchar,
+ RETRIES_ integer,
+ PROCESSINSTANCE_ bigint,
+ EXECUTION_ bigint,
+ CFG_ bigint,
+ SIGNAL_ varchar(255),
+ EVENT_ varchar(255),
+ REPEAT_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_LOB (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ BLOB_VALUE_ longvarbinary,
+ DEPLOYMENT_ bigint,
+ NAME_ longvarchar,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_PARTICIPATION (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ GROUPID_ varchar(255),
+ USERID_ varchar(255),
+ TYPE_ varchar(255),
+ TASK_ bigint,
+ SWIMLANE_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_PROPERTY (
+ KEY_ varchar(255) not null,
+ VERSION_ integer not null,
+ VALUE_ varchar(255),
+ primary key (KEY_)
+ );
+
+ create table JBPM4_SWIMLANE (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ NAME_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ EXECUTION_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_TASK (
+ DBID_ bigint not null,
+ CLASS_ char(1) not null,
+ DBVERSION_ integer not null,
+ NAME_ varchar(255),
+ DESCR_ longvarchar,
+ STATE_ varchar(255),
+ SUSPHISTSTATE_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ FORM_ varchar(255),
+ PRIORITY_ integer,
+ CREATE_ timestamp,
+ DUEDATE_ timestamp,
+ PROGRESS_ integer,
+ SIGNALLING_ bit,
+ EXECUTION_ID_ varchar(255),
+ ACTIVITY_NAME_ varchar(255),
+ HASVARS_ bit,
+ SUPERTASK_ bigint,
+ EXECUTION_ bigint,
+ PROCINST_ bigint,
+ SWIMLANE_ bigint,
+ TASKDEFNAME_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_VARIABLE (
+ DBID_ bigint not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ KEY_ varchar(255),
+ CONVERTER_ varchar(255),
+ HIST_ bit,
+ EXECUTION_ bigint,
+ TASK_ bigint,
+ LOB_ bigint,
+ DATE_VALUE_ timestamp,
+ DOUBLE_VALUE_ double,
+ CLASSNAME_ varchar(255),
+ LONG_VALUE_ bigint,
+ STRING_VALUE_ varchar(255),
+ TEXT_VALUE_ longvarchar,
+ EXESYS_ bigint,
+ primary key (DBID_)
+ );
+
+ create index IDX_DEPLPROP_DEPL on JBPM4_DEPLOYPROP (DEPLOYMENT_);
+
+ alter table JBPM4_DEPLOYPROP
+ add constraint FK_DEPLPROP_DEPL
+ foreign key (DEPLOYMENT_)
+ references JBPM4_DEPLOYMENT;
+
+ create index IDX_EXEC_SUPEREXEC on JBPM4_EXECUTION (SUPEREXEC_);
+
+ create index IDX_EXEC_INSTANCE on JBPM4_EXECUTION (INSTANCE_);
+
+ create index IDX_EXEC_SUBPI on JBPM4_EXECUTION (SUBPROCINST_);
+
+ create index IDX_EXEC_PARENT on JBPM4_EXECUTION (PARENT_);
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_PARENT
+ foreign key (PARENT_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_SUBPI
+ foreign key (SUBPROCINST_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_INSTANCE
+ foreign key (INSTANCE_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_SUPEREXEC
+ foreign key (SUPEREXEC_)
+ references JBPM4_EXECUTION;
+
+ create index IDX_HACTI_HPROCI on JBPM4_HIST_ACTINST (HPROCI_);
+
+ create index IDX_HTI_HTASK on JBPM4_HIST_ACTINST (HTASK_);
+
+ alter table JBPM4_HIST_ACTINST
+ add constraint FK_HACTI_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST;
+
+ alter table JBPM4_HIST_ACTINST
+ add constraint FK_HTI_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK;
+
+ create index IDX_HDET_HACTI on JBPM4_HIST_DETAIL (HACTI_);
+
+ create index IDX_HDET_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);
+
+ create index IDX_HDETAIL_HACTI on JBPM4_HIST_DETAIL (HACTI_);
+
+ create index IDX_HDETAIL_HVAR on JBPM4_HIST_DETAIL (HVAR_);
+
+ create index IDX_HDETAIL_HTASK on JBPM4_HIST_DETAIL (HTASK_);
+
+ create index IDX_HDETAIL_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);
+
+ create index IDX_HDET_HVAR on JBPM4_HIST_DETAIL (HVAR_);
+
+ create index IDX_HDET_HTASK on JBPM4_HIST_DETAIL (HTASK_);
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST;
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HACTI
+ foreign key (HACTI_)
+ references JBPM4_HIST_ACTINST;
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK;
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HVAR
+ foreign key (HVAR_)
+ references JBPM4_HIST_VAR;
+
+ alter table JBPM4_HIST_TASK
+ add constraint FK_HSUPERT_SUB
+ foreign key (SUPERTASK_)
+ references JBPM4_HIST_TASK;
+
+ create index IDX_HVAR_HPROCI on JBPM4_HIST_VAR (HPROCI_);
+
+ create index IDX_HVAR_HTASK on JBPM4_HIST_VAR (HTASK_);
+
+ alter table JBPM4_HIST_VAR
+ add constraint FK_HVAR_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST;
+
+ alter table JBPM4_HIST_VAR
+ add constraint FK_HVAR_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK;
+
+ create index IDX_GROUP_PARENT on JBPM4_ID_GROUP (PARENT_);
+
+ alter table JBPM4_ID_GROUP
+ add constraint FK_GROUP_PARENT
+ foreign key (PARENT_)
+ references JBPM4_ID_GROUP;
+
+ create index IDX_MEM_USER on JBPM4_ID_MEMBERSHIP (USER_);
+
+ create index IDX_MEM_GROUP on JBPM4_ID_MEMBERSHIP (GROUP_);
+
+ alter table JBPM4_ID_MEMBERSHIP
+ add constraint FK_MEM_GROUP
+ foreign key (GROUP_)
+ references JBPM4_ID_GROUP;
+
+ alter table JBPM4_ID_MEMBERSHIP
+ add constraint FK_MEM_USER
+ foreign key (USER_)
+ references JBPM4_ID_USER;
+
+ create index IDX_JOBRETRIES on JBPM4_JOB (RETRIES_);
+
+ create index IDX_JOB_CFG on JBPM4_JOB (CFG_);
+
+ create index IDX_JOB_PRINST on JBPM4_JOB (PROCESSINSTANCE_);
+
+ create index IDX_JOB_EXE on JBPM4_JOB (EXECUTION_);
+
+ create index IDX_JOBLOCKEXP on JBPM4_JOB (LOCKEXPTIME_);
+
+ create index IDX_JOBDUEDATE on JBPM4_JOB (DUEDATE_);
+
+ alter table JBPM4_JOB
+ add constraint FK_JOB_CFG
+ foreign key (CFG_)
+ references JBPM4_LOB;
+
+ create index IDX_LOB_DEPLOYMENT on JBPM4_LOB (DEPLOYMENT_);
+
+ alter table JBPM4_LOB
+ add constraint FK_LOB_DEPLOYMENT
+ foreign key (DEPLOYMENT_)
+ references JBPM4_DEPLOYMENT;
+
+ create index IDX_PART_TASK on JBPM4_PARTICIPATION (TASK_);
+
+ alter table JBPM4_PARTICIPATION
+ add constraint FK_PART_SWIMLANE
+ foreign key (SWIMLANE_)
+ references JBPM4_SWIMLANE;
+
+ alter table JBPM4_PARTICIPATION
+ add constraint FK_PART_TASK
+ foreign key (TASK_)
+ references JBPM4_TASK;
+
+ create index IDX_SWIMLANE_EXEC on JBPM4_SWIMLANE (EXECUTION_);
+
+ alter table JBPM4_SWIMLANE
+ add constraint FK_SWIMLANE_EXEC
+ foreign key (EXECUTION_)
+ references JBPM4_EXECUTION;
+
+ create index IDX_TASK_SUPERTASK on JBPM4_TASK (SUPERTASK_);
+
+ alter table JBPM4_TASK
+ add constraint FK_TASK_SWIML
+ foreign key (SWIMLANE_)
+ references JBPM4_SWIMLANE;
+
+ alter table JBPM4_TASK
+ add constraint FK_TASK_SUPERTASK
+ foreign key (SUPERTASK_)
+ references JBPM4_TASK;
+
+ create index IDX_VAR_EXESYS on JBPM4_VARIABLE (EXESYS_);
+
+ create index IDX_VAR_TASK on JBPM4_VARIABLE (TASK_);
+
+ create index IDX_VAR_EXECUTION on JBPM4_VARIABLE (EXECUTION_);
+
+ create index IDX_VAR_LOB on JBPM4_VARIABLE (LOB_);
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_LOB
+ foreign key (LOB_)
+ references JBPM4_LOB;
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_EXECUTION
+ foreign key (EXECUTION_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_EXESYS
+ foreign key (EXESYS_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_TASK
+ foreign key (TASK_)
+ references JBPM4_TASK;
Added: jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.mysql.create.sql
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.mysql.create.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.mysql.create.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,494 @@
+
+ create table JBPM4_DEPLOYMENT (
+ DBID_ bigint not null,
+ NAME_ longtext,
+ TIMESTAMP_ bigint,
+ STATE_ varchar(255),
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_DEPLOYPROP (
+ DBID_ bigint not null,
+ DEPLOYMENT_ bigint,
+ OBJNAME_ varchar(255),
+ KEY_ varchar(255),
+ STRINGVAL_ varchar(255),
+ LONGVAL_ bigint,
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_EXECUTION (
+ DBID_ bigint not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ ACTIVITYNAME_ varchar(255),
+ PROCDEFID_ varchar(255),
+ HASVARS_ bit,
+ NAME_ varchar(255),
+ KEY_ varchar(255),
+ ID_ varchar(255) unique,
+ STATE_ varchar(255),
+ SUSPHISTSTATE_ varchar(255),
+ PRIORITY_ integer,
+ HISACTINST_ bigint,
+ PARENT_ bigint,
+ INSTANCE_ bigint,
+ SUPEREXEC_ bigint,
+ SUBPROCINST_ bigint,
+ PARENT_IDX_ integer,
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_HIST_ACTINST (
+ DBID_ bigint not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ HPROCI_ bigint,
+ TYPE_ varchar(255),
+ EXECUTION_ varchar(255),
+ ACTIVITY_NAME_ varchar(255),
+ START_ datetime,
+ END_ datetime,
+ DURATION_ bigint,
+ TRANSITION_ varchar(255),
+ NEXTIDX_ integer,
+ HTASK_ bigint,
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_HIST_DETAIL (
+ DBID_ bigint not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ USERID_ varchar(255),
+ TIME_ datetime,
+ HPROCI_ bigint,
+ HPROCIIDX_ integer,
+ HACTI_ bigint,
+ HACTIIDX_ integer,
+ HTASK_ bigint,
+ HTASKIDX_ integer,
+ HVAR_ bigint,
+ HVARIDX_ integer,
+ MESSAGE_ longtext,
+ OLD_STR_ varchar(255),
+ NEW_STR_ varchar(255),
+ OLD_INT_ integer,
+ NEW_INT_ integer,
+ OLD_TIME_ datetime,
+ NEW_TIME_ datetime,
+ PARENT_ bigint,
+ PARENT_IDX_ integer,
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_HIST_PROCINST (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ ID_ varchar(255),
+ PROCDEFID_ varchar(255),
+ KEY_ varchar(255),
+ START_ datetime,
+ END_ datetime,
+ DURATION_ bigint,
+ STATE_ varchar(255),
+ ENDACTIVITY_ varchar(255),
+ NEXTIDX_ integer,
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_HIST_TASK (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ EXECUTION_ varchar(255),
+ OUTCOME_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ PRIORITY_ integer,
+ STATE_ varchar(255),
+ CREATE_ datetime,
+ END_ datetime,
+ DURATION_ bigint,
+ NEXTIDX_ integer,
+ SUPERTASK_ bigint,
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_HIST_VAR (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ PROCINSTID_ varchar(255),
+ EXECUTIONID_ varchar(255),
+ VARNAME_ varchar(255),
+ VALUE_ varchar(255),
+ HPROCI_ bigint,
+ HTASK_ bigint,
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_ID_GROUP (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ ID_ varchar(255),
+ NAME_ varchar(255),
+ TYPE_ varchar(255),
+ PARENT_ bigint,
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_ID_MEMBERSHIP (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ USER_ bigint,
+ GROUP_ bigint,
+ NAME_ varchar(255),
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_ID_USER (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ ID_ varchar(255),
+ PASSWORD_ varchar(255),
+ GIVENNAME_ varchar(255),
+ FAMILYNAME_ varchar(255),
+ BUSINESSEMAIL_ varchar(255),
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_JOB (
+ DBID_ bigint not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ DUEDATE_ datetime,
+ STATE_ varchar(255),
+ ISEXCLUSIVE_ bit,
+ LOCKOWNER_ varchar(255),
+ LOCKEXPTIME_ datetime,
+ EXCEPTION_ longtext,
+ RETRIES_ integer,
+ PROCESSINSTANCE_ bigint,
+ EXECUTION_ bigint,
+ CFG_ bigint,
+ SIGNAL_ varchar(255),
+ EVENT_ varchar(255),
+ REPEAT_ varchar(255),
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_LOB (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ BLOB_VALUE_ longblob,
+ DEPLOYMENT_ bigint,
+ NAME_ longtext,
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_PARTICIPATION (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ GROUPID_ varchar(255),
+ USERID_ varchar(255),
+ TYPE_ varchar(255),
+ TASK_ bigint,
+ SWIMLANE_ bigint,
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_PROPERTY (
+ KEY_ varchar(255) not null,
+ VERSION_ integer not null,
+ VALUE_ varchar(255),
+ primary key (KEY_)
+ ) type=InnoDB;
+
+ create table JBPM4_SWIMLANE (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ NAME_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ EXECUTION_ bigint,
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_TASK (
+ DBID_ bigint not null,
+ CLASS_ char(1) not null,
+ DBVERSION_ integer not null,
+ NAME_ varchar(255),
+ DESCR_ longtext,
+ STATE_ varchar(255),
+ SUSPHISTSTATE_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ FORM_ varchar(255),
+ PRIORITY_ integer,
+ CREATE_ datetime,
+ DUEDATE_ datetime,
+ PROGRESS_ integer,
+ SIGNALLING_ bit,
+ EXECUTION_ID_ varchar(255),
+ ACTIVITY_NAME_ varchar(255),
+ HASVARS_ bit,
+ SUPERTASK_ bigint,
+ EXECUTION_ bigint,
+ PROCINST_ bigint,
+ SWIMLANE_ bigint,
+ TASKDEFNAME_ varchar(255),
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create table JBPM4_VARIABLE (
+ DBID_ bigint not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ KEY_ varchar(255),
+ CONVERTER_ varchar(255),
+ HIST_ bit,
+ EXECUTION_ bigint,
+ TASK_ bigint,
+ LOB_ bigint,
+ DATE_VALUE_ datetime,
+ DOUBLE_VALUE_ double precision,
+ CLASSNAME_ varchar(255),
+ LONG_VALUE_ bigint,
+ STRING_VALUE_ varchar(255),
+ TEXT_VALUE_ longtext,
+ EXESYS_ bigint,
+ primary key (DBID_)
+ ) type=InnoDB;
+
+ create index IDX_DEPLPROP_DEPL on JBPM4_DEPLOYPROP (DEPLOYMENT_);
+
+ alter table JBPM4_DEPLOYPROP
+ add index FK_DEPLPROP_DEPL (DEPLOYMENT_),
+ add constraint FK_DEPLPROP_DEPL
+ foreign key (DEPLOYMENT_)
+ references JBPM4_DEPLOYMENT (DBID_);
+
+ create index IDX_EXEC_SUPEREXEC on JBPM4_EXECUTION (SUPEREXEC_);
+
+ create index IDX_EXEC_INSTANCE on JBPM4_EXECUTION (INSTANCE_);
+
+ create index IDX_EXEC_SUBPI on JBPM4_EXECUTION (SUBPROCINST_);
+
+ create index IDX_EXEC_PARENT on JBPM4_EXECUTION (PARENT_);
+
+ alter table JBPM4_EXECUTION
+ add index FK_EXEC_PARENT (PARENT_),
+ add constraint FK_EXEC_PARENT
+ foreign key (PARENT_)
+ references JBPM4_EXECUTION (DBID_);
+
+ alter table JBPM4_EXECUTION
+ add index FK_EXEC_SUBPI (SUBPROCINST_),
+ add constraint FK_EXEC_SUBPI
+ foreign key (SUBPROCINST_)
+ references JBPM4_EXECUTION (DBID_);
+
+ alter table JBPM4_EXECUTION
+ add index FK_EXEC_INSTANCE (INSTANCE_),
+ add constraint FK_EXEC_INSTANCE
+ foreign key (INSTANCE_)
+ references JBPM4_EXECUTION (DBID_);
+
+ alter table JBPM4_EXECUTION
+ add index FK_EXEC_SUPEREXEC (SUPEREXEC_),
+ add constraint FK_EXEC_SUPEREXEC
+ foreign key (SUPEREXEC_)
+ references JBPM4_EXECUTION (DBID_);
+
+ create index IDX_HACTI_HPROCI on JBPM4_HIST_ACTINST (HPROCI_);
+
+ create index IDX_HTI_HTASK on JBPM4_HIST_ACTINST (HTASK_);
+
+ alter table JBPM4_HIST_ACTINST
+ add index FK_HACTI_HPROCI (HPROCI_),
+ add constraint FK_HACTI_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST (DBID_);
+
+ alter table JBPM4_HIST_ACTINST
+ add index FK_HTI_HTASK (HTASK_),
+ add constraint FK_HTI_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK (DBID_);
+
+ create index IDX_HDET_HACTI on JBPM4_HIST_DETAIL (HACTI_);
+
+ create index IDX_HDET_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);
+
+ create index IDX_HDETAIL_HACTI on JBPM4_HIST_DETAIL (HACTI_);
+
+ create index IDX_HDETAIL_HVAR on JBPM4_HIST_DETAIL (HVAR_);
+
+ create index IDX_HDETAIL_HTASK on JBPM4_HIST_DETAIL (HTASK_);
+
+ create index IDX_HDETAIL_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);
+
+ create index IDX_HDET_HVAR on JBPM4_HIST_DETAIL (HVAR_);
+
+ create index IDX_HDET_HTASK on JBPM4_HIST_DETAIL (HTASK_);
+
+ alter table JBPM4_HIST_DETAIL
+ add index FK_HDETAIL_HPROCI (HPROCI_),
+ add constraint FK_HDETAIL_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST (DBID_);
+
+ alter table JBPM4_HIST_DETAIL
+ add index FK_HDETAIL_HACTI (HACTI_),
+ add constraint FK_HDETAIL_HACTI
+ foreign key (HACTI_)
+ references JBPM4_HIST_ACTINST (DBID_);
+
+ alter table JBPM4_HIST_DETAIL
+ add index FK_HDETAIL_HTASK (HTASK_),
+ add constraint FK_HDETAIL_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK (DBID_);
+
+ alter table JBPM4_HIST_DETAIL
+ add index FK_HDETAIL_HVAR (HVAR_),
+ add constraint FK_HDETAIL_HVAR
+ foreign key (HVAR_)
+ references JBPM4_HIST_VAR (DBID_);
+
+ alter table JBPM4_HIST_TASK
+ add index FK_HSUPERT_SUB (SUPERTASK_),
+ add constraint FK_HSUPERT_SUB
+ foreign key (SUPERTASK_)
+ references JBPM4_HIST_TASK (DBID_);
+
+ create index IDX_HVAR_HPROCI on JBPM4_HIST_VAR (HPROCI_);
+
+ create index IDX_HVAR_HTASK on JBPM4_HIST_VAR (HTASK_);
+
+ alter table JBPM4_HIST_VAR
+ add index FK_HVAR_HPROCI (HPROCI_),
+ add constraint FK_HVAR_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST (DBID_);
+
+ alter table JBPM4_HIST_VAR
+ add index FK_HVAR_HTASK (HTASK_),
+ add constraint FK_HVAR_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK (DBID_);
+
+ create index IDX_GROUP_PARENT on JBPM4_ID_GROUP (PARENT_);
+
+ alter table JBPM4_ID_GROUP
+ add index FK_GROUP_PARENT (PARENT_),
+ add constraint FK_GROUP_PARENT
+ foreign key (PARENT_)
+ references JBPM4_ID_GROUP (DBID_);
+
+ create index IDX_MEM_USER on JBPM4_ID_MEMBERSHIP (USER_);
+
+ create index IDX_MEM_GROUP on JBPM4_ID_MEMBERSHIP (GROUP_);
+
+ alter table JBPM4_ID_MEMBERSHIP
+ add index FK_MEM_GROUP (GROUP_),
+ add constraint FK_MEM_GROUP
+ foreign key (GROUP_)
+ references JBPM4_ID_GROUP (DBID_);
+
+ alter table JBPM4_ID_MEMBERSHIP
+ add index FK_MEM_USER (USER_),
+ add constraint FK_MEM_USER
+ foreign key (USER_)
+ references JBPM4_ID_USER (DBID_);
+
+ create index IDX_JOBRETRIES on JBPM4_JOB (RETRIES_);
+
+ create index IDX_JOB_CFG on JBPM4_JOB (CFG_);
+
+ create index IDX_JOB_PRINST on JBPM4_JOB (PROCESSINSTANCE_);
+
+ create index IDX_JOB_EXE on JBPM4_JOB (EXECUTION_);
+
+ create index IDX_JOBLOCKEXP on JBPM4_JOB (LOCKEXPTIME_);
+
+ create index IDX_JOBDUEDATE on JBPM4_JOB (DUEDATE_);
+
+ alter table JBPM4_JOB
+ add index FK_JOB_CFG (CFG_),
+ add constraint FK_JOB_CFG
+ foreign key (CFG_)
+ references JBPM4_LOB (DBID_);
+
+ create index IDX_LOB_DEPLOYMENT on JBPM4_LOB (DEPLOYMENT_);
+
+ alter table JBPM4_LOB
+ add index FK_LOB_DEPLOYMENT (DEPLOYMENT_),
+ add constraint FK_LOB_DEPLOYMENT
+ foreign key (DEPLOYMENT_)
+ references JBPM4_DEPLOYMENT (DBID_);
+
+ create index IDX_PART_TASK on JBPM4_PARTICIPATION (TASK_);
+
+ alter table JBPM4_PARTICIPATION
+ add index FK_PART_SWIMLANE (SWIMLANE_),
+ add constraint FK_PART_SWIMLANE
+ foreign key (SWIMLANE_)
+ references JBPM4_SWIMLANE (DBID_);
+
+ alter table JBPM4_PARTICIPATION
+ add index FK_PART_TASK (TASK_),
+ add constraint FK_PART_TASK
+ foreign key (TASK_)
+ references JBPM4_TASK (DBID_);
+
+ create index IDX_SWIMLANE_EXEC on JBPM4_SWIMLANE (EXECUTION_);
+
+ alter table JBPM4_SWIMLANE
+ add index FK_SWIMLANE_EXEC (EXECUTION_),
+ add constraint FK_SWIMLANE_EXEC
+ foreign key (EXECUTION_)
+ references JBPM4_EXECUTION (DBID_);
+
+ create index IDX_TASK_SUPERTASK on JBPM4_TASK (SUPERTASK_);
+
+ alter table JBPM4_TASK
+ add index FK_TASK_SWIML (SWIMLANE_),
+ add constraint FK_TASK_SWIML
+ foreign key (SWIMLANE_)
+ references JBPM4_SWIMLANE (DBID_);
+
+ alter table JBPM4_TASK
+ add index FK_TASK_SUPERTASK (SUPERTASK_),
+ add constraint FK_TASK_SUPERTASK
+ foreign key (SUPERTASK_)
+ references JBPM4_TASK (DBID_);
+
+ create index IDX_VAR_EXESYS on JBPM4_VARIABLE (EXESYS_);
+
+ create index IDX_VAR_TASK on JBPM4_VARIABLE (TASK_);
+
+ create index IDX_VAR_EXECUTION on JBPM4_VARIABLE (EXECUTION_);
+
+ create index IDX_VAR_LOB on JBPM4_VARIABLE (LOB_);
+
+ alter table JBPM4_VARIABLE
+ add index FK_VAR_LOB (LOB_),
+ add constraint FK_VAR_LOB
+ foreign key (LOB_)
+ references JBPM4_LOB (DBID_);
+
+ alter table JBPM4_VARIABLE
+ add index FK_VAR_EXECUTION (EXECUTION_),
+ add constraint FK_VAR_EXECUTION
+ foreign key (EXECUTION_)
+ references JBPM4_EXECUTION (DBID_);
+
+ alter table JBPM4_VARIABLE
+ add index FK_VAR_EXESYS (EXESYS_),
+ add constraint FK_VAR_EXESYS
+ foreign key (EXESYS_)
+ references JBPM4_EXECUTION (DBID_);
+
+ alter table JBPM4_VARIABLE
+ add index FK_VAR_TASK (TASK_),
+ add constraint FK_VAR_TASK
+ foreign key (TASK_)
+ references JBPM4_TASK (DBID_);
Added: jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.oracle.create.sql
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.oracle.create.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.oracle.create.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,466 @@
+
+ create table JBPM4_DEPLOYMENT (
+ DBID_ number(19,0) not null,
+ NAME_ clob,
+ TIMESTAMP_ number(19,0),
+ STATE_ varchar2(255 char),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_DEPLOYPROP (
+ DBID_ number(19,0) not null,
+ DEPLOYMENT_ number(19,0),
+ OBJNAME_ varchar2(255 char),
+ KEY_ varchar2(255 char),
+ STRINGVAL_ varchar2(255 char),
+ LONGVAL_ number(19,0),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_EXECUTION (
+ DBID_ number(19,0) not null,
+ CLASS_ varchar2(255 char) not null,
+ DBVERSION_ number(10,0) not null,
+ ACTIVITYNAME_ varchar2(255 char),
+ PROCDEFID_ varchar2(255 char),
+ HASVARS_ number(1,0),
+ NAME_ varchar2(255 char),
+ KEY_ varchar2(255 char),
+ ID_ varchar2(255 char) unique,
+ STATE_ varchar2(255 char),
+ SUSPHISTSTATE_ varchar2(255 char),
+ PRIORITY_ number(10,0),
+ HISACTINST_ number(19,0),
+ PARENT_ number(19,0),
+ INSTANCE_ number(19,0),
+ SUPEREXEC_ number(19,0),
+ SUBPROCINST_ number(19,0),
+ PARENT_IDX_ number(10,0),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_ACTINST (
+ DBID_ number(19,0) not null,
+ CLASS_ varchar2(255 char) not null,
+ DBVERSION_ number(10,0) not null,
+ HPROCI_ number(19,0),
+ TYPE_ varchar2(255 char),
+ EXECUTION_ varchar2(255 char),
+ ACTIVITY_NAME_ varchar2(255 char),
+ START_ timestamp,
+ END_ timestamp,
+ DURATION_ number(19,0),
+ TRANSITION_ varchar2(255 char),
+ NEXTIDX_ number(10,0),
+ HTASK_ number(19,0),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_DETAIL (
+ DBID_ number(19,0) not null,
+ CLASS_ varchar2(255 char) not null,
+ DBVERSION_ number(10,0) not null,
+ USERID_ varchar2(255 char),
+ TIME_ timestamp,
+ HPROCI_ number(19,0),
+ HPROCIIDX_ number(10,0),
+ HACTI_ number(19,0),
+ HACTIIDX_ number(10,0),
+ HTASK_ number(19,0),
+ HTASKIDX_ number(10,0),
+ HVAR_ number(19,0),
+ HVARIDX_ number(10,0),
+ MESSAGE_ clob,
+ OLD_STR_ varchar2(255 char),
+ NEW_STR_ varchar2(255 char),
+ OLD_INT_ number(10,0),
+ NEW_INT_ number(10,0),
+ OLD_TIME_ timestamp,
+ NEW_TIME_ timestamp,
+ PARENT_ number(19,0),
+ PARENT_IDX_ number(10,0),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_PROCINST (
+ DBID_ number(19,0) not null,
+ DBVERSION_ number(10,0) not null,
+ ID_ varchar2(255 char),
+ PROCDEFID_ varchar2(255 char),
+ KEY_ varchar2(255 char),
+ START_ timestamp,
+ END_ timestamp,
+ DURATION_ number(19,0),
+ STATE_ varchar2(255 char),
+ ENDACTIVITY_ varchar2(255 char),
+ NEXTIDX_ number(10,0),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_TASK (
+ DBID_ number(19,0) not null,
+ DBVERSION_ number(10,0) not null,
+ EXECUTION_ varchar2(255 char),
+ OUTCOME_ varchar2(255 char),
+ ASSIGNEE_ varchar2(255 char),
+ PRIORITY_ number(10,0),
+ STATE_ varchar2(255 char),
+ CREATE_ timestamp,
+ END_ timestamp,
+ DURATION_ number(19,0),
+ NEXTIDX_ number(10,0),
+ SUPERTASK_ number(19,0),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_VAR (
+ DBID_ number(19,0) not null,
+ DBVERSION_ number(10,0) not null,
+ PROCINSTID_ varchar2(255 char),
+ EXECUTIONID_ varchar2(255 char),
+ VARNAME_ varchar2(255 char),
+ VALUE_ varchar2(255 char),
+ HPROCI_ number(19,0),
+ HTASK_ number(19,0),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_ID_GROUP (
+ DBID_ number(19,0) not null,
+ DBVERSION_ number(10,0) not null,
+ ID_ varchar2(255 char),
+ NAME_ varchar2(255 char),
+ TYPE_ varchar2(255 char),
+ PARENT_ number(19,0),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_ID_MEMBERSHIP (
+ DBID_ number(19,0) not null,
+ DBVERSION_ number(10,0) not null,
+ USER_ number(19,0),
+ GROUP_ number(19,0),
+ NAME_ varchar2(255 char),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_ID_USER (
+ DBID_ number(19,0) not null,
+ DBVERSION_ number(10,0) not null,
+ ID_ varchar2(255 char),
+ PASSWORD_ varchar2(255 char),
+ GIVENNAME_ varchar2(255 char),
+ FAMILYNAME_ varchar2(255 char),
+ BUSINESSEMAIL_ varchar2(255 char),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_JOB (
+ DBID_ number(19,0) not null,
+ CLASS_ varchar2(255 char) not null,
+ DBVERSION_ number(10,0) not null,
+ DUEDATE_ timestamp,
+ STATE_ varchar2(255 char),
+ ISEXCLUSIVE_ number(1,0),
+ LOCKOWNER_ varchar2(255 char),
+ LOCKEXPTIME_ timestamp,
+ EXCEPTION_ clob,
+ RETRIES_ number(10,0),
+ PROCESSINSTANCE_ number(19,0),
+ EXECUTION_ number(19,0),
+ CFG_ number(19,0),
+ SIGNAL_ varchar2(255 char),
+ EVENT_ varchar2(255 char),
+ REPEAT_ varchar2(255 char),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_LOB (
+ DBID_ number(19,0) not null,
+ DBVERSION_ number(10,0) not null,
+ BLOB_VALUE_ blob,
+ DEPLOYMENT_ number(19,0),
+ NAME_ clob,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_PARTICIPATION (
+ DBID_ number(19,0) not null,
+ DBVERSION_ number(10,0) not null,
+ GROUPID_ varchar2(255 char),
+ USERID_ varchar2(255 char),
+ TYPE_ varchar2(255 char),
+ TASK_ number(19,0),
+ SWIMLANE_ number(19,0),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_PROPERTY (
+ KEY_ varchar2(255 char) not null,
+ VERSION_ number(10,0) not null,
+ VALUE_ varchar2(255 char),
+ primary key (KEY_)
+ );
+
+ create table JBPM4_SWIMLANE (
+ DBID_ number(19,0) not null,
+ DBVERSION_ number(10,0) not null,
+ NAME_ varchar2(255 char),
+ ASSIGNEE_ varchar2(255 char),
+ EXECUTION_ number(19,0),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_TASK (
+ DBID_ number(19,0) not null,
+ CLASS_ char(1 char) not null,
+ DBVERSION_ number(10,0) not null,
+ NAME_ varchar2(255 char),
+ DESCR_ clob,
+ STATE_ varchar2(255 char),
+ SUSPHISTSTATE_ varchar2(255 char),
+ ASSIGNEE_ varchar2(255 char),
+ FORM_ varchar2(255 char),
+ PRIORITY_ number(10,0),
+ CREATE_ timestamp,
+ DUEDATE_ timestamp,
+ PROGRESS_ number(10,0),
+ SIGNALLING_ number(1,0),
+ EXECUTION_ID_ varchar2(255 char),
+ ACTIVITY_NAME_ varchar2(255 char),
+ HASVARS_ number(1,0),
+ SUPERTASK_ number(19,0),
+ EXECUTION_ number(19,0),
+ PROCINST_ number(19,0),
+ SWIMLANE_ number(19,0),
+ TASKDEFNAME_ varchar2(255 char),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_VARIABLE (
+ DBID_ number(19,0) not null,
+ CLASS_ varchar2(255 char) not null,
+ DBVERSION_ number(10,0) not null,
+ KEY_ varchar2(255 char),
+ CONVERTER_ varchar2(255 char),
+ HIST_ number(1,0),
+ EXECUTION_ number(19,0),
+ TASK_ number(19,0),
+ LOB_ number(19,0),
+ DATE_VALUE_ timestamp,
+ DOUBLE_VALUE_ double precision,
+ CLASSNAME_ varchar2(255 char),
+ LONG_VALUE_ number(19,0),
+ STRING_VALUE_ varchar2(255 char),
+ TEXT_VALUE_ clob,
+ EXESYS_ number(19,0),
+ primary key (DBID_)
+ );
+
+ create index IDX_DEPLPROP_DEPL on JBPM4_DEPLOYPROP (DEPLOYMENT_);
+
+ alter table JBPM4_DEPLOYPROP
+ add constraint FK_DEPLPROP_DEPL
+ foreign key (DEPLOYMENT_)
+ references JBPM4_DEPLOYMENT;
+
+ create index IDX_EXEC_SUPEREXEC on JBPM4_EXECUTION (SUPEREXEC_);
+
+ create index IDX_EXEC_INSTANCE on JBPM4_EXECUTION (INSTANCE_);
+
+ create index IDX_EXEC_SUBPI on JBPM4_EXECUTION (SUBPROCINST_);
+
+ create index IDX_EXEC_PARENT on JBPM4_EXECUTION (PARENT_);
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_PARENT
+ foreign key (PARENT_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_SUBPI
+ foreign key (SUBPROCINST_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_INSTANCE
+ foreign key (INSTANCE_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_SUPEREXEC
+ foreign key (SUPEREXEC_)
+ references JBPM4_EXECUTION;
+
+ create index IDX_HACTI_HPROCI on JBPM4_HIST_ACTINST (HPROCI_);
+
+ create index IDX_HTI_HTASK on JBPM4_HIST_ACTINST (HTASK_);
+
+ alter table JBPM4_HIST_ACTINST
+ add constraint FK_HACTI_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST;
+
+ alter table JBPM4_HIST_ACTINST
+ add constraint FK_HTI_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK;
+
+ create index IDX_HDET_HACTI on JBPM4_HIST_DETAIL (HACTI_);
+
+ create index IDX_HDET_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);
+
+ create index IDX_HDETAIL_HACTI on JBPM4_HIST_DETAIL (HACTI_);
+
+ create index IDX_HDETAIL_HVAR on JBPM4_HIST_DETAIL (HVAR_);
+
+ create index IDX_HDETAIL_HTASK on JBPM4_HIST_DETAIL (HTASK_);
+
+ create index IDX_HDETAIL_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);
+
+ create index IDX_HDET_HVAR on JBPM4_HIST_DETAIL (HVAR_);
+
+ create index IDX_HDET_HTASK on JBPM4_HIST_DETAIL (HTASK_);
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST;
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HACTI
+ foreign key (HACTI_)
+ references JBPM4_HIST_ACTINST;
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK;
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HVAR
+ foreign key (HVAR_)
+ references JBPM4_HIST_VAR;
+
+ alter table JBPM4_HIST_TASK
+ add constraint FK_HSUPERT_SUB
+ foreign key (SUPERTASK_)
+ references JBPM4_HIST_TASK;
+
+ create index IDX_HVAR_HPROCI on JBPM4_HIST_VAR (HPROCI_);
+
+ create index IDX_HVAR_HTASK on JBPM4_HIST_VAR (HTASK_);
+
+ alter table JBPM4_HIST_VAR
+ add constraint FK_HVAR_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST;
+
+ alter table JBPM4_HIST_VAR
+ add constraint FK_HVAR_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK;
+
+ create index IDX_GROUP_PARENT on JBPM4_ID_GROUP (PARENT_);
+
+ alter table JBPM4_ID_GROUP
+ add constraint FK_GROUP_PARENT
+ foreign key (PARENT_)
+ references JBPM4_ID_GROUP;
+
+ create index IDX_MEM_USER on JBPM4_ID_MEMBERSHIP (USER_);
+
+ create index IDX_MEM_GROUP on JBPM4_ID_MEMBERSHIP (GROUP_);
+
+ alter table JBPM4_ID_MEMBERSHIP
+ add constraint FK_MEM_GROUP
+ foreign key (GROUP_)
+ references JBPM4_ID_GROUP;
+
+ alter table JBPM4_ID_MEMBERSHIP
+ add constraint FK_MEM_USER
+ foreign key (USER_)
+ references JBPM4_ID_USER;
+
+ create index IDX_JOBRETRIES on JBPM4_JOB (RETRIES_);
+
+ create index IDX_JOB_CFG on JBPM4_JOB (CFG_);
+
+ create index IDX_JOB_PRINST on JBPM4_JOB (PROCESSINSTANCE_);
+
+ create index IDX_JOB_EXE on JBPM4_JOB (EXECUTION_);
+
+ create index IDX_JOBLOCKEXP on JBPM4_JOB (LOCKEXPTIME_);
+
+ create index IDX_JOBDUEDATE on JBPM4_JOB (DUEDATE_);
+
+ alter table JBPM4_JOB
+ add constraint FK_JOB_CFG
+ foreign key (CFG_)
+ references JBPM4_LOB;
+
+ create index IDX_LOB_DEPLOYMENT on JBPM4_LOB (DEPLOYMENT_);
+
+ alter table JBPM4_LOB
+ add constraint FK_LOB_DEPLOYMENT
+ foreign key (DEPLOYMENT_)
+ references JBPM4_DEPLOYMENT;
+
+ create index IDX_PART_TASK on JBPM4_PARTICIPATION (TASK_);
+
+ alter table JBPM4_PARTICIPATION
+ add constraint FK_PART_SWIMLANE
+ foreign key (SWIMLANE_)
+ references JBPM4_SWIMLANE;
+
+ alter table JBPM4_PARTICIPATION
+ add constraint FK_PART_TASK
+ foreign key (TASK_)
+ references JBPM4_TASK;
+
+ create index IDX_SWIMLANE_EXEC on JBPM4_SWIMLANE (EXECUTION_);
+
+ alter table JBPM4_SWIMLANE
+ add constraint FK_SWIMLANE_EXEC
+ foreign key (EXECUTION_)
+ references JBPM4_EXECUTION;
+
+ create index IDX_TASK_SUPERTASK on JBPM4_TASK (SUPERTASK_);
+
+ alter table JBPM4_TASK
+ add constraint FK_TASK_SWIML
+ foreign key (SWIMLANE_)
+ references JBPM4_SWIMLANE;
+
+ alter table JBPM4_TASK
+ add constraint FK_TASK_SUPERTASK
+ foreign key (SUPERTASK_)
+ references JBPM4_TASK;
+
+ create index IDX_VAR_EXESYS on JBPM4_VARIABLE (EXESYS_);
+
+ create index IDX_VAR_TASK on JBPM4_VARIABLE (TASK_);
+
+ create index IDX_VAR_EXECUTION on JBPM4_VARIABLE (EXECUTION_);
+
+ create index IDX_VAR_LOB on JBPM4_VARIABLE (LOB_);
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_LOB
+ foreign key (LOB_)
+ references JBPM4_LOB;
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_EXECUTION
+ foreign key (EXECUTION_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_EXESYS
+ foreign key (EXESYS_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_TASK
+ foreign key (TASK_)
+ references JBPM4_TASK;
Added: jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.postgresql.create.sql
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.postgresql.create.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.postgresql.create.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,466 @@
+
+ create table JBPM4_DEPLOYMENT (
+ DBID_ int8 not null,
+ NAME_ text,
+ TIMESTAMP_ int8,
+ STATE_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_DEPLOYPROP (
+ DBID_ int8 not null,
+ DEPLOYMENT_ int8,
+ OBJNAME_ varchar(255),
+ KEY_ varchar(255),
+ STRINGVAL_ varchar(255),
+ LONGVAL_ int8,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_EXECUTION (
+ DBID_ int8 not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ int4 not null,
+ ACTIVITYNAME_ varchar(255),
+ PROCDEFID_ varchar(255),
+ HASVARS_ bool,
+ NAME_ varchar(255),
+ KEY_ varchar(255),
+ ID_ varchar(255) unique,
+ STATE_ varchar(255),
+ SUSPHISTSTATE_ varchar(255),
+ PRIORITY_ int4,
+ HISACTINST_ int8,
+ PARENT_ int8,
+ INSTANCE_ int8,
+ SUPEREXEC_ int8,
+ SUBPROCINST_ int8,
+ PARENT_IDX_ int4,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_ACTINST (
+ DBID_ int8 not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ int4 not null,
+ HPROCI_ int8,
+ TYPE_ varchar(255),
+ EXECUTION_ varchar(255),
+ ACTIVITY_NAME_ varchar(255),
+ START_ timestamp,
+ END_ timestamp,
+ DURATION_ int8,
+ TRANSITION_ varchar(255),
+ NEXTIDX_ int4,
+ HTASK_ int8,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_DETAIL (
+ DBID_ int8 not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ int4 not null,
+ USERID_ varchar(255),
+ TIME_ timestamp,
+ HPROCI_ int8,
+ HPROCIIDX_ int4,
+ HACTI_ int8,
+ HACTIIDX_ int4,
+ HTASK_ int8,
+ HTASKIDX_ int4,
+ HVAR_ int8,
+ HVARIDX_ int4,
+ MESSAGE_ text,
+ OLD_STR_ varchar(255),
+ NEW_STR_ varchar(255),
+ OLD_INT_ int4,
+ NEW_INT_ int4,
+ OLD_TIME_ timestamp,
+ NEW_TIME_ timestamp,
+ PARENT_ int8,
+ PARENT_IDX_ int4,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_PROCINST (
+ DBID_ int8 not null,
+ DBVERSION_ int4 not null,
+ ID_ varchar(255),
+ PROCDEFID_ varchar(255),
+ KEY_ varchar(255),
+ START_ timestamp,
+ END_ timestamp,
+ DURATION_ int8,
+ STATE_ varchar(255),
+ ENDACTIVITY_ varchar(255),
+ NEXTIDX_ int4,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_TASK (
+ DBID_ int8 not null,
+ DBVERSION_ int4 not null,
+ EXECUTION_ varchar(255),
+ OUTCOME_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ PRIORITY_ int4,
+ STATE_ varchar(255),
+ CREATE_ timestamp,
+ END_ timestamp,
+ DURATION_ int8,
+ NEXTIDX_ int4,
+ SUPERTASK_ int8,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_VAR (
+ DBID_ int8 not null,
+ DBVERSION_ int4 not null,
+ PROCINSTID_ varchar(255),
+ EXECUTIONID_ varchar(255),
+ VARNAME_ varchar(255),
+ VALUE_ varchar(255),
+ HPROCI_ int8,
+ HTASK_ int8,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_ID_GROUP (
+ DBID_ int8 not null,
+ DBVERSION_ int4 not null,
+ ID_ varchar(255),
+ NAME_ varchar(255),
+ TYPE_ varchar(255),
+ PARENT_ int8,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_ID_MEMBERSHIP (
+ DBID_ int8 not null,
+ DBVERSION_ int4 not null,
+ USER_ int8,
+ GROUP_ int8,
+ NAME_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_ID_USER (
+ DBID_ int8 not null,
+ DBVERSION_ int4 not null,
+ ID_ varchar(255),
+ PASSWORD_ varchar(255),
+ GIVENNAME_ varchar(255),
+ FAMILYNAME_ varchar(255),
+ BUSINESSEMAIL_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_JOB (
+ DBID_ int8 not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ int4 not null,
+ DUEDATE_ timestamp,
+ STATE_ varchar(255),
+ ISEXCLUSIVE_ bool,
+ LOCKOWNER_ varchar(255),
+ LOCKEXPTIME_ timestamp,
+ EXCEPTION_ text,
+ RETRIES_ int4,
+ PROCESSINSTANCE_ int8,
+ EXECUTION_ int8,
+ CFG_ int8,
+ SIGNAL_ varchar(255),
+ EVENT_ varchar(255),
+ REPEAT_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_LOB (
+ DBID_ int8 not null,
+ DBVERSION_ int4 not null,
+ BLOB_VALUE_ oid,
+ DEPLOYMENT_ int8,
+ NAME_ text,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_PARTICIPATION (
+ DBID_ int8 not null,
+ DBVERSION_ int4 not null,
+ GROUPID_ varchar(255),
+ USERID_ varchar(255),
+ TYPE_ varchar(255),
+ TASK_ int8,
+ SWIMLANE_ int8,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_PROPERTY (
+ KEY_ varchar(255) not null,
+ VERSION_ int4 not null,
+ VALUE_ varchar(255),
+ primary key (KEY_)
+ );
+
+ create table JBPM4_SWIMLANE (
+ DBID_ int8 not null,
+ DBVERSION_ int4 not null,
+ NAME_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ EXECUTION_ int8,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_TASK (
+ DBID_ int8 not null,
+ CLASS_ char(1) not null,
+ DBVERSION_ int4 not null,
+ NAME_ varchar(255),
+ DESCR_ text,
+ STATE_ varchar(255),
+ SUSPHISTSTATE_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ FORM_ varchar(255),
+ PRIORITY_ int4,
+ CREATE_ timestamp,
+ DUEDATE_ timestamp,
+ PROGRESS_ int4,
+ SIGNALLING_ bool,
+ EXECUTION_ID_ varchar(255),
+ ACTIVITY_NAME_ varchar(255),
+ HASVARS_ bool,
+ SUPERTASK_ int8,
+ EXECUTION_ int8,
+ PROCINST_ int8,
+ SWIMLANE_ int8,
+ TASKDEFNAME_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_VARIABLE (
+ DBID_ int8 not null,
+ CLASS_ varchar(255) not null,
+ DBVERSION_ int4 not null,
+ KEY_ varchar(255),
+ CONVERTER_ varchar(255),
+ HIST_ bool,
+ EXECUTION_ int8,
+ TASK_ int8,
+ LOB_ int8,
+ DATE_VALUE_ timestamp,
+ DOUBLE_VALUE_ float8,
+ CLASSNAME_ varchar(255),
+ LONG_VALUE_ int8,
+ STRING_VALUE_ varchar(255),
+ TEXT_VALUE_ text,
+ EXESYS_ int8,
+ primary key (DBID_)
+ );
+
+ create index IDX_DEPLPROP_DEPL on JBPM4_DEPLOYPROP (DEPLOYMENT_);
+
+ alter table JBPM4_DEPLOYPROP
+ add constraint FK_DEPLPROP_DEPL
+ foreign key (DEPLOYMENT_)
+ references JBPM4_DEPLOYMENT;
+
+ create index IDX_EXEC_SUPEREXEC on JBPM4_EXECUTION (SUPEREXEC_);
+
+ create index IDX_EXEC_INSTANCE on JBPM4_EXECUTION (INSTANCE_);
+
+ create index IDX_EXEC_SUBPI on JBPM4_EXECUTION (SUBPROCINST_);
+
+ create index IDX_EXEC_PARENT on JBPM4_EXECUTION (PARENT_);
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_PARENT
+ foreign key (PARENT_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_SUBPI
+ foreign key (SUBPROCINST_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_INSTANCE
+ foreign key (INSTANCE_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_SUPEREXEC
+ foreign key (SUPEREXEC_)
+ references JBPM4_EXECUTION;
+
+ create index IDX_HACTI_HPROCI on JBPM4_HIST_ACTINST (HPROCI_);
+
+ create index IDX_HTI_HTASK on JBPM4_HIST_ACTINST (HTASK_);
+
+ alter table JBPM4_HIST_ACTINST
+ add constraint FK_HACTI_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST;
+
+ alter table JBPM4_HIST_ACTINST
+ add constraint FK_HTI_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK;
+
+ create index IDX_HDET_HACTI on JBPM4_HIST_DETAIL (HACTI_);
+
+ create index IDX_HDET_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);
+
+ create index IDX_HDETAIL_HACTI on JBPM4_HIST_DETAIL (HACTI_);
+
+ create index IDX_HDETAIL_HVAR on JBPM4_HIST_DETAIL (HVAR_);
+
+ create index IDX_HDETAIL_HTASK on JBPM4_HIST_DETAIL (HTASK_);
+
+ create index IDX_HDETAIL_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);
+
+ create index IDX_HDET_HVAR on JBPM4_HIST_DETAIL (HVAR_);
+
+ create index IDX_HDET_HTASK on JBPM4_HIST_DETAIL (HTASK_);
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST;
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HACTI
+ foreign key (HACTI_)
+ references JBPM4_HIST_ACTINST;
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK;
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HVAR
+ foreign key (HVAR_)
+ references JBPM4_HIST_VAR;
+
+ alter table JBPM4_HIST_TASK
+ add constraint FK_HSUPERT_SUB
+ foreign key (SUPERTASK_)
+ references JBPM4_HIST_TASK;
+
+ create index IDX_HVAR_HPROCI on JBPM4_HIST_VAR (HPROCI_);
+
+ create index IDX_HVAR_HTASK on JBPM4_HIST_VAR (HTASK_);
+
+ alter table JBPM4_HIST_VAR
+ add constraint FK_HVAR_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST;
+
+ alter table JBPM4_HIST_VAR
+ add constraint FK_HVAR_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK;
+
+ create index IDX_GROUP_PARENT on JBPM4_ID_GROUP (PARENT_);
+
+ alter table JBPM4_ID_GROUP
+ add constraint FK_GROUP_PARENT
+ foreign key (PARENT_)
+ references JBPM4_ID_GROUP;
+
+ create index IDX_MEM_USER on JBPM4_ID_MEMBERSHIP (USER_);
+
+ create index IDX_MEM_GROUP on JBPM4_ID_MEMBERSHIP (GROUP_);
+
+ alter table JBPM4_ID_MEMBERSHIP
+ add constraint FK_MEM_GROUP
+ foreign key (GROUP_)
+ references JBPM4_ID_GROUP;
+
+ alter table JBPM4_ID_MEMBERSHIP
+ add constraint FK_MEM_USER
+ foreign key (USER_)
+ references JBPM4_ID_USER;
+
+ create index IDX_JOBRETRIES on JBPM4_JOB (RETRIES_);
+
+ create index IDX_JOB_CFG on JBPM4_JOB (CFG_);
+
+ create index IDX_JOB_PRINST on JBPM4_JOB (PROCESSINSTANCE_);
+
+ create index IDX_JOB_EXE on JBPM4_JOB (EXECUTION_);
+
+ create index IDX_JOBLOCKEXP on JBPM4_JOB (LOCKEXPTIME_);
+
+ create index IDX_JOBDUEDATE on JBPM4_JOB (DUEDATE_);
+
+ alter table JBPM4_JOB
+ add constraint FK_JOB_CFG
+ foreign key (CFG_)
+ references JBPM4_LOB;
+
+ create index IDX_LOB_DEPLOYMENT on JBPM4_LOB (DEPLOYMENT_);
+
+ alter table JBPM4_LOB
+ add constraint FK_LOB_DEPLOYMENT
+ foreign key (DEPLOYMENT_)
+ references JBPM4_DEPLOYMENT;
+
+ create index IDX_PART_TASK on JBPM4_PARTICIPATION (TASK_);
+
+ alter table JBPM4_PARTICIPATION
+ add constraint FK_PART_SWIMLANE
+ foreign key (SWIMLANE_)
+ references JBPM4_SWIMLANE;
+
+ alter table JBPM4_PARTICIPATION
+ add constraint FK_PART_TASK
+ foreign key (TASK_)
+ references JBPM4_TASK;
+
+ create index IDX_SWIMLANE_EXEC on JBPM4_SWIMLANE (EXECUTION_);
+
+ alter table JBPM4_SWIMLANE
+ add constraint FK_SWIMLANE_EXEC
+ foreign key (EXECUTION_)
+ references JBPM4_EXECUTION;
+
+ create index IDX_TASK_SUPERTASK on JBPM4_TASK (SUPERTASK_);
+
+ alter table JBPM4_TASK
+ add constraint FK_TASK_SWIML
+ foreign key (SWIMLANE_)
+ references JBPM4_SWIMLANE;
+
+ alter table JBPM4_TASK
+ add constraint FK_TASK_SUPERTASK
+ foreign key (SUPERTASK_)
+ references JBPM4_TASK;
+
+ create index IDX_VAR_EXESYS on JBPM4_VARIABLE (EXESYS_);
+
+ create index IDX_VAR_TASK on JBPM4_VARIABLE (TASK_);
+
+ create index IDX_VAR_EXECUTION on JBPM4_VARIABLE (EXECUTION_);
+
+ create index IDX_VAR_LOB on JBPM4_VARIABLE (LOB_);
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_LOB
+ foreign key (LOB_)
+ references JBPM4_LOB;
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_EXECUTION
+ foreign key (EXECUTION_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_EXESYS
+ foreign key (EXESYS_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_TASK
+ foreign key (TASK_)
+ references JBPM4_TASK;
Added: jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.hsqldb.drop.sql
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.hsqldb.drop.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.hsqldb.drop.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,120 @@
+
+ alter table JBPM4_DEPLOYPROP
+ drop constraint FK_DEPLPROP_DEPL;
+
+ alter table JBPM4_EXECUTION
+ drop constraint FK_EXEC_PARENT;
+
+ alter table JBPM4_EXECUTION
+ drop constraint FK_EXEC_SUBPI;
+
+ alter table JBPM4_EXECUTION
+ drop constraint FK_EXEC_INSTANCE;
+
+ alter table JBPM4_EXECUTION
+ drop constraint FK_EXEC_SUPEREXEC;
+
+ alter table JBPM4_HIST_ACTINST
+ drop constraint FK_HACTI_HPROCI;
+
+ alter table JBPM4_HIST_ACTINST
+ drop constraint FK_HTI_HTASK;
+
+ alter table JBPM4_HIST_DETAIL
+ drop constraint FK_HDETAIL_HPROCI;
+
+ alter table JBPM4_HIST_DETAIL
+ drop constraint FK_HDETAIL_HACTI;
+
+ alter table JBPM4_HIST_DETAIL
+ drop constraint FK_HDETAIL_HTASK;
+
+ alter table JBPM4_HIST_DETAIL
+ drop constraint FK_HDETAIL_HVAR;
+
+ alter table JBPM4_HIST_TASK
+ drop constraint FK_HSUPERT_SUB;
+
+ alter table JBPM4_HIST_VAR
+ drop constraint FK_HVAR_HPROCI;
+
+ alter table JBPM4_HIST_VAR
+ drop constraint FK_HVAR_HTASK;
+
+ alter table JBPM4_ID_GROUP
+ drop constraint FK_GROUP_PARENT;
+
+ alter table JBPM4_ID_MEMBERSHIP
+ drop constraint FK_MEM_GROUP;
+
+ alter table JBPM4_ID_MEMBERSHIP
+ drop constraint FK_MEM_USER;
+
+ alter table JBPM4_JOB
+ drop constraint FK_JOB_CFG;
+
+ alter table JBPM4_LOB
+ drop constraint FK_LOB_DEPLOYMENT;
+
+ alter table JBPM4_PARTICIPATION
+ drop constraint FK_PART_SWIMLANE;
+
+ alter table JBPM4_PARTICIPATION
+ drop constraint FK_PART_TASK;
+
+ alter table JBPM4_SWIMLANE
+ drop constraint FK_SWIMLANE_EXEC;
+
+ alter table JBPM4_TASK
+ drop constraint FK_TASK_SWIML;
+
+ alter table JBPM4_TASK
+ drop constraint FK_TASK_SUPERTASK;
+
+ alter table JBPM4_VARIABLE
+ drop constraint FK_VAR_LOB;
+
+ alter table JBPM4_VARIABLE
+ drop constraint FK_VAR_EXECUTION;
+
+ alter table JBPM4_VARIABLE
+ drop constraint FK_VAR_EXESYS;
+
+ alter table JBPM4_VARIABLE
+ drop constraint FK_VAR_TASK;
+
+ drop table JBPM4_DEPLOYMENT if exists;
+
+ drop table JBPM4_DEPLOYPROP if exists;
+
+ drop table JBPM4_EXECUTION if exists;
+
+ drop table JBPM4_HIST_ACTINST if exists;
+
+ drop table JBPM4_HIST_DETAIL if exists;
+
+ drop table JBPM4_HIST_PROCINST if exists;
+
+ drop table JBPM4_HIST_TASK if exists;
+
+ drop table JBPM4_HIST_VAR if exists;
+
+ drop table JBPM4_ID_GROUP if exists;
+
+ drop table JBPM4_ID_MEMBERSHIP if exists;
+
+ drop table JBPM4_ID_USER if exists;
+
+ drop table JBPM4_JOB if exists;
+
+ drop table JBPM4_LOB if exists;
+
+ drop table JBPM4_PARTICIPATION if exists;
+
+ drop table JBPM4_PROPERTY if exists;
+
+ drop table JBPM4_SWIMLANE if exists;
+
+ drop table JBPM4_TASK if exists;
+
+ drop table JBPM4_VARIABLE if exists;
Added: jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.mysql.drop.sql
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.mysql.drop.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.mysql.drop.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,148 @@
+
+ alter table JBPM4_DEPLOYPROP
+ drop
+ foreign key FK_DEPLPROP_DEPL;
+
+ alter table JBPM4_EXECUTION
+ drop
+ foreign key FK_EXEC_PARENT;
+
+ alter table JBPM4_EXECUTION
+ drop
+ foreign key FK_EXEC_SUBPI;
+
+ alter table JBPM4_EXECUTION
+ drop
+ foreign key FK_EXEC_INSTANCE;
+
+ alter table JBPM4_EXECUTION
+ drop
+ foreign key FK_EXEC_SUPEREXEC;
+
+ alter table JBPM4_HIST_ACTINST
+ drop
+ foreign key FK_HACTI_HPROCI;
+
+ alter table JBPM4_HIST_ACTINST
+ drop
+ foreign key FK_HTI_HTASK;
+
+ alter table JBPM4_HIST_DETAIL
+ drop
+ foreign key FK_HDETAIL_HPROCI;
+
+ alter table JBPM4_HIST_DETAIL
+ drop
+ foreign key FK_HDETAIL_HACTI;
+
+ alter table JBPM4_HIST_DETAIL
+ drop
+ foreign key FK_HDETAIL_HTASK;
+
+ alter table JBPM4_HIST_DETAIL
+ drop
+ foreign key FK_HDETAIL_HVAR;
+
+ alter table JBPM4_HIST_TASK
+ drop
+ foreign key FK_HSUPERT_SUB;
+
+ alter table JBPM4_HIST_VAR
+ drop
+ foreign key FK_HVAR_HPROCI;
+
+ alter table JBPM4_HIST_VAR
+ drop
+ foreign key FK_HVAR_HTASK;
+
+ alter table JBPM4_ID_GROUP
+ drop
+ foreign key FK_GROUP_PARENT;
+
+ alter table JBPM4_ID_MEMBERSHIP
+ drop
+ foreign key FK_MEM_GROUP;
+
+ alter table JBPM4_ID_MEMBERSHIP
+ drop
+ foreign key FK_MEM_USER;
+
+ alter table JBPM4_JOB
+ drop
+ foreign key FK_JOB_CFG;
+
+ alter table JBPM4_LOB
+ drop
+ foreign key FK_LOB_DEPLOYMENT;
+
+ alter table JBPM4_PARTICIPATION
+ drop
+ foreign key FK_PART_SWIMLANE;
+
+ alter table JBPM4_PARTICIPATION
+ drop
+ foreign key FK_PART_TASK;
+
+ alter table JBPM4_SWIMLANE
+ drop
+ foreign key FK_SWIMLANE_EXEC;
+
+ alter table JBPM4_TASK
+ drop
+ foreign key FK_TASK_SWIML;
+
+ alter table JBPM4_TASK
+ drop
+ foreign key FK_TASK_SUPERTASK;
+
+ alter table JBPM4_VARIABLE
+ drop
+ foreign key FK_VAR_LOB;
+
+ alter table JBPM4_VARIABLE
+ drop
+ foreign key FK_VAR_EXECUTION;
+
+ alter table JBPM4_VARIABLE
+ drop
+ foreign key FK_VAR_EXESYS;
+
+ alter table JBPM4_VARIABLE
+ drop
+ foreign key FK_VAR_TASK;
+
+ drop table if exists JBPM4_DEPLOYMENT;
+
+ drop table if exists JBPM4_DEPLOYPROP;
+
+ drop table if exists JBPM4_EXECUTION;
+
+ drop table if exists JBPM4_HIST_ACTINST;
+
+ drop table if exists JBPM4_HIST_DETAIL;
+
+ drop table if exists JBPM4_HIST_PROCINST;
+
+ drop table if exists JBPM4_HIST_TASK;
+
+ drop table if exists JBPM4_HIST_VAR;
+
+ drop table if exists JBPM4_ID_GROUP;
+
+ drop table if exists JBPM4_ID_MEMBERSHIP;
+
+ drop table if exists JBPM4_ID_USER;
+
+ drop table if exists JBPM4_JOB;
+
+ drop table if exists JBPM4_LOB;
+
+ drop table if exists JBPM4_PARTICIPATION;
+
+ drop table if exists JBPM4_PROPERTY;
+
+ drop table if exists JBPM4_SWIMLANE;
+
+ drop table if exists JBPM4_TASK;
+
+ drop table if exists JBPM4_VARIABLE;
Added: jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.oracle.drop.sql
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.oracle.drop.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.oracle.drop.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,36 @@
+
+ drop table JBPM4_DEPLOYMENT cascade constraints;
+
+ drop table JBPM4_DEPLOYPROP cascade constraints;
+
+ drop table JBPM4_EXECUTION cascade constraints;
+
+ drop table JBPM4_HIST_ACTINST cascade constraints;
+
+ drop table JBPM4_HIST_DETAIL cascade constraints;
+
+ drop table JBPM4_HIST_PROCINST cascade constraints;
+
+ drop table JBPM4_HIST_TASK cascade constraints;
+
+ drop table JBPM4_HIST_VAR cascade constraints;
+
+ drop table JBPM4_ID_GROUP cascade constraints;
+
+ drop table JBPM4_ID_MEMBERSHIP cascade constraints;
+
+ drop table JBPM4_ID_USER cascade constraints;
+
+ drop table JBPM4_JOB cascade constraints;
+
+ drop table JBPM4_LOB cascade constraints;
+
+ drop table JBPM4_PARTICIPATION cascade constraints;
+
+ drop table JBPM4_PROPERTY cascade constraints;
+
+ drop table JBPM4_SWIMLANE cascade constraints;
+
+ drop table JBPM4_TASK cascade constraints;
+
+ drop table JBPM4_VARIABLE cascade constraints;
Added: jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.postgresql.drop.sql
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.postgresql.drop.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/drop/jbpm.postgresql.drop.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,120 @@
+
+ alter table JBPM4_DEPLOYPROP
+ drop constraint FK_DEPLPROP_DEPL;
+
+ alter table JBPM4_EXECUTION
+ drop constraint FK_EXEC_PARENT;
+
+ alter table JBPM4_EXECUTION
+ drop constraint FK_EXEC_SUBPI;
+
+ alter table JBPM4_EXECUTION
+ drop constraint FK_EXEC_INSTANCE;
+
+ alter table JBPM4_EXECUTION
+ drop constraint FK_EXEC_SUPEREXEC;
+
+ alter table JBPM4_HIST_ACTINST
+ drop constraint FK_HACTI_HPROCI;
+
+ alter table JBPM4_HIST_ACTINST
+ drop constraint FK_HTI_HTASK;
+
+ alter table JBPM4_HIST_DETAIL
+ drop constraint FK_HDETAIL_HPROCI;
+
+ alter table JBPM4_HIST_DETAIL
+ drop constraint FK_HDETAIL_HACTI;
+
+ alter table JBPM4_HIST_DETAIL
+ drop constraint FK_HDETAIL_HTASK;
+
+ alter table JBPM4_HIST_DETAIL
+ drop constraint FK_HDETAIL_HVAR;
+
+ alter table JBPM4_HIST_TASK
+ drop constraint FK_HSUPERT_SUB;
+
+ alter table JBPM4_HIST_VAR
+ drop constraint FK_HVAR_HPROCI;
+
+ alter table JBPM4_HIST_VAR
+ drop constraint FK_HVAR_HTASK;
+
+ alter table JBPM4_ID_GROUP
+ drop constraint FK_GROUP_PARENT;
+
+ alter table JBPM4_ID_MEMBERSHIP
+ drop constraint FK_MEM_GROUP;
+
+ alter table JBPM4_ID_MEMBERSHIP
+ drop constraint FK_MEM_USER;
+
+ alter table JBPM4_JOB
+ drop constraint FK_JOB_CFG;
+
+ alter table JBPM4_LOB
+ drop constraint FK_LOB_DEPLOYMENT;
+
+ alter table JBPM4_PARTICIPATION
+ drop constraint FK_PART_SWIMLANE;
+
+ alter table JBPM4_PARTICIPATION
+ drop constraint FK_PART_TASK;
+
+ alter table JBPM4_SWIMLANE
+ drop constraint FK_SWIMLANE_EXEC;
+
+ alter table JBPM4_TASK
+ drop constraint FK_TASK_SWIML;
+
+ alter table JBPM4_TASK
+ drop constraint FK_TASK_SUPERTASK;
+
+ alter table JBPM4_VARIABLE
+ drop constraint FK_VAR_LOB;
+
+ alter table JBPM4_VARIABLE
+ drop constraint FK_VAR_EXECUTION;
+
+ alter table JBPM4_VARIABLE
+ drop constraint FK_VAR_EXESYS;
+
+ alter table JBPM4_VARIABLE
+ drop constraint FK_VAR_TASK;
+
+ drop table JBPM4_DEPLOYMENT;
+
+ drop table JBPM4_DEPLOYPROP;
+
+ drop table JBPM4_EXECUTION;
+
+ drop table JBPM4_HIST_ACTINST;
+
+ drop table JBPM4_HIST_DETAIL;
+
+ drop table JBPM4_HIST_PROCINST;
+
+ drop table JBPM4_HIST_TASK;
+
+ drop table JBPM4_HIST_VAR;
+
+ drop table JBPM4_ID_GROUP;
+
+ drop table JBPM4_ID_MEMBERSHIP;
+
+ drop table JBPM4_ID_USER;
+
+ drop table JBPM4_JOB;
+
+ drop table JBPM4_LOB;
+
+ drop table JBPM4_PARTICIPATION;
+
+ drop table JBPM4_PROPERTY;
+
+ drop table JBPM4_SWIMLANE;
+
+ drop table JBPM4_TASK;
+
+ drop table JBPM4_VARIABLE;
Copied: jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql (from rev 5766, jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql)
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,3 @@
+
+ alter table JBPM4_VARIABLE
+ add column CLASSNAME_ varchar(255);
Copied: jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql (from rev 5766, jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql)
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,3 @@
+
+ alter table JBPM4_VARIABLE
+ add column CLASSNAME_ varchar(255);
Copied: jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql (from rev 5766, jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql)
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,3 @@
+
+ alter table JBPM4_VARIABLE
+ add CLASSNAME_ varchar2(255 char);
Copied: jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql (from rev 5766, jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql)
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,3 @@
+
+ alter table JBPM4_VARIABLE
+ add column CLASSNAME_ varchar(255);
Copied: jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.hsqldb.upgrade.sql (from rev 5766, jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.hsqldb.upgrade.sql)
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.hsqldb.upgrade.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.hsqldb.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,6 @@
+create table JBPM4_PROPERTY (
+ KEY_ varchar(255) not null,
+ VERSION_ integer not null,
+ VALUE_ varchar(255),
+ primary key (KEY_)
+);
Copied: jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.mysql.upgrade.sql (from rev 5766, jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.mysql.upgrade.sql)
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.mysql.upgrade.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.mysql.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,7 @@
+
+ create table JBPM4_PROPERTY (
+ KEY_ varchar(255) not null,
+ VERSION_ integer not null,
+ VALUE_ varchar(255),
+ primary key (KEY_)
+ ) type=InnoDB;
Copied: jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.oracle.upgrade.sql (from rev 5766, jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.oracle.upgrade.sql)
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.oracle.upgrade.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.oracle.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,7 @@
+
+ create table JBPM4_PROPERTY (
+ KEY_ varchar2(255 char) not null,
+ VERSION_ number(10,0) not null,
+ VALUE_ varchar2(255 char),
+ primary key (KEY_)
+ );
Copied: jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.postgresql.upgrade.sql (from rev 5766, jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.1-to-4.2/jbpm.postgresql.upgrade.sql)
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.postgresql.upgrade.sql (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/upgrade-4.1-to-4.2/jbpm.postgresql.upgrade.sql 2009-10-21 16:26:54 UTC (rev 5767)
@@ -0,0 +1,7 @@
+
+ create table JBPM4_PROPERTY (
+ KEY_ varchar(255) not null,
+ VERSION_ int4 not null,
+ VALUE_ varchar(255),
+ primary key (KEY_)
+ );
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-10-21 11:13:32 UTC (rev 5766)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-10-21 16:26:54 UTC (rev 5767)
@@ -23,10 +23,7 @@
import java.io.ByteArrayInputStream;
import java.io.StringWriter;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -45,7 +42,6 @@
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
/**
@@ -63,6 +59,10 @@
super(jpdlExtension, jpdlParser);
}
+ protected String getProcessLanguageId() {
+ return "";
+ }
+
public void updateResource(DeploymentImpl deployment, String resourceName, byte[] bytes) {
if (resourceName.endsWith(".jpdl.xml")) {
Document document = parser
16 years, 6 months
JBoss JBPM SVN: r5766 - in jbpm4/trunk/modules/db/src/main/resources/db: upgrade-4.0-to-4.1 and 1 other directory.
by do-not-reply@jboss.org
Author: jbarrez
Date: 2009-10-21 07:13:32 -0400 (Wed, 21 Oct 2009)
New Revision: 5766
Added:
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql
jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql
Log:
Added generated upgrade scripts 4.0-4.1
Added: jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql (rev 0)
+++ jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.hsqldb.upgrade.sql 2009-10-21 11:13:32 UTC (rev 5766)
@@ -0,0 +1,3 @@
+
+ alter table JBPM4_VARIABLE
+ add column CLASSNAME_ varchar(255);
Added: jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql (rev 0)
+++ jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.mysql.upgrade.sql 2009-10-21 11:13:32 UTC (rev 5766)
@@ -0,0 +1,3 @@
+
+ alter table JBPM4_VARIABLE
+ add column CLASSNAME_ varchar(255);
Added: jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql (rev 0)
+++ jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.oracle.upgrade.sql 2009-10-21 11:13:32 UTC (rev 5766)
@@ -0,0 +1,3 @@
+
+ alter table JBPM4_VARIABLE
+ add CLASSNAME_ varchar2(255 char);
Added: jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql (rev 0)
+++ jbpm4/trunk/modules/db/src/main/resources/db/upgrade-4.0-to-4.1/jbpm.postgresql.upgrade.sql 2009-10-21 11:13:32 UTC (rev 5766)
@@ -0,0 +1,3 @@
+
+ alter table JBPM4_VARIABLE
+ add column CLASSNAME_ varchar(255);
16 years, 6 months
JBoss JBPM SVN: r5765 - in jbpm4/trunk/modules: db/src/main/java/org/jbpm/db/internal and 3 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-21 05:33:36 -0400 (Wed, 21 Oct 2009)
New Revision: 5765
Added:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
Removed:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/
Modified:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java
jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java
jbpm4/trunk/modules/distro/src/main/files/install/build.xml
Log:
JBPM-2509 database upgrade work. refactored ant tasks to main methods
Copied: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java (from rev 5764, jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/CreatePropertiesTask.java)
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java (rev 0)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java 2009-10-21 09:33:36 UTC (rev 5765)
@@ -0,0 +1,41 @@
+/*
+ * 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.db;
+
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.db.internal.upgrade.CreatePropertiesCmd;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class CreateProperties {
+
+ public static void main(String[] args) {
+ ProcessEngine processEngine = new ProcessEngineImpl()
+ .skipDbCheck()
+ .buildProcessEngine();
+
+ // create properties
+ processEngine.execute(new CreatePropertiesCmd());
+ }
+}
Property changes on: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java (from rev 5764, jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/UpgradeTask.java)
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java (rev 0)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2009-10-21 09:33:36 UTC (rev 5765)
@@ -0,0 +1,54 @@
+/*
+ * 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.db;
+
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.db.internal.upgrade.AddLangIdCmd;
+import org.jbpm.db.internal.upgrade.GetJbpmVersionCmd;
+import org.jbpm.db.internal.upgrade.JbpmVersion;
+import org.jbpm.db.internal.upgrade.UpdateSchemaCmd;
+import org.jbpm.db.internal.upgrade.UpgradePropertiesCmd;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class Upgrade {
+
+ public static void main(String[] args) {
+ ProcessEngine processEngine = new ProcessEngineImpl()
+ .skipDbCheck()
+ .buildProcessEngine();
+
+ // update database schema
+ processEngine.execute(new UpdateSchemaCmd());
+
+ // check whether database version predates engine version
+ JbpmVersion currentVersion = processEngine.execute(new GetJbpmVersionCmd());
+ if (currentVersion.isEarlier(JbpmVersion.V_4_2)) {
+ // add property "langid" to each deployed process
+ processEngine.execute(new AddLangIdCmd());
+ // upgrade properties
+ processEngine.execute(new UpgradePropertiesCmd());
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java 2009-10-21 07:14:47 UTC (rev 5764)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java 2009-10-21 09:33:36 UTC (rev 5765)
@@ -39,4 +39,8 @@
return dbVersion.startsWith("4.") && dbVersion.length() > 2 ? valueOf("V_4_"
+ dbVersion.substring(2)) : null;
}
+
+ public boolean isEarlier(JbpmVersion other) {
+ return ordinal() < other.ordinal();
+ }
}
Modified: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java
===================================================================
--- jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java 2009-10-21 07:14:47 UTC (rev 5764)
+++ jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java 2009-10-21 09:33:36 UTC (rev 5765)
@@ -23,12 +23,9 @@
import org.jbpm.api.Configuration;
import org.jbpm.api.JbpmException;
-import org.jbpm.db.internal.cmd.GetDeploymentPropertyCmd;
-import org.jbpm.db.internal.cmd.RemoveDeploymentPropertyCmd;
import org.jbpm.db.internal.cmd.RunScriptCmd;
import org.jbpm.db.internal.cmd.TableExistsCmd;
import org.jbpm.db.internal.upgrade.UpdateSchemaCmd;
-import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.test.JbpmTestCase;
/**
@@ -80,7 +77,7 @@
try {
// processEngine.execute(new RemoveDeploymentPropertyCmd(deploymentId, processName, DeploymentImpl.KEY_PROCESS_LANGUAGE_ID));
// do upgrade
- new UpgradeTask().execute();
+ // new Upgrade().execute();
// verify new table was created
assert processEngine.execute(new TableExistsCmd("JBPM4_PROPERTY"));
// verify langid attribute was added
Modified: jbpm4/trunk/modules/distro/src/main/files/install/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2009-10-21 07:14:47 UTC (rev 5764)
+++ jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2009-10-21 09:33:36 UTC (rev 5765)
@@ -599,12 +599,16 @@
</target>
<!-- ### UPGRADE JBPM SCHEMA ############################################# -->
- <target name="upgrade.jbpm.schema"
+ <target name="upgrade.jbpm.schema"
+ depends="create.cfg"
description="Upgrades the jBPM tables in the database to the current version">
<echo message="upgrading jbpm schema..." />
- <java classname="org.jbpm.db.DbUpgrade">
- <arg line="${jbpm.home} ${database}" />
+ <java classname="org.jbpm.db.Upgrade">
<classpath>
+ <pathelement location="${jbpm.home}/install/generated/cfg" />
+ <fileset dir="${jbpm.home}">
+ <include name="jbpm.jar"/>
+ </fileset>
<fileset dir="${jbpm.home}/lib">
<include name="*.jar"/>
</fileset>
16 years, 6 months
JBoss JBPM SVN: r5764 - in jbpm4/trunk/modules: db/scripts and 8 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-10-21 03:14:47 -0400 (Wed, 21 Oct 2009)
New Revision: 5764
Added:
jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/
jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java
jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/
jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/DbCmd.java
jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/GetDeploymentPropertyCmd.java
jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/RemoveDeploymentPropertyCmd.java
jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/RunScriptCmd.java
jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/TableExistsCmd.java
Removed:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/UpgradeTool.java
Modified:
jbpm4/trunk/modules/db/pom.xml
jbpm4/trunk/modules/db/scripts/antrun-schema.xml
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/CreatePropertiesTask.java
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/UpgradeTask.java
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/GetJbpmVersionCmd.java
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java
jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/upgrade/AddLangIdCmdTest.java
jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/upgrade/UpdateSchemaCmdTest.java
jbpm4/trunk/modules/db/src/test/resources/logging.properties
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java
Log:
[JBPM-2509] test upgrade task
Modified: jbpm4/trunk/modules/db/pom.xml
===================================================================
--- jbpm4/trunk/modules/db/pom.xml 2009-10-20 16:43:28 UTC (rev 5763)
+++ jbpm4/trunk/modules/db/pom.xml 2009-10-21 07:14:47 UTC (rev 5764)
@@ -10,7 +10,8 @@
<!-- ====================================================================== -->
<!-- $Id: pom.xml 3010 2008-11-20 08:30:16Z tom.baeyens(a)jboss.com $ -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- Module Info -->
<modelVersion>4.0.0</modelVersion>
@@ -27,12 +28,14 @@
<relativePath>../../pom.xml</relativePath>
</parent>
+ <properties>
+ <old.version>4.1</old.version>
+ </properties>
+
<profiles>
- <profile>
- <id>upgrade</id>
- <properties>
- <old.version>4.1</old.version>
- </properties>
+ <profile>
+ <id>upgrade</id>
+
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
@@ -41,60 +44,55 @@
<scope>compile</scope>
</dependency>
</dependencies>
+
<repositories>
<repository>
<id>qa.jboss.com</id>
<url>http://www.qa.jboss.com/jdbc-drivers/maven2</url>
</repository>
</repositories>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>previous-version</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-db</artifactId>
- <version>${old.version}</version>
- </artifactItem>
- </artifactItems>
- <outputDirectory>target/old.schema.files</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>upgrade-script</id>
- <phase>compile</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="upgrade.files.dest.dir" value="src/main/resources/db/upgrade-${old.version}-to-${version}"/>
- <property name="database" value="${database}"/>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>upgrade-script</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="upgrade.files.dest.dir"
+ value="src/main/resources/db/upgrade-${old.version}-to-${version}" />
+ <property name="database" value="${database}" />
<!-- for some reason that i don't get, the user.home must be passed explicitly -->
- <property name="user.home" value="${user.home}"/>
- <ant antfile="scripts/antrun-schema.xml" target="schema-upgrade" inheritRefs="yes"/>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
+ <property name="user.home" value="${user.home}" />
+ <ant antfile="scripts/antrun-schema.xml" target="schema-upgrade"
+ inheritRefs="yes" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>no-database</id>
+ <activation>
+ <property>
+ <name>!database</name>
+ </property>
+ </activation>
+
+ <properties>
+ <database>hsqldb</database>
+ </properties>
+ </profile>
</profiles>
<!-- Dependencies -->
@@ -123,20 +121,55 @@
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
- <id>create-drop-script</id>
+ <id>create-drop-script</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
- <property name="project.output.dir" value="${project.build.outputDirectory}"/>
- <ant antfile="scripts/antrun-schema.xml" target="create-schema" inheritRefs="yes"/>
+ <property name="project.output.dir" value="${project.build.outputDirectory}" />
+ <ant antfile="scripts/antrun-schema.xml" target="create-schema" inheritRefs="yes" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>previous-version</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-db</artifactId>
+ <version>${old.version}</version>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>target/test-classes/old-db</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>database</name>
+ <value>${database}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
</plugins>
</build>
Modified: jbpm4/trunk/modules/db/scripts/antrun-schema.xml
===================================================================
--- jbpm4/trunk/modules/db/scripts/antrun-schema.xml 2009-10-20 16:43:28 UTC (rev 5763)
+++ jbpm4/trunk/modules/db/scripts/antrun-schema.xml 2009-10-21 07:14:47 UTC (rev 5764)
@@ -10,70 +10,74 @@
<project>
- <!-- ##################### -->
- <!-- ### CREATE SCHEMA ### -->
<!-- ##################### -->
+ <!-- ### CREATE SCHEMA ### -->
+ <!-- ##################### -->
- <target name="create-schema">
- <taskdef name="schemaexport"
- classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
- classpathref="maven.compile.classpath" />
+ <target name="create-schema">
+ <taskdef name="schemaexport"
+ classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
+ classpathref="maven.compile.classpath" />
- <mkdir dir="target/classes/db" />
+ <mkdir dir="target/classes/db" />
<create-ddl db="hsqldb" />
- <create-ddl db="oracle" />
+ <create-ddl db="oracle" />
<create-ddl db="postgresql" />
<create-ddl db="mysql" />
<replace file="target/classes/db/jbpm.mysql.create.sql"
token="BLOB_VALUE_ blob"
value="BLOB_VALUE_ longblob" />
- </target>
+ </target>
- <macrodef name="create-ddl">
- <attribute name="db" />
+ <macrodef name="create-ddl">
+ <attribute name="db" />
- <sequential>
- <echo></echo>
- <echo>=====================</echo>
- <echo>Schema Create @{db}</echo>
+ <sequential>
+ <echo />
<echo>=====================</echo>
+ <echo>Schema Create @{db}</echo>
+ <echo>=====================</echo>
- <schemaexport output="target/classes/db/jbpm.(a){db}.create.sql"
- create="yes" drop="no"
- config="../distro/src/main/files/install/src/cfg/hibernate/jdbc/(a){db}.hibernate.cfg.xml"
- text="yes" delimiter=";"
- quiet="yes" />
+ <schemaexport output="target/classes/db/jbpm.(a){db}.create.sql"
+ create="yes"
+ drop="no"
+ config="../distro/src/main/files/install/src/cfg/hibernate/jdbc/(a){db}.hibernate.cfg.xml"
+ text="yes"
+ delimiter=";"
+ quiet="yes" />
- <echo></echo>
- <echo>=====================</echo>
+ <echo />
+ <echo>=====================</echo>
<echo>Schema Drop @{db}</echo>
<echo>=====================</echo>
- <schemaexport output="target/classes/db/jbpm.(a){db}.drop.sql"
- create="no" drop="yes"
- config="../distro/src/main/files/install/src/cfg/hibernate/jdbc/(a){db}.hibernate.cfg.xml"
- text="yes" delimiter=";"
- quiet="yes" />
+ <schemaexport output="target/classes/db/jbpm.(a){db}.drop.sql"
+ create="no"
+ drop="yes"
+ config="../distro/src/main/files/install/src/cfg/hibernate/jdbc/(a){db}.hibernate.cfg.xml"
+ text="yes"
+ delimiter=";"
+ quiet="yes" />
- </sequential>
- </macrodef>
+ </sequential>
+ </macrodef>
- <!-- ###################### -->
+ <!-- ###################### -->
<!-- ### SCHEMA UPGRADE ### -->
<!-- ###################### -->
- <target name="schema-upgrade">
+ <target name="schema-upgrade">
<taskdef name="schemaupdate"
classname="org.hibernate.tool.hbm2ddl.SchemaUpdateTask"
classpathref="maven.compile.classpath" />
- <!-- By default, the qa lab databases are used. the jdbc properties are taken from the qa/jdbc directory.
+ <!-- By default, the qa lab databases are used. the jdbc properties are taken from the qa/jdbc directory.
If you want to use your local database, specify property upgrade.jdbc.properties.dir in your local build properties -->
- <echo>loading properties from ${user.home}/.jbpm4/build.properties</echo>
- <property file="${user.home}/.jbpm4/build.properties" />
+ <echo>loading properties from ${user.home}/.jbpm4/build.properties</echo>
+ <property file="${user.home}/.jbpm4/build.properties" />
<echo>upgrade.jdbc.properties.dir: ${upgrade.jdbc.properties.dir}</echo>
<property name="upgrade.jdbc.properties.dir" location="../../qa/jdbc" />
- <mkdir dir="${upgrade.files.dest.dir}" />
+ <mkdir dir="${upgrade.files.dest.dir}" />
<antcall target="start.hsqldb" inheritrefs="true" />
<upgrade-ddl db="hsqldb" />
@@ -82,8 +86,8 @@
<upgrade-ddl db="oracle" />
<upgrade-ddl db="postgresql" />
</target>
-
- <target name="start.hsqldb">
+
+ <target name="start.hsqldb">
<java classname="org.hsqldb.Server"
classpathref="maven.compile.classpath"
fork="yes"
@@ -97,7 +101,7 @@
<socket server="localhost" port="1701" />
</waitfor>
</target>
-
+
<target name="stop.hsqldb">
<sql url="jdbc:hsqldb:hsql://localhost:1701"
driver="org.hsqldb.jdbcDriver"
@@ -112,18 +116,11 @@
<macrodef name="upgrade-ddl">
<attribute name="db" />
<sequential>
- <!-- ant antfile="scripts/schema-upgrade.xml" target="create.old.schema" inheritall="false">
- <property name="database" value="@{db}" />
- <property name="upgrade.jdbc.properties.dir" value="${upgrade.jdbc.properties.dir}" />
- <property name="compile.classpath.text" value="${toString:maven.compile.classpath}" />
- </ant -->
-
<property file="${upgrade.jdbc.properties.dir}/(a){db}.properties" prefix="@{db}." />
- <echo></echo>
+ <echo />
<echo>driver... ${(a){db}.jdbc.driver}</echo>
<echo>url...... ${(a){db}.jdbc.url}</echo>
<echo>username. ${(a){db}.jdbc.username}</echo>
- <echo>password. ${(a){db}.jdbc.password}</echo>
<echo>=====================</echo>
<echo>Dropping current schema @{db}</echo>
@@ -137,11 +134,11 @@
autocommit="yes"
onerror="continue" />
- <echo></echo>
+ <echo />
<echo>=====================</echo>
<echo>Creating old schema @{db}</echo>
<echo>=====================</echo>
- <sql src="target/old.schema.files/jbpm.(a){db}.create.sql"
+ <sql src="target/test-classes/old-db/jbpm.(a){db}.create.sql"
url="${(a){db}.jdbc.url}"
driver="${(a){db}.jdbc.driver}"
userid="${(a){db}.jdbc.username}"
@@ -149,15 +146,15 @@
classpathref="maven.compile.classpath"
autocommit="yes"
onerror="continue" />
-
- <mkdir dir="target/cfg" />
- <copy tofile="target/cfg/(a){db}.hibernate.cfg.xml"
+
+ <mkdir dir="target/cfg" />
+ <copy tofile="target/cfg/(a){db}.hibernate.cfg.xml"
file="../distro/src/main/files/install/src/cfg/hibernate/jdbc/(a){db}.hibernate.cfg.xml"
overwrite="true">
<filterset filtersfile="${upgrade.jdbc.properties.dir}/(a){db}.properties" />
</copy>
-
- <echo></echo>
+
+ <echo />
<echo>=====================</echo>
<echo>Schema Upgrade @{db}</echo>
<echo>=====================</echo>
@@ -166,11 +163,11 @@
properties="${upgrade.jdbc.properties.dir}/(a){db}.properties"
delimiter=";" />
- <echo></echo>
+ <echo />
<echo>=====================</echo>
<echo>Dropping old schema @{db}</echo>
<echo>=====================</echo>
- <sql src="target/old.schema.files/jbpm.(a){db}.drop.sql"
+ <sql src="target/test-classes/old-db/jbpm.(a){db}.drop.sql"
url="${(a){db}.jdbc.url}"
driver="${(a){db}.jdbc.driver}"
userid="${(a){db}.jdbc.username}"
@@ -178,8 +175,8 @@
classpathref="maven.compile.classpath"
autocommit="yes"
onerror="continue" />
-
+
</sequential>
</macrodef>
-
+
</project>
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/CreatePropertiesTask.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/CreatePropertiesTask.java 2009-10-20 16:43:28 UTC (rev 5763)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/CreatePropertiesTask.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -33,18 +33,9 @@
public class CreatePropertiesTask extends Task {
public void execute() throws BuildException {
- try {
- ProcessEngine processEngine =
- new ProcessEngineImpl()
- .skipDbCheck()
- .buildProcessEngine();
+ ProcessEngine processEngine = new ProcessEngineImpl().skipDbCheck().buildProcessEngine();
- // create properties
- processEngine.execute(new CreatePropertiesCmd());
-
- } catch (Exception e) {
- e.printStackTrace();
- throw new BuildException("failed to create jbpm properties during schema creation");
- }
+ // create properties
+ processEngine.execute(new CreatePropertiesCmd());
}
}
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/UpgradeTask.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/UpgradeTask.java 2009-10-20 16:43:28 UTC (rev 5763)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/UpgradeTask.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -23,7 +23,13 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
-import org.jbpm.db.internal.upgrade.UpgradeTool;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.db.internal.upgrade.AddLangIdCmd;
+import org.jbpm.db.internal.upgrade.GetJbpmVersionCmd;
+import org.jbpm.db.internal.upgrade.JbpmVersion;
+import org.jbpm.db.internal.upgrade.UpdateSchemaCmd;
+import org.jbpm.db.internal.upgrade.UpgradePropertiesCmd;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
/**
* @author Alejandro Guizar
@@ -31,12 +37,18 @@
public class UpgradeTask extends Task {
public void execute() throws BuildException {
- try {
- UpgradeTool.upgrade();
+ ProcessEngine processEngine = new ProcessEngineImpl().skipDbCheck().buildProcessEngine();
+
+ // update database schema
+ processEngine.execute(new UpdateSchemaCmd());
+
+ // check whether database version predates engine version
+ JbpmVersion currentVersion = processEngine.execute(new GetJbpmVersionCmd());
+ if (currentVersion.compareTo(JbpmVersion.V_4_2) < 0) {
+ // add property "langid" to each deployed process
+ processEngine.execute(new AddLangIdCmd());
+ // upgrade properties
+ processEngine.execute(new UpgradePropertiesCmd());
}
- catch (Exception e) {
- e.printStackTrace();
- throw new BuildException("failed to upgrade jbpm database");
- }
}
}
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/GetJbpmVersionCmd.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/GetJbpmVersionCmd.java 2009-10-20 16:43:28 UTC (rev 5763)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/GetJbpmVersionCmd.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -22,13 +22,10 @@
package org.jbpm.db.internal.upgrade;
import org.hibernate.Session;
-import org.jbpm.api.JbpmException;
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.id.PropertyImpl;
-
/**
* @author Tom Baeyens
*/
@@ -37,14 +34,16 @@
private static final long serialVersionUID = 1L;
public JbpmVersion execute(Environment environment) throws Exception {
- Session session = EnvironmentImpl.getFromCurrent(Session.class);
+ Session session = environment.get(Session.class);
if (!PropertyImpl.propertiesTableExists(session)) {
return JbpmVersion.V_4_0;
}
String dbVersion = PropertyImpl.getDbVersion(session);
if (dbVersion==null) {
- throw new JbpmException("invalid db state: property table exists, but no db version property is present");
+ // property table exists, but no db version property is present
+ // schema must have been updated moments ago
+ return JbpmVersion.V_4_0;
}
return JbpmVersion.getJbpmVersion(dbVersion);
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java 2009-10-20 16:43:28 UTC (rev 5763)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -21,41 +21,22 @@
*/
package org.jbpm.db.internal.upgrade;
-import java.util.HashMap;
-import java.util.Map;
-
-
/**
* @author Tom Baeyens
*/
-public class JbpmVersion {
+public enum JbpmVersion {
- public static final JbpmVersion V_4_0 = new JbpmVersion(4,0);
- public static final JbpmVersion V_4_2 = new JbpmVersion(4,2);
-
- private static Map<String, JbpmVersion> versions = new HashMap<String, JbpmVersion>();
-
- private int major = -1;
- private int minor = -1;
+ V_4_0, V_4_1, V_4_2;
- private JbpmVersion(int major, int minor) {
- this.major = major;
- this.minor = minor;
- versions.put(toString(), this);
- }
-
- public boolean earlierThen(JbpmVersion other) {
- return (minor<other.minor);
- }
-
public String toString() {
- return major+"."+minor;
+ return "4." + ordinal();
}
public static JbpmVersion getJbpmVersion(String dbVersion) {
if (dbVersion.endsWith("-SNAPSHOT")) {
- dbVersion = dbVersion.substring(0, dbVersion.length()-9);
+ dbVersion = dbVersion.substring(0, dbVersion.length() - 9);
}
- return versions.get(dbVersion);
+ return dbVersion.startsWith("4.") && dbVersion.length() > 2 ? valueOf("V_4_"
+ + dbVersion.substring(2)) : null;
}
}
Deleted: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/UpgradeTool.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/UpgradeTool.java 2009-10-20 16:43:28 UTC (rev 5763)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/UpgradeTool.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -1,56 +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.db.internal.upgrade;
-
-import java.util.List;
-
-import org.jbpm.api.ProcessEngine;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
-
-/**
- * @author Alejandro Guizar
- */
-public class UpgradeTool {
-
- public static void upgrade() throws Exception {
- ProcessEngine processEngine =
- new ProcessEngineImpl()
- .skipDbCheck()
- .buildProcessEngine();
-
- // update database schema
- processEngine.execute(new UpdateSchemaCmd());
-
- JbpmVersion currentVersion = processEngine.execute(new GetJbpmVersionCmd());
-
- if (currentVersion.earlierThen(JbpmVersion.V_4_2)) {
- // add property "langid" to each deployed process
- processEngine.execute(new AddLangIdCmd());
- // upgrade properties
- processEngine.execute(new UpgradePropertiesCmd());
- }
- }
-
- public static void main(String[] args) throws Exception {
- upgrade();
- }
-}
Added: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java
===================================================================
--- jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java (rev 0)
+++ jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -0,0 +1,94 @@
+/*
+ * 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.db.internal.ant;
+
+import org.jbpm.api.Configuration;
+import org.jbpm.api.JbpmException;
+import org.jbpm.db.internal.cmd.GetDeploymentPropertyCmd;
+import org.jbpm.db.internal.cmd.RemoveDeploymentPropertyCmd;
+import org.jbpm.db.internal.cmd.RunScriptCmd;
+import org.jbpm.db.internal.cmd.TableExistsCmd;
+import org.jbpm.db.internal.upgrade.UpdateSchemaCmd;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class UpgradeTaskTest extends JbpmTestCase {
+
+ private String database;
+
+ protected void setUp() throws Exception {
+ database = System.getProperty("database");
+ super.setUp();
+ }
+
+ public void testBuildEngineBeforeUpgrading() {
+ // drop current schema
+ processEngine.execute(new RunScriptCmd("db/jbpm." + database + ".drop.sql"));
+ // create old schema
+ processEngine.execute(new RunScriptCmd("old-db/jbpm." + database + ".create.sql"));
+ // build another engine
+ try {
+ new Configuration().setResource("jbpm.cfg.xml").buildProcessEngine();
+ }
+ catch (JbpmException e) {
+ assert e.getMessage().contains("run the upgrade tool first") : e.getMessage();
+ }
+ finally {
+ // update schema
+ processEngine.execute(new UpdateSchemaCmd());
+ }
+ }
+
+ public void testBuildEngineAfterUpgrading() {
+ // drop current schema
+ processEngine.execute(new RunScriptCmd("db/jbpm." + database + ".drop.sql"));
+ // create old schema
+ processEngine.execute(new RunScriptCmd("old-db/jbpm." + database + ".create.sql"));
+ // deploy process
+ /* TODO deployment fails against old schema
+ String processName = getName();
+ String deploymentId = repositoryService.createDeployment()
+ .addResourceFromString("process.jpdl.xml", "<process name='"
+ + processName
+ + "'>"
+ + " <start/>"
+ + "</process>")
+ .deploy();
+ */
+ try {
+ // processEngine.execute(new RemoveDeploymentPropertyCmd(deploymentId, processName, DeploymentImpl.KEY_PROCESS_LANGUAGE_ID));
+ // do upgrade
+ new UpgradeTask().execute();
+ // verify new table was created
+ assert processEngine.execute(new TableExistsCmd("JBPM4_PROPERTY"));
+ // verify langid attribute was added
+ // String langId = (String) processEngine.execute(new GetDeploymentPropertyCmd(deploymentId, processName, DeploymentImpl.KEY_PROCESS_LANGUAGE_ID));
+ // assertEquals("jpdl-4.0", langId);
+ }
+ finally {
+ // repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/DbCmd.java
===================================================================
--- jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/DbCmd.java (rev 0)
+++ jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/DbCmd.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -0,0 +1,112 @@
+package org.jbpm.db.internal.cmd;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.hibernate.HibernateException;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.connection.ConnectionProvider;
+import org.hibernate.connection.ConnectionProviderFactory;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.mapping.Table;
+import org.hibernate.util.JDBCExceptionReporter;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
+
+/**
+ * Base class for database commands on top of Hibernate.
+ *
+ * @author Alejandro Guizar
+ */
+public abstract class DbCmd<T> implements Command<T> {
+
+ private Configuration configuration;
+ private ConnectionProvider connectionProvider;
+
+ private static final long serialVersionUID = 1L;
+
+ public T execute(Environment environment) throws Exception {
+ configuration = environment.get(Configuration.class);
+ Connection connection = null;
+ try {
+ connection = createConnection();
+ return execute(connection);
+ }
+ finally {
+ closeConnection(connection);
+ configuration = null;
+ }
+ }
+
+ protected abstract T execute(Connection connection) throws Exception;
+
+ protected Dialect getDialect() {
+ return Dialect.getDialect(configuration.getProperties());
+ }
+
+ protected String getDefaultCatalog() {
+ return configuration.getProperty(org.hibernate.cfg.Environment.DEFAULT_CATALOG);
+ }
+
+ protected String getDefaultSchema() {
+ return configuration.getProperty(org.hibernate.cfg.Environment.DEFAULT_SCHEMA);
+ }
+
+ protected Table findTable(String tableName) {
+ for (Iterator< ? > i = configuration.getTableMappings(); i.hasNext();) {
+ Table table = (Table) i.next();
+ if (tableName.equals(table.getName()))
+ return table;
+ }
+ throw new NoSuchElementException(tableName);
+ }
+
+ private Connection createConnection() throws SQLException {
+ try {
+ connectionProvider = ConnectionProviderFactory.newConnectionProvider(configuration.getProperties());
+ }
+ catch (HibernateException e) {
+ throw new SQLException(e.getMessage());
+ }
+ Connection connection = connectionProvider.getConnection();
+ if (connection.getAutoCommit() == false) {
+ connection.commit();
+ connection.setAutoCommit(true);
+ }
+ return connection;
+ }
+
+ private void closeConnection(Connection connection) {
+ if (connectionProvider != null) {
+ try {
+ if (connection != null) {
+ JDBCExceptionReporter.logAndClearWarnings(connection);
+ connectionProvider.closeConnection(connection);
+ }
+ }
+ catch (SQLException e) {
+ JDBCExceptionReporter.logExceptions(e);
+ }
+ finally {
+ connectionProvider.close();
+ connectionProvider = null;
+ }
+ }
+ }
+
+ protected int executeUpdate(Statement statement, String sql) throws SQLException {
+ int rowCount = statement.executeUpdate(sql);
+
+ SQLWarning warning = statement.getWarnings();
+ if (warning != null) {
+ JDBCExceptionReporter.logWarnings(warning);
+ statement.clearWarnings();
+ }
+
+ return rowCount;
+ }
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/DbCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/GetDeploymentPropertyCmd.java
===================================================================
--- jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/GetDeploymentPropertyCmd.java (rev 0)
+++ jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/GetDeploymentPropertyCmd.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -0,0 +1,46 @@
+/*
+ * 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.db.internal.cmd;
+
+import org.hibernate.Session;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+
+public class GetDeploymentPropertyCmd implements Command<Object> {
+
+ private final String deploymentId, objectName, key;
+
+ private static final long serialVersionUID = 1L;
+
+ public GetDeploymentPropertyCmd(String deploymentId, String objectName, String key) {
+ this.deploymentId = deploymentId;
+ this.objectName = objectName;
+ this.key = key;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ DeploymentImpl deployment = (DeploymentImpl) environment.get(Session.class)
+ .load(DeploymentImpl.class, Long.valueOf(deploymentId));
+ return deployment.getObjectProperty(objectName, key);
+ }
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/GetDeploymentPropertyCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/RemoveDeploymentPropertyCmd.java
===================================================================
--- jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/RemoveDeploymentPropertyCmd.java (rev 0)
+++ jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/RemoveDeploymentPropertyCmd.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -0,0 +1,46 @@
+/*
+ * 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.db.internal.cmd;
+
+import org.hibernate.Session;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+
+public class RemoveDeploymentPropertyCmd implements Command<Object> {
+
+ private final String deploymentId, objectName, key;
+
+ private static final long serialVersionUID = 1L;
+
+ public RemoveDeploymentPropertyCmd(String deploymentId, String objectName, String key) {
+ this.deploymentId = deploymentId;
+ this.objectName = objectName;
+ this.key = key;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ DeploymentImpl deployment = (DeploymentImpl) environment.get(Session.class)
+ .load(DeploymentImpl.class, Long.valueOf(deploymentId));
+ return deployment.removeObjectProperty(objectName, key);
+ }
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/RemoveDeploymentPropertyCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/RunScriptCmd.java
===================================================================
--- jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/RunScriptCmd.java (rev 0)
+++ jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/RunScriptCmd.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -0,0 +1,78 @@
+/*
+ * 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.db.internal.cmd;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.util.JDBCExceptionReporter;
+
+public class RunScriptCmd extends DbCmd<Void> {
+
+ private final String resource;
+ private final List<SQLException> exceptions = new ArrayList<SQLException>();
+
+ private static final long serialVersionUID = 1L;
+
+ public RunScriptCmd(String resource) {
+ this.resource = resource;
+ }
+
+ protected Void execute(Connection connection) throws SQLException, IOException {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream(resource);
+ if (stream == null) {
+ throw new FileNotFoundException(resource);
+ }
+
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
+ try {
+ Statement statement = connection.createStatement();
+ try {
+ for (String sql; (sql = reader.readLine()) != null;) {
+ try {
+ executeUpdate(statement, sql);
+ }
+ catch (SQLException e) {
+ JDBCExceptionReporter.logExceptions(e);
+ exceptions.add(e);
+ }
+ }
+ }
+ finally {
+ statement.close();
+ }
+ }
+ finally {
+ reader.close();
+ }
+ return null;
+ }
+
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/RunScriptCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/TableExistsCmd.java
===================================================================
--- jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/TableExistsCmd.java (rev 0)
+++ jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/TableExistsCmd.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -0,0 +1,35 @@
+package org.jbpm.db.internal.cmd;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * Tell whether the named table exists in the database.
+ *
+ * @author Alejandro Guizar
+ */
+public class TableExistsCmd extends DbCmd<Boolean> {
+
+ private final String tableName;
+
+ private static final long serialVersionUID = 1L;
+ private static final String[] TABLE_TYPES = { "TABLE" };
+
+ public TableExistsCmd(String tableName) {
+ this.tableName = tableName;
+ }
+
+ protected Boolean execute(Connection connection) throws SQLException {
+ DatabaseMetaData metaData = connection.getMetaData();
+ ResultSet resultSet = metaData.getTables(getDefaultCatalog(), getDefaultSchema(), tableName, TABLE_TYPES);
+ try {
+ return resultSet.next();
+ }
+ finally {
+ resultSet.close();
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/cmd/TableExistsCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/upgrade/AddLangIdCmdTest.java
===================================================================
--- jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/upgrade/AddLangIdCmdTest.java 2009-10-20 16:43:28 UTC (rev 5763)
+++ jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/upgrade/AddLangIdCmdTest.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -21,9 +21,8 @@
*/
package org.jbpm.db.internal.upgrade;
-import org.hibernate.Session;
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.cmd.Environment;
+import org.jbpm.db.internal.cmd.GetDeploymentPropertyCmd;
+import org.jbpm.db.internal.cmd.RemoveDeploymentPropertyCmd;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.test.JbpmTestCase;
@@ -33,13 +32,15 @@
public class AddLangIdCmdTest extends JbpmTestCase {
private String deploymentId;
+ private String processName;
@Override
protected void setUp() throws Exception {
super.setUp();
+ processName = getName();
deploymentId = repositoryService.createDeployment()
.addResourceFromString("process.jpdl.xml", "<process name='"
- + getName()
+ + processName
+ "'>"
+ " <start/>"
+ "</process>")
@@ -53,29 +54,12 @@
}
public void testAddLangId() {
- processEngine.execute(new Command<Void>() {
- private static final long serialVersionUID = 1L;
+ String langId = (String) processEngine.execute(new RemoveDeploymentPropertyCmd(deploymentId, processName, DeploymentImpl.KEY_PROCESS_LANGUAGE_ID));
+ assertEquals("jpdl-4.2", langId);
- public Void execute(Environment environment) throws Exception {
- DeploymentImpl deployment = (DeploymentImpl) environment.get(Session.class)
- .load(DeploymentImpl.class, Long.valueOf(deploymentId));
- Object langId = deployment.removeObjectProperty(getName(), DeploymentImpl.KEY_PROCESS_LANGUAGE_ID);
- assertEquals("jpdl-4.2", langId);
- return null;
- }
- });
-
processEngine.execute(new AddLangIdCmd());
- processEngine.execute(new Command<Void>() {
- private static final long serialVersionUID = 1L;
-
- public Void execute(Environment environment) throws Exception {
- DeploymentImpl deployment = (DeploymentImpl) environment.get(Session.class)
- .load(DeploymentImpl.class, Long.valueOf(deploymentId));
- assertEquals("jpdl-4.0", deployment.getProcessLanguageId(getName()));
- return null;
- }
- });
+ langId = (String) processEngine.execute(new GetDeploymentPropertyCmd(deploymentId, processName, DeploymentImpl.KEY_PROCESS_LANGUAGE_ID));
+ assertEquals("jpdl-4.0", langId);
}
}
Modified: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/upgrade/UpdateSchemaCmdTest.java
===================================================================
--- jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/upgrade/UpdateSchemaCmdTest.java 2009-10-20 16:43:28 UTC (rev 5763)
+++ jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/upgrade/UpdateSchemaCmdTest.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -22,23 +22,12 @@
package org.jbpm.db.internal.upgrade;
import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
import java.sql.SQLException;
-import java.sql.SQLWarning;
import java.sql.Statement;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import org.hibernate.HibernateException;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.connection.ConnectionProvider;
-import org.hibernate.connection.ConnectionProviderFactory;
-import org.hibernate.dialect.Dialect;
import org.hibernate.mapping.Table;
-import org.hibernate.util.JDBCExceptionReporter;
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.cmd.Environment;
+import org.jbpm.db.internal.cmd.DbCmd;
+import org.jbpm.db.internal.cmd.TableExistsCmd;
import org.jbpm.test.JbpmTestCase;
/**
@@ -49,99 +38,21 @@
public void testUpdateSchema() {
// drop some jbpm table
processEngine.execute(new DropTableCmd("JBPM4_PROPERTY"));
- assertFalse(processEngine.execute(new TableExistsCmd("JBPM4_PROPERTY")));
+ assert !processEngine.execute(new TableExistsCmd("JBPM4_PROPERTY"));
// run schema update tool
processEngine.execute(new UpdateSchemaCmd());
// verify jbpm table was created again
- assertTrue(processEngine.execute(new TableExistsCmd("JBPM4_PROPERTY")));
+ assert processEngine.execute(new TableExistsCmd("JBPM4_PROPERTY"));
}
/**
- * Base class for SQL commands on top of Hibernate.
- *
- * @author Alejandro Guizar
- */
- static abstract class SqlCmd<T> implements Command<T> {
-
- private Configuration configuration;
- private ConnectionProvider connectionProvider;
-
- private static final long serialVersionUID = 1L;
-
- public T execute(Environment environment) throws SQLException {
- configuration = environment.get(Configuration.class);
- Connection connection = null;
- try {
- connection = createConnection();
- return execute(connection);
- } finally {
- closeConnection(connection);
- configuration = null;
- }
- }
-
- protected abstract T execute(Connection connection) throws SQLException;
-
- protected Dialect getDialect() {
- return Dialect.getDialect(configuration.getProperties());
- }
-
- protected String getDefaultCatalog() {
- return configuration.getProperty(org.hibernate.cfg.Environment.DEFAULT_CATALOG);
- }
-
- protected String getDefaultSchema() {
- return configuration.getProperty(org.hibernate.cfg.Environment.DEFAULT_SCHEMA);
- }
-
- protected Table findTable(String tableName) {
- for (Iterator<?> i = configuration.getTableMappings(); i.hasNext();) {
- Table table = (Table) i.next();
- if (tableName.equals(table.getName()))
- return table;
- }
- throw new NoSuchElementException(tableName);
- }
-
- private Connection createConnection() throws SQLException {
- try {
- connectionProvider = ConnectionProviderFactory.newConnectionProvider(configuration.getProperties());
- } catch (HibernateException e) {
- throw new SQLException(e.getMessage());
- }
- Connection connection = connectionProvider.getConnection();
- if (connection.getAutoCommit() == false) {
- connection.commit();
- connection.setAutoCommit(true);
- }
- return connection;
- }
-
- private void closeConnection(Connection connection) {
- if (connectionProvider != null) {
- try {
- if (connection != null) {
- JDBCExceptionReporter.logAndClearWarnings(connection);
- connectionProvider.closeConnection(connection);
- }
- } catch (SQLException e) {
- JDBCExceptionReporter.logExceptions(e);
- } finally {
- connectionProvider.close();
- connectionProvider = null;
- }
- }
- }
- }
-
- /**
* Drop the named table from the database.
*
* @author Alejandro Guizar
*/
- static class DropTableCmd extends SqlCmd<Void> {
+ static class DropTableCmd extends DbCmd<Void> {
private final String tableName;
@@ -160,13 +71,7 @@
// execute sql to drop table
Statement statement = connection.createStatement();
try {
- statement.executeUpdate(dropSql);
-
- SQLWarning warning = statement.getWarnings();
- if (warning != null) {
- JDBCExceptionReporter.logWarnings(warning);
- statement.clearWarnings();
- }
+ executeUpdate(statement, dropSql);
} finally {
statement.close();
}
@@ -174,32 +79,4 @@
return null;
}
}
-
- /**
- * Tell whether the named table exists in the database.
- *
- * @author Alejandro Guizar
- */
- static class TableExistsCmd extends SqlCmd<Boolean> {
-
- private final String tableName;
-
- private static final long serialVersionUID = 1L;
- private static final String[] TABLE_TYPES = { "TABLE" };
-
- TableExistsCmd(String tableName) {
- this.tableName = tableName;
- }
-
- protected Boolean execute(Connection connection) throws SQLException {
- DatabaseMetaData metaData = connection.getMetaData();
- ResultSet resultSet = metaData.getTables(getDefaultCatalog(), getDefaultSchema(), tableName, TABLE_TYPES);
- try {
- return resultSet.next();
- } finally {
- resultSet.close();
- }
- }
-
- }
}
Modified: jbpm4/trunk/modules/db/src/test/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/db/src/test/resources/logging.properties 2009-10-20 16:43:28 UTC (rev 5763)
+++ jbpm4/trunk/modules/db/src/test/resources/logging.properties 2009-10-21 07:14:47 UTC (rev 5764)
@@ -12,7 +12,7 @@
org.hibernate.level=INFO
org.hibernate.cfg.SettingsFactory.level=SEVERE
org.hibernate.cfg.HbmBinder.level=SEVERE
-# org.hibernate.SQL.level=FINEST
+org.hibernate.SQL.level=FINEST
# org.hibernate.type.level=FINEST
# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
# org.hibernate.transaction.level=FINEST
\ No newline at end of file
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java 2009-10-20 16:43:28 UTC (rev 5763)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java 2009-10-21 07:14:47 UTC (rev 5764)
@@ -25,6 +25,7 @@
import java.util.List;
import org.hibernate.Session;
+import org.hibernate.criterion.Restrictions;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.history.model.HistoryActivityInstanceImpl;
@@ -143,8 +144,8 @@
for (String persistedType: persistedTypes) {
try {
Long typeMaxDbid = (Long) session.createQuery(
- "select max(object.dbid) " +
- "from "+persistedType+" as object"
+ "select max(id) " +
+ "from "+persistedType
).uniqueResult();
if ( (typeMaxDbid!=null)
@@ -169,22 +170,19 @@
}
protected static void setPropertyValue(Session session, String propertyKey, String propertyValue) {
- PropertyImpl dbidProperty = getProperty(session, propertyKey);
- if (dbidProperty==null) {
- dbidProperty = new PropertyImpl(PropertyImpl.NEXT_DBID_KEY, propertyValue);
- session.save(dbidProperty);
+ PropertyImpl property = getProperty(session, propertyKey);
+ if (property==null) {
+ property = new PropertyImpl(propertyKey, propertyValue);
+ session.save(property);
} else {
- dbidProperty.setValue(propertyValue);
- session.update(dbidProperty);
+ property.setValue(propertyValue);
}
}
protected static PropertyImpl getProperty(Session session, String key) {
- return (PropertyImpl) session.createQuery(
- "select property " +
- "from "+PropertyImpl.class.getName()+" as property " +
- "where property.key = '"+key+"'"
- ).uniqueResult();
+ return (PropertyImpl) session.createCriteria(PropertyImpl.class)
+ .add(Restrictions.eq("key", key))
+ .uniqueResult();
}
// getters and setters //////////////////////////////////////////////////////
16 years, 6 months