[jbpm-commits] JBoss JBPM SVN: r5165 - in jbpm4/trunk/modules/pvm/src: main/resources and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Jun 30 09:58:20 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-06-30 09:58:20 -0400 (Tue, 30 Jun 2009)
New Revision: 5165
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/TextVariable.java
Modified:
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.variable.types.xml
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/type/VariableAutoTypeResolutionTest.java
Log:
schema review updates: changed some hibernate strings to text and pruned unused lob field mappings
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/TextVariable.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/TextVariable.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/TextVariable.java 2009-06-30 13:58:20 UTC (rev 5165)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.type.variable;
+
+import org.jbpm.pvm.internal.type.Variable;
+
+
+public class TextVariable extends Variable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String text = null;
+
+ public boolean isStorable(Object value) {
+ if (value==null) return true;
+ return (char[].class==value.getClass());
+ }
+
+ public Object getObject() {
+ if (text==null) {
+ return null;
+ }
+ return text.toCharArray();
+ }
+
+ public void setObject(Object value) {
+ if (value!=null) {
+ this.text = new String((char[])value);
+ } else {
+ this.text = null;
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/TextVariable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-06-30 13:53:27 UTC (rev 5164)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-06-30 13:58:20 UTC (rev 5165)
@@ -113,7 +113,7 @@
<property name="userId" column="USERID_" />
<property name="time" column="TIME_" />
- <property name="message" column="MESSAGE_" />
+ <property name="message" column="MESSAGE_" type="text" />
<list name="comments"
cascade="all-delete-orphan"
@@ -154,34 +154,38 @@
index="IDX_VAR_PROCINST"/>
</class>
- <subclass name="org.jbpm.pvm.internal.type.variable.DateVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="T">
+ <subclass name="org.jbpm.pvm.internal.type.variable.DateVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="date">
<property name="date" column="DATE_VALUE_" type="timestamp"/>
</subclass>
- <subclass name="org.jbpm.pvm.internal.type.variable.DoubleVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="D">
+ <subclass name="org.jbpm.pvm.internal.type.variable.DoubleVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="double">
<property name="d" column="DOUBLE_VALUE_" type="double"/>
</subclass>
- <subclass name="org.jbpm.pvm.internal.type.variable.HibernateLongVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="l">
+ <subclass name="org.jbpm.pvm.internal.type.variable.HibernateLongVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="hib-long">
<property name="hibernatable" column="LONG_VALUE_" type="long"/>
</subclass>
- <subclass name="org.jbpm.pvm.internal.type.variable.LongVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="L">
+ <subclass name="org.jbpm.pvm.internal.type.variable.LongVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="long">
<property name="l" column="LONG_VALUE_" type="long"/>
</subclass>
- <subclass name="org.jbpm.pvm.internal.type.variable.HibernateStringVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="s">
+ <subclass name="org.jbpm.pvm.internal.type.variable.HibernateStringVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="hib-string">
<property name="hibernatable" column="STRING_VALUE_" type="string"/>
</subclass>
- <subclass name="org.jbpm.pvm.internal.type.variable.StringVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="S">
+ <subclass name="org.jbpm.pvm.internal.type.variable.StringVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="string">
<property name="string" column="STRING_VALUE_" type="string"/>
</subclass>
- <subclass name="org.jbpm.pvm.internal.type.variable.NullVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="N">
+ <subclass name="org.jbpm.pvm.internal.type.variable.TextVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="text">
+ <property name="text" column="TEXT_VALUE_" type="text"/>
</subclass>
- <subclass name="org.jbpm.pvm.internal.type.variable.BlobVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="B">
+ <subclass name="org.jbpm.pvm.internal.type.variable.NullVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="null">
+ </subclass>
+
+ <subclass name="org.jbpm.pvm.internal.type.variable.BlobVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="blob">
<many-to-one name="lob"
column="LOB_"
cascade="all"
@@ -189,14 +193,6 @@
foreign-key="FK_VAR_LOB"
index="IDX_VAR_LOB" />
</subclass>
-
- <subclass name="org.jbpm.pvm.internal.type.variable.ClobVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="C">
- <many-to-one name="lob"
- column="LOB_"
- cascade="all"
- class="org.jbpm.pvm.internal.lob.Lob"
- foreign-key="none"/>
- </subclass>
<!-- ### LOB ############################################################ -->
<class name="org.jbpm.pvm.internal.lob.Lob" table="JBPM4_LOB">
@@ -205,9 +201,12 @@
</id>
<version name="dbversion" column="DBVERSION_" />
<property name="blob" type="blob"><column name="BLOB_VALUE_" /></property>
+ <!--
+ should only be re-introduced if there comes a concrete need for it.
<property name="bytes" type="binary" column="BINARY_VALUE_"/>
<property name="clob" type="clob" column="CLOB_VALUE_" />
<property name="text" type="text" column="TEXT_VALUE_"/>
+ -->
</class>
<class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM4_JOB" discriminator-value="Job">
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.task.hbm.xml 2009-06-30 13:53:27 UTC (rev 5164)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.task.hbm.xml 2009-06-30 13:58:20 UTC (rev 5165)
@@ -15,7 +15,7 @@
<version name="dbversion" column="DBVERSION_" />
<property name="name" column="NAME_"/>
- <property name="description" column="DESCR_"/>
+ <property name="description" column="DESCR_" type="text"/>
<property name="state" column="STATE_"/>
<property name="suspendHistoryState" column="SUSPHISTSTATE_" />
<property name="assignee" column="ASSIGNEE_"/>
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.variable.types.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.variable.types.xml 2009-06-30 13:53:27 UTC (rev 5164)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.variable.types.xml 2009-06-30 13:58:20 UTC (rev 5165)
@@ -20,7 +20,7 @@
<!-- byte[] and char[] -->
<type name="byte[]" class="[B" variable-class="org.jbpm.pvm.internal.type.variable.BlobVariable" />
- <type name="char[]" class="[C" variable-class="org.jbpm.pvm.internal.type.variable.ClobVariable" />
+ <type name="char[]" class="[C" variable-class="org.jbpm.pvm.internal.type.variable.TextVariable" />
<type name="hibernate-long-id" class="hibernate" id-type="long" variable-class="org.jbpm.pvm.internal.type.variable.HibernateLongVariable" />
<type name="hibernate-string-id" class="hibernate" id-type="string" variable-class="org.jbpm.pvm.internal.type.variable.HibernateStringVariable" />
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/type/VariableAutoTypeResolutionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/type/VariableAutoTypeResolutionTest.java 2009-06-30 13:53:27 UTC (rev 5164)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/type/VariableAutoTypeResolutionTest.java 2009-06-30 13:58:20 UTC (rev 5165)
@@ -37,6 +37,7 @@
import org.jbpm.pvm.internal.type.variable.DoubleVariable;
import org.jbpm.pvm.internal.type.variable.LongVariable;
import org.jbpm.pvm.internal.type.variable.StringVariable;
+import org.jbpm.pvm.internal.type.variable.TextVariable;
import org.jbpm.pvm.test.EnvironmentTestCase;
/**
@@ -218,10 +219,11 @@
ExecutionImpl execution = startProcessInstance();
char[] chars = generateChars("a lot of bytes ", 500);
+ assertTrue(chars.length>4500);
execution.setVariable("v", chars);
Variable variable = execution.getVariableObject("v");
- assertEquals(ClobVariable.class, variable.getClass());
+ assertEquals(TextVariable.class, variable.getClass());
assertTrue(Arrays.equals(chars, (char[]) execution.getVariable("v")));
}
More information about the jbpm-commits
mailing list