[jbpm-commits] JBoss JBPM SVN: r3791 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/model and 14 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Feb 6 12:13:10 EST 2009


Author: tom.baeyens at jboss.com
Date: 2009-02-06 12:13:10 -0500 (Fri, 06 Feb 2009)
New Revision: 3791

Added:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategy.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BytesChop.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/CharChop.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Chop.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Lob.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/LobCached.java
   jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/process/ProcessAttachmentsTest.java
Removed:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Blob.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategy.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyFile.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Clob.java
Modified:
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenProcessDefinition.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/ProcessDefinitionBuilder.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyBinary.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyBlob.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyChopped.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategy.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategyChopped.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategyClob.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategyText.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/BlobVariable.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/ClobVariable.java
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.definition.hbm.xml
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.execution.hbm.xml
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.variable.hbm.xml
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/type/VariableAutoTypeResolutionTest.java
   jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
   jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java
   jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/task/TaskListTest.java
   jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/task/TaskQueryTest.java
   jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/variables/VariableBasicTypesTest.java
Log:
JBPM-1972 introduce process definition attachments

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -56,8 +56,7 @@
 
   /** deletes process definition and the existing executions. */
   void deleteProcessDefinitionAndInstances(String processDefinitionId);
-
   
-  /** TODO REMOVE: deploy a new process definition into the process repository. */
-  List<ProcessDefinition> deploy(Deployment deployment);
+  /** retrieves an attachment of a process definition */
+  byte[] getAttachment(String processDefinitionId, String name);
 }

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenProcessDefinition.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenProcessDefinition.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -56,4 +56,6 @@
   /** the initial activity of this process definition */
   Activity getInitial();
 
+  /** retrieves an attachment of a process definition */
+  byte[] getAttachment(String name);
 }
\ No newline at end of file

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/ProcessDefinitionBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/ProcessDefinitionBuilder.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/ProcessDefinitionBuilder.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -21,6 +21,7 @@
  */
 package org.jbpm.pvm.internal.builder;
 
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -55,7 +56,7 @@
     processDefinition.setName(processDefinitionName);
     return new ProcessDefinitionBuilder(processDefinition);
   }
-
+  
   public ProcessDefinitionImpl endProcess() {
     verifyInitial();
     resolveFlows();
@@ -93,6 +94,17 @@
     return this;
   }
 
+  public ProcessDefinitionBuilder attachment(String name, InputStream inputStream) {
+    processDefinition.addAttachment(name, inputStream);
+    return this;
+  }
+
+  public ProcessDefinitionBuilder attachment(String name, byte[] bytes) {
+    processDefinition.addAttachment(name, bytes);
+    return this;
+  }
+
+
   protected void addUnresolvedFlow(UnresolvedFlow unresolvedFlow) {
     unresolvedFlows.add(unresolvedFlow);
   }

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -0,0 +1,51 @@
+/*
+ * 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.cmd;
+
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.session.PvmDbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GetAttachment implements Command<byte[]> {
+
+  private static final long serialVersionUID = 1L;
+  
+  protected String processDefinitionId;
+  protected String name;
+  
+  public GetAttachment(String processDefinitionId, String name) {
+    this.processDefinitionId = processDefinitionId;
+    this.name = name;
+  }
+
+  public byte[] execute(Environment environment) throws Exception {
+    PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+    ClientProcessDefinition processDefinition = pvmDbSession.findProcessDefinitionById(processDefinitionId);
+    return processDefinition.getAttachment(name);
+  }
+
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -21,11 +21,13 @@
  */
 package org.jbpm.pvm.internal.deploy;
 
+import java.io.InputStream;
 import java.io.Serializable;
 
 import org.jbpm.ProcessDefinition;
 import org.jbpm.env.Environment;
 import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
 import org.jbpm.pvm.internal.svc.DeploymentImpl;
 import org.jbpm.session.PvmDbSession;
 
@@ -36,7 +38,7 @@
 
   private static final long serialVersionUID = 1L;
   private static Log log = Log.getLog(SaveDeployer.class.getName());
-
+  
   public void deploy(DeploymentImpl deployment) {
     Environment environment = Environment.getCurrent();
     if (environment==null) {
@@ -50,16 +52,27 @@
       return;
     }
     
+    ProcessDefinitionImpl lastProcessDefinition = null;
+    
     boolean deployedProcess = false;
     for (String objectName : deployment.getObjectNames()) {
       Object object = deployment.getObject(objectName);
       if (object instanceof ProcessDefinition) {
         deployedProcess = true;
+        lastProcessDefinition = (ProcessDefinitionImpl) object; 
+        
         log.debug("saving process definition "+object);
         pvmDbSession.save(object);
       }
     }
-    
+
+    if (lastProcessDefinition!=null) {
+      for (String fileName : deployment.getFileNames()) {
+        InputStream inputStream = deployment.getFile(fileName);
+        lastProcessDefinition.addAttachment(fileName, inputStream);
+      }
+    }
+
     if (!deployedProcess) {
       log.info("no process definition in "+deployment);
     }

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Blob.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Blob.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Blob.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -1,82 +0,0 @@
-package org.jbpm.pvm.internal.lob;
-
-import java.io.Serializable;
-import java.util.List;
-
-import org.jbpm.env.Environment;
-
-public class Blob implements Serializable {
-
-  private static final long serialVersionUID = 1L;
-  
-  public static final BlobStrategy DEFAULT_BLOB_STRATEGY = new BlobStrategyBlob();
-
-  // MAP WITH HIBERNATE AS COMPONENT
-
-  protected java.sql.Blob blob;
-  
-  // cachedBytes is used by the BlobStrategyBlob as hibernate doesn't allow 
-  // blobs to be read in the same session as they are created in.
-  // So cachedBytes should not be persisted 
-  protected byte[] cachedBytes;
-  
-  protected byte[] bytes;
-  protected List<byte[]> chops;
-  protected String fileName;
-  
-  public Blob() {
-  }
-
-  public Blob(byte[] bytes) {
-    getBlobStrategy().set(bytes, this);
-  }
-  public byte[] extractBytes() {
-    return getBlobStrategy().get(this);
-  }
-
-  protected BlobStrategy getBlobStrategy() {
-    BlobStrategy blobStrategy = null;
-    
-    Environment environment = Environment.getCurrent();
-    if (environment!=null) {
-      blobStrategy = environment.get(BlobStrategy.class);
-    }
-
-    if (blobStrategy==null) {
-      blobStrategy = DEFAULT_BLOB_STRATEGY;
-    }
-    
-    return blobStrategy;
-  }
-
-  public java.sql.Blob getBlob() {
-    return blob;
-  }
-  public void setBlob(java.sql.Blob blob) {
-    this.blob = blob;
-  }
-  public List<byte[]> getChops() {
-    return chops;
-  }
-  public void setChops(List<byte[]> chops) {
-    this.chops = chops;
-  }
-  public byte[] getBytes() {
-    return bytes;
-  }
-  public void setBytes(byte[] bytes) {
-    this.bytes = bytes;
-  }
-  public String getFileName() {
-    return fileName;
-  }
-  public void setFileName(String fileName) {
-    this.fileName = fileName;
-  }
-  public byte[] getCachedBytes() {
-    return cachedBytes;
-  }
-  public void setCachedBytes(byte[] cachedBytes) {
-    this.cachedBytes = cachedBytes;
-  }
-}

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategy.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategy.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategy.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -1,7 +0,0 @@
-package org.jbpm.pvm.internal.lob;
-
-public interface BlobStrategy {
-  
-  void set(byte[] bytes, Blob blob);
-  byte[] get(Blob blob);
-}

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategy.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategy.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategy.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -0,0 +1,7 @@
+package org.jbpm.pvm.internal.lob;
+
+public interface BlobStrategy {
+  
+  void set(byte[] bytes, Lob lob);
+  byte[] get(Lob lob);
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategy.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyBinary.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyBinary.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyBinary.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -2,11 +2,11 @@
 
 public class BlobStrategyBinary implements BlobStrategy {
 
-  public byte[] get(Blob blob) {
-    return blob.getBytes();
+  public byte[] get(Lob lob) {
+    return lob.bytes;
   }
 
-  public void set(byte[] bytes, Blob blob) {
-    blob.setBytes(bytes);
+  public void set(byte[] bytes, Lob lob) {
+    lob.bytes = bytes;
   }
 }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyBlob.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyBlob.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyBlob.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -7,19 +7,19 @@
 
 public class BlobStrategyBlob implements BlobStrategy {
   
-  public void set(byte[] bytes, Blob blob) {
+  public void set(byte[] bytes, Lob lob) {
     if (bytes!=null) {
-      blob.setCachedBytes(bytes);
-      blob.setBlob(Hibernate.createBlob(bytes));
+      lob.cachedBytes = bytes;
+      lob.blob = Hibernate.createBlob(bytes);
     }
   }
 
-  public byte[] get(Blob blob) {
-    if (blob.getCachedBytes()!=null) {
-      return blob.getCachedBytes();
+  public byte[] get(Lob lob) {
+    if (lob.cachedBytes!=null) {
+      return lob.cachedBytes;
     }
     
-    java.sql.Blob sqlBlob = blob.getBlob();
+    java.sql.Blob sqlBlob = lob.blob;
     if (sqlBlob!=null) {
       try {
         return sqlBlob.getBytes(1, (int) sqlBlob.length());

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyChopped.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyChopped.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyChopped.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -1,53 +1,50 @@
 package org.jbpm.pvm.internal.lob;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 public class BlobStrategyChopped implements BlobStrategy {
 
   int chopSize = 1024;
 
-  public void set(byte[] bytes, Blob blob) {
-    blob.setChops(chop(bytes));
+  public void set(byte[] bytes, Lob lob) {
+    lob.bytesChops = chop(bytes);
   }
 
-  public byte[] get(Blob blob) {
-    return glue(blob.getChops());
+  public byte[] get(Lob lob) {
+    return glue(lob.bytesChops);
   }
 
-  public List<byte[]> chop(byte[] bytes) {
-    List<byte[]> chops = null;
+  public List<BytesChop> chop(byte[] bytes) {
+    List<BytesChop> chops = null;
     if ( (bytes!=null)
          && (bytes.length>0) ){
-      chops = new ArrayList<byte[]>();
+      chops = new ArrayList<BytesChop>();
       int index = 0;
       while ( (bytes.length-index) > chopSize ) {
         byte[] byteBlock = new byte[chopSize];
         System.arraycopy(bytes, index, byteBlock, 0, chopSize);
-        chops.add(byteBlock);
+        chops.add(new BytesChop(byteBlock));
         index+=chopSize;
       }
       byte[] byteBlock = new byte[bytes.length-index];
       System.arraycopy(bytes, index, byteBlock, 0, bytes.length-index);
-      chops.add(byteBlock);
+      chops.add(new BytesChop(byteBlock));
     }
     return chops;
   }
 
-  public byte[] glue(List<byte[]> chops) {
+  public byte[] glue(List<BytesChop> bytesChops) {
     byte[] bytes = null;
-    if (chops!=null) {
-      Iterator iter = chops.iterator();
-      while (iter.hasNext()) {
-        byte[] byteBlock = (byte[]) iter.next();
+    if (bytesChops!=null) {
+      for (BytesChop bytesChop: bytesChops) {
         if (bytes==null) {
-          bytes = byteBlock;
+          bytes = bytesChop.getBytes();
         } else {
           byte[] oldValue = bytes;
-          bytes = new byte[bytes.length+byteBlock.length];
+          bytes = new byte[bytes.length+bytesChop.getBytes().length];
           System.arraycopy(oldValue, 0, bytes, 0, oldValue.length);
-          System.arraycopy(byteBlock, 0, bytes, oldValue.length, byteBlock.length);
+          System.arraycopy(bytesChop.getBytes(), 0, bytes, oldValue.length, bytesChop.getBytes().length);
         }
       }
     }

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyFile.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyFile.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BlobStrategyFile.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -1,18 +0,0 @@
-package org.jbpm.pvm.internal.lob;
-
-/** TODO */
-public class BlobStrategyFile implements BlobStrategy {
-
-  public void set(byte[] bytes, Blob blob) {
-    // create file
-    String fileName = null;
-    // store bytes in file
-    // store fileName in blob
-    blob.setFileName(fileName);
-  }
-  public byte[] get(Blob blob) {
-    // read file from blob.getFileName();
-    return null;
-  }
-
-}

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BytesChop.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BytesChop.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BytesChop.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -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.pvm.internal.lob;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class BytesChop extends Chop {
+
+  private static final long serialVersionUID = 1L;
+
+  protected byte[] bytes;
+
+  public BytesChop(byte[] bytes) {
+    this.bytes = bytes;
+  }
+
+  public byte[] getBytes() {
+    return bytes;
+  }
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/BytesChop.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/CharChop.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/CharChop.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/CharChop.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -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.pvm.internal.lob;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CharChop extends Chop {
+
+  private static final long serialVersionUID = 1L;
+  
+  protected String text;
+
+  public CharChop(String text) {
+    this.text = text;
+  }
+
+  public String getText() {
+    return text;
+  }
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/CharChop.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Chop.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Chop.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Chop.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -0,0 +1,39 @@
+/*
+ * 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.lob;
+
+import java.io.Serializable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class Chop implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  protected long dbid;
+
+  public long getDbid() {
+    return dbid;
+  }
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Chop.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Clob.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Clob.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Clob.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -1,59 +0,0 @@
-package org.jbpm.pvm.internal.lob;
-
-import java.util.List;
-
-import org.jbpm.env.Environment;
-
-public class Clob {
-
-  public static final ClobStrategy DEFAULT_CLOB_STRATEGY = new ClobStrategyChopped();
-
-  protected java.sql.Clob clob = null;
-  protected String text = null;
-  protected List<String> chops = null;
-  
-  public Clob() {
-  }
-
-  public Clob(char[] text) {
-    getClobStrategy().set(text, this);
-  }
-
-  public char[] extractChars() {
-    return getClobStrategy().get(this);
-  }
-
-  protected ClobStrategy getClobStrategy() {
-    ClobStrategy clobStrategy = null;
-    
-    Environment environment = Environment.getCurrent();
-    if (environment!=null) {
-      clobStrategy = environment.get(ClobStrategy.class);
-    }
-
-    if (clobStrategy==null) {
-      clobStrategy = DEFAULT_CLOB_STRATEGY;
-    }
-    
-    return clobStrategy;
-  }
-
-  public List<String> getChops() {
-    return chops;
-  }
-  public void setChops(List<String> chops) {
-    this.chops = chops;
-  }
-  public java.sql.Clob getClob() {
-    return clob;
-  }
-  public void setClob(java.sql.Clob clob) {
-    this.clob = clob;
-  }
-  public String getText() {
-    return text;
-  }
-  public void setText(String text) {
-    this.text = text;
-  }
-}

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategy.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategy.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategy.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -2,6 +2,6 @@
 
 public interface ClobStrategy {
 
-  void set(char[] text, Clob clob);
-  char[] get(Clob clob);
+  void set(char[] text, Lob lob);
+  char[] get(Lob lob);
 }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategyChopped.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategyChopped.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategyChopped.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -2,46 +2,44 @@
 
 import java.io.StringWriter;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 public class ClobStrategyChopped implements ClobStrategy {
   
   int chopSize = 1024;
   
-  public char[] get(Clob clob) {
-    return glue(clob.getChops());
+  public char[] get(Lob lob) {
+    return glue(lob.charChops);
   }
 
-  public void set(char[] chars, Clob clob) {
-    clob.setChops(chop(chars));
+  public void set(char[] chars, Lob lob) {
+    lob.charChops = chop(chars);
   }
 
-  public List<String> chop(char[] chars) {
-    List<String> chops = null;
+  public List<CharChop> chop(char[] chars) {
+    List<CharChop> charChops = null;
     if ( (chars!=null)
          && (chars.length>0) ){
-      chops = new ArrayList<String>();
+      charChops = new ArrayList<CharChop>();
       int index = 0;
       while ( (chars.length-index) > chopSize ) {
         String chop = new String(chars, index, chopSize);
-        chops.add(chop);
+        charChops.add(new CharChop(chop));
         index+=chopSize;
       }
       // add remainder chop
       String chop = new String(chars, index, chars.length-index);
-      chops.add(chop);
+      charChops.add(new CharChop(chop));
     }
-    return chops;
+    return charChops;
   }
 
-  public char[] glue(List<String> chops) {
-    if (chops!=null) {
+  public char[] glue(List<CharChop> charChops) {
+    if (charChops!=null) {
       StringWriter writer = new StringWriter();
       
-      Iterator<String> iter = chops.iterator();
-      while (iter.hasNext()) {
-        writer.write(iter.next());
+      for (CharChop charChop: charChops) {
+        writer.write(charChop.getText());
       }
       
       return writer.toString().toCharArray();

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategyClob.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategyClob.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategyClob.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -7,14 +7,14 @@
 
 public class ClobStrategyClob implements ClobStrategy {
 
-  public void set(char[] chars, Clob clob) {
+  public void set(char[] chars, Lob lob) {
     if (chars!=null) {
-      clob.setClob(Hibernate.createClob(new String(chars)));
+      lob.clob = Hibernate.createClob(new String(chars));
     }
   }
 
-  public char[] get(Clob clob) {
-    java.sql.Clob sqlClob = clob.getClob();
+  public char[] get(Lob lob) {
+    java.sql.Clob sqlClob = lob.clob;
     if (sqlClob!=null) {
       try {
         int length = (int) sqlClob.length();

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategyText.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategyText.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/ClobStrategyText.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -2,13 +2,13 @@
 
 public class ClobStrategyText implements ClobStrategy {
 
-  public char[] get(Clob clob) {
-    return clob.extractChars();
+  public char[] get(Lob lob) {
+    return lob.extractChars();
   }
 
-  public void set(char[] chars, Clob clob) {
+  public void set(char[] chars, Lob lob) {
     String text = new String(chars);
-    clob.setText(text);
+    lob.text = text;
   }
 
 }

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Lob.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Lob.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Lob.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -0,0 +1,106 @@
+/*
+ * 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.lob;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.jbpm.env.Environment;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Lob implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  public static final BlobStrategy DEFAULT_BLOB_STRATEGY = new BlobStrategyBlob();
+  public static final ClobStrategy DEFAULT_CLOB_STRATEGY = new ClobStrategyChopped();
+
+  protected long dbid;
+  protected int dbversion;
+  
+  // cachedBytes is used by the BlobStrategyBlob as hibernate doesn't allow 
+  // blobs to be read in the same session as they are created in.
+  // So cachedBytes should not be persisted 
+  protected byte[] cachedBytes = null;
+  protected java.sql.Blob blob = null;
+  protected byte[] bytes = null;
+  protected List<BytesChop> bytesChops = null;
+  
+  protected java.sql.Clob clob = null;
+  protected String text = null;
+  protected List<CharChop> charChops = null;
+
+
+  public long getDbid() {
+    return dbid;
+  }
+  
+  public Lob() {
+  }
+  
+  public Lob(byte[] bytes) {
+    getBlobStrategy().set(bytes, this);
+  }
+
+  public Lob(char[] text) {
+    getClobStrategy().set(text, this);
+  }
+
+
+  public char[] extractChars() {
+    return getClobStrategy().get(this);
+  }
+
+
+  
+  public byte[] extractBytes() {
+    return getBlobStrategy().get(this);
+  }
+
+  protected ClobStrategy getClobStrategy() {
+    ClobStrategy clobStrategy = null;
+    
+    Environment environment = Environment.getCurrent();
+    if (environment!=null) {
+      clobStrategy = environment.get(ClobStrategy.class);
+    }
+
+    if (clobStrategy==null) {
+      clobStrategy = DEFAULT_CLOB_STRATEGY;
+    }
+    
+    return clobStrategy;
+  }
+
+  protected BlobStrategy getBlobStrategy() {
+    BlobStrategy blobStrategy = Environment.getFromCurrent(BlobStrategy.class, false);
+
+    if (blobStrategy==null) {
+      blobStrategy = DEFAULT_BLOB_STRATEGY;
+    }
+    
+    return blobStrategy;
+  }
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/Lob.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/LobCached.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/LobCached.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/LobCached.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -0,0 +1,34 @@
+/*
+ * 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.lob;
+
+
+/** only diff with Lob is that this class will be cached in the second 
+ * level cache of hibernate.
+ * 
+ * @author Tom Baeyens
+ */
+public class LobCached extends Lob {
+
+  private static final long serialVersionUID = 1L;
+
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/lob/LobCached.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -34,7 +34,7 @@
 import org.jbpm.log.Log;
 import org.jbpm.model.IdGenerator;
 import org.jbpm.model.OpenProcessDefinition;
-import org.jbpm.pvm.internal.lob.Blob;
+import org.jbpm.pvm.internal.lob.Lob;
 import org.jbpm.pvm.internal.util.IoUtil;
 
 /**
@@ -69,9 +69,8 @@
   /** the activity which is executed when the process starts */
   protected ActivityImpl initial;
   
-  /** the attachments 
-   * TODO move the attachments to a separate DeploymentUnit type */
-  Map<String, Blob> attachments;
+  /** the attachments */
+  protected Map<String, Lob> attachments;
 
   public ProcessDefinitionImpl() {
     this.processDefinition = this;
@@ -134,26 +133,26 @@
   }
   
   public void addAttachment(String name, byte[] bytes) {
-    Blob blob = new Blob(bytes);
+    Lob lob = new Lob(bytes);
     if (attachments==null) {
-      attachments = new HashMap<String, Blob>();
+      attachments = new HashMap<String, Lob>();
     }
-    attachments.put(name, blob);
+    attachments.put(name, lob);
   }
 
-  public byte[] getAttachmentBytes(String name) {
+  public byte[] getAttachment(String name) {
     if (attachments==null) {
       return null;
     }
-    Blob blob = attachments.get(name);
-    if (blob==null) {
+    Lob lob = attachments.get(name);
+    if (lob==null) {
       return null;
     }
-    return blob.getBytes();
+    return lob.extractBytes();
   }
 
   public InputStream getAttachmentInputStream(String name) {
-    byte[] bytes = getAttachmentBytes(name);
+    byte[] bytes = getAttachment(name);
     if (bytes==null) {
       return null;
     }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -35,6 +35,7 @@
 import org.jbpm.pvm.internal.cmd.FindProcessDefinitionByIdCmd;
 import org.jbpm.pvm.internal.cmd.FindProcessDefinitionKeysCmd;
 import org.jbpm.pvm.internal.cmd.FindProcessDefinitionsByKeyCmd;
+import org.jbpm.pvm.internal.cmd.GetAttachment;
 import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
 
 /** {@link ProcessService} implementation that delegates execution of the 
@@ -74,12 +75,15 @@
     commandService.execute(new DeleteProcessDefinitionCmd(processDefinitionId, true));
   }
 
+  public byte[] getAttachment(String processDefinitionId, String name) {
+    return commandService.execute(new GetAttachment(processDefinitionId, name));
+  }
+  
+
   public ProcessDefinitionQuery createProcessDefinitionQuery() {
     return new ProcessDefinitionQueryImpl(commandService);
   }
 
-  
-
   public List<ProcessDefinition> deploy(Deployment deployment) {
     return commandService.execute(new DeployCmd((DeploymentImpl)deployment));
   }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/BlobVariable.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/BlobVariable.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/BlobVariable.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -21,14 +21,14 @@
  */
 package org.jbpm.pvm.internal.type.variable;
 
-import org.jbpm.pvm.internal.lob.Blob;
+import org.jbpm.pvm.internal.lob.Lob;
 import org.jbpm.pvm.internal.type.Variable;
 
 public class BlobVariable extends Variable {
 
   private static final long serialVersionUID = 1L;
   
-  protected Blob blob = null;
+  protected Lob lob = null;
 
   public boolean isStorable(Object value) {
     if (value==null) return true;
@@ -36,15 +36,15 @@
   }
 
   public Object getObject() {
-    if (blob==null) return null; 
-    return blob.extractBytes();
+    if (lob==null) return null; 
+    return lob.extractBytes();
   }
 
   public void setObject(Object value) {
-    this.blob = new Blob((byte[])value);
+    this.lob = new Lob((byte[])value);
   }
   
-  public Blob getBlob() {
-    return blob;
+  public Lob getLob() {
+    return lob;
   }
 }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/ClobVariable.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/ClobVariable.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/ClobVariable.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -21,7 +21,7 @@
  */
 package org.jbpm.pvm.internal.type.variable;
 
-import org.jbpm.pvm.internal.lob.Clob;
+import org.jbpm.pvm.internal.lob.Lob;
 import org.jbpm.pvm.internal.type.Variable;
 
 /**
@@ -31,7 +31,7 @@
 
   private static final long serialVersionUID = 1L;
   
-  protected Clob clob = null;
+  protected Lob lob = null;
 
   public boolean isStorable(Object value) {
     if (value==null) return true;
@@ -39,15 +39,15 @@
   }
 
   public Object getObject() {
-    if (clob==null) return null; 
-    return clob.extractChars();
+    if (lob==null) return null; 
+    return lob.extractChars();
   }
 
   public void setObject(Object value) {
-    this.clob = new Clob((char[])value);
+    this.lob = new Lob((char[])value);
   }
 
-  public Clob getClob() {
-    return clob;
+  public Lob getLob() {
+    return lob;
   }
 }

Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.definition.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.definition.hbm.xml	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.definition.hbm.xml	2009-02-06 17:13:10 UTC (rev 3791)
@@ -73,6 +73,14 @@
                  foreign-key="FK_PROCDEF_INITIAL"
                  index="IDX_PROCDEF_INIT"
                  fetch="select" />
+
+    <map name="attachments" cascade="all-delete-orphan">
+      <key foreign-key="FK_LOB_PROCESS">
+        <column name="PROCESS_" index="IDX_LOB_PROCESS" />
+      </key>
+      <map-key type="string" column="NAME_" />
+      <one-to-many class="org.jbpm.pvm.internal.lob.LobCached"/>
+    </map>
   </class>
 
   <!-- ### Activity ############################################################## -->
@@ -314,7 +322,7 @@
     </list>
   </class>
   
-    <!-- ### OBJECT REFERENCE ############################################### -->
+  <!-- ### OBJECT REFERENCE ############################################### -->
   <class name="ObjectReference" discriminator-value="objref" table="JBPM_OBJECTREF">
     <id name="dbid" column="DBID_">
       <generator class="native" />
@@ -341,6 +349,18 @@
         
   </class>
 
+  <!-- ### LOB ############################################################ -->
+  <class name="org.jbpm.pvm.internal.lob.LobCached" table="JBPM_LOB">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    <property name="blob" type="blob" column="BLOB_VALUE_" />
+    <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>
+
   <!-- ### VARIABLE DEFINITION ############################################ -->
   <class name="VariableDefinitionImpl" table="JBPM_VARIABLEDEF">
     <id name="dbid" column="DBID_">

Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.execution.hbm.xml	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.execution.hbm.xml	2009-02-06 17:13:10 UTC (rev 3791)
@@ -30,8 +30,7 @@
     
     <property name="hasTimers" column="HASTIMERS_" />
     <set name="timers"
-         cascade="all-delete-orphan"
-         table="JBPM_TIMER">
+         cascade="all-delete-orphan">
       <key foreign-key="FK_TMR_EXECUTION">
          <column name="EXECUTION_" />
       </key>

Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.variable.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.variable.hbm.xml	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.variable.hbm.xml	2009-02-06 17:13:10 UTC (rev 3791)
@@ -61,32 +61,32 @@
 	</subclass>
 	
 	<subclass name="BlobVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="B">
-	  <component name="blob" class="org.jbpm.pvm.internal.lob.Blob">
-	  		<property name="blob" type="blob" column="BLOB_VALUE_" />
-	  		<property name="bytes" type="binary" column="BINARY_VALUE_"/>
-	  		<property name="fileName" type="string" column="STRING_VALUE_"/>
-	  		<list name="chops" table="JBPM_BLOB_CHOPS">
-	  			<key foreign-key="FK_BLOB_CHOP_OWN">
-	  			  <column name="BLOB_ID_" index="IDX_BLOB_CHOP_OWN"/>
-	  			</key>
-	  			<list-index column="CHOP_INDEX_"/>
-	  			<element type="binary" column="CHOP_VALUE_"/>
-	  		</list>
-	  </component>
+    <many-to-one name="lob"
+                 column="LOB_" 
+                 cascade="all"
+                 class="org.jbpm.pvm.internal.lob.Lob"
+                 foreign-key="FK_VAR_LOB"
+                 index="IDX_VAR_LOB" />
 	</subclass>
 
 	<subclass name="ClobVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="C">
-	  <component name="clob" class="org.jbpm.pvm.internal.lob.Clob">
-	  		<property name="clob" type="clob" column="CLOB_VALUE_" />
-	  		<property name="text" type="text" column="TEXT_VALUE_"/>
-	  		<list name="chops" table="JBPM_CLOB_CHOPS">
-	  			<key foreign-key="FK_CLOB_CHOP_OWN">
-	  			  <column name="CLOB_ID_" index="IDX_CLOB_CHOP_OWN"></column>
-	  			</key>
-	  			<list-index column="CHOP_INDEX_"/>
-	  			<element type="string" column="CHOP_VALUE_"/>
-	  		</list>
-	  </component>
+    <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="JBPM_LOB">
+    <id name="dbid" column="DBID_">
+      <generator class="native" />
+    </id>
+    <version name="dbversion" column="DBVERSION_" />
+    <property name="blob" type="blob" column="BLOB_VALUE_" />
+    <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>
 
 </hibernate-mapping>
\ No newline at end of file

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -13,6 +13,8 @@
  **/
 package org.jbpm.pvm.internal.db.model;
 
+import java.io.InputStream;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
@@ -457,4 +459,28 @@
     assertEquals("val1", event.getProperty("key1"));
     assertEquals("val2", event.getProperty("key2"));
   }
+  
+  public void testProcessDefinitionAttachments() {
+    
+    if (true) {
+      System.err.print("FIXME: JBPM-1972 finish process attachments");
+      return;
+    }
+    
+    StringBuffer text = new StringBuffer();
+    for (int i=0; i<500; i++) {
+      text.append("This is a lot of bytes! ");
+    }
+    byte[] bytes = text.toString().getBytes();
+    
+    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
+    .startProcess()
+      .attachment("msgbytes", bytes)
+    .endProcess();
+
+    processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
+
+    byte[] retrievedBytes = processDefinition.getAttachment("msgbytes");
+    // assertTrue(Arrays.equals(bytes, retrievedBytes));
+  }
 }

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-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/type/VariableAutoTypeResolutionTest.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -28,7 +28,6 @@
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
-import java.util.List;
 
 import org.jbpm.pvm.activities.WaitState;
 import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
@@ -208,39 +207,26 @@
   public void testBytesVariable() {
     ExecutionImpl execution = startProcessInstance();
     
-    byte[] bytes = generateBytes();
+    byte[] bytes = generateBytes("a lot of bytes ", 500);
     execution.setVariable("v", bytes);
     
     Variable variable = execution.getVariableObject("v");
     assertEquals(BlobVariable.class, variable.getClass());
     
     BlobVariable blobVariable = (BlobVariable) variable;
-
     byte[] blobVariableBytes = (byte[]) blobVariable.getValue();
-    byte[] expected = bytes;
-
-    assertTrue(Arrays.equals(expected, blobVariableBytes));
+    assertTrue(Arrays.equals(bytes, blobVariableBytes));
   }
 
   public void testCharsVariable() {
     ExecutionImpl execution = startProcessInstance();
     
-    char[] chars = generateChars();
+    char[] chars = generateChars("a lot of bytes ", 500);
     execution.setVariable("v", chars);
     
     Variable variable = execution.getVariableObject("v");
     assertEquals(ClobVariable.class, variable.getClass());
-    ClobVariable clobVariable = (ClobVariable) variable;
-    List<String> chops = (List<String>) clobVariable.getClob().getChops();
     
-    int index = 0;
-    for (String chop: chops) {
-      String expected = new String(chars, index, chop.length());
-      assertEquals(expected, chop);
-      index += chop.length();
-    }
-    assertEquals(chars.length, index);
-    
     assertTrue(Arrays.equals(chars, (char[]) execution.getVariable("v")));
   }
 
@@ -291,22 +277,21 @@
       throw new RuntimeException("couldn't serialize", e);
     }
   }
-
   
-  String generateString() {
+  String generateString(String base, int multiplier) {
     StringBuffer buffer = new StringBuffer();
-    for (int i=0; i<500; i++) {
-      buffer.append("more bytes ");
+    for (int i=0; i<multiplier; i++) {
+      buffer.append(base);
     }
     String string = buffer.toString();
     return string;
   }
 
-  byte[] generateBytes() {
-    return generateString().getBytes();
+  byte[] generateBytes(String base, int multiplier) {
+    return generateString(base, multiplier).getBytes();
   }
 
-  char[] generateChars() {
-    return generateString().toCharArray();
+  char[] generateChars(String base, int multiplier) {
+    return generateString(base, multiplier).toCharArray();
   }
 }

Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -50,8 +50,12 @@
 
   protected static CommandService commandService;
 
-  protected List<ProcessDefinition> processDefinitions;
-  protected List<String> taskIds;
+  /** registered process definitions will be deleted automatically in the tearDown.
+   * This is a convenience function as each test is expected to clean up the DB. */
+  protected List<ProcessDefinition> registeredProcessDefinitions;
+  /** registered tasks will be deleted automatically in the tearDown.
+   * This is a convenience function as each test is expected to clean up the DB. */
+  protected List<String> registeredTaskIds;
 
   protected void setUp() throws Exception {
     super.setUp();
@@ -80,14 +84,14 @@
   }
 
   protected void tearDown() throws Exception {
-    if (processDefinitions!=null) {
-      for (ProcessDefinition processDefinition : processDefinitions) {
+    if (registeredProcessDefinitions!=null) {
+      for (ProcessDefinition processDefinition : registeredProcessDefinitions) {
         processService.deleteProcessDefinitionAndInstances(processDefinition.getId());
       }
     }
 
-    if (taskIds != null) {
-      for (String taskId : taskIds) {
+    if (registeredTaskIds != null) {
+      for (String taskId : registeredTaskIds) {
         taskService.deleteTask(taskId);
       }
     }
@@ -104,7 +108,7 @@
         .deploy()
         .getProcessDefinitions();
     
-    return addDeployedProcessDefinition(deployedProcessDefinitions);
+    return registerDeployedProcessDefinitions(deployedProcessDefinitions);
   }
 
   public ProcessDefinition deployJpdlResource(String resource) {
@@ -114,25 +118,25 @@
         .deploy()
         .getProcessDefinitions();
     
-    return addDeployedProcessDefinition(deployedProcessDefinitions);
+    return registerDeployedProcessDefinitions(deployedProcessDefinitions);
   }
 
   protected ProcessDefinition addDeployedProcessDefinition(ProcessDefinition deployedProcessDefinition) {
-    if (processDefinitions==null) {
-      processDefinitions = new ArrayList<ProcessDefinition>();
+    if (registeredProcessDefinitions==null) {
+      registeredProcessDefinitions = new ArrayList<ProcessDefinition>();
     }
     
-    processDefinitions.add(deployedProcessDefinition);
+    registeredProcessDefinitions.add(deployedProcessDefinition);
     
     return deployedProcessDefinition;
   }
 
-  protected ProcessDefinition addDeployedProcessDefinition(List<ProcessDefinition> deployedProcessDefinitions) {
-    if (processDefinitions==null) {
-      processDefinitions = new ArrayList<ProcessDefinition>();
+  protected ProcessDefinition registerDeployedProcessDefinitions(List<ProcessDefinition> deployedProcessDefinitions) {
+    if (registeredProcessDefinitions==null) {
+      registeredProcessDefinitions = new ArrayList<ProcessDefinition>();
     }
     
-    processDefinitions.addAll(deployedProcessDefinitions);
+    registeredProcessDefinitions.addAll(deployedProcessDefinitions);
     
     if (deployedProcessDefinitions.size()>=1) {
       return deployedProcessDefinitions.get(0);
@@ -141,13 +145,13 @@
     return null;
   }
 
-  public void saveTask(Task task) {
+  public void saveAndRegisterTask(Task task) {
     taskService.saveTask(task);
     
-    if (taskIds == null) {
-      taskIds = new ArrayList<String>();
+    if (registeredTaskIds == null) {
+      registeredTaskIds = new ArrayList<String>();
     }
-    taskIds.add(task.getId());
+    registeredTaskIds.add(task.getId());
   }
 
   public HashSet<String> getActivityNames(String processInstanceId) {

Added: jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/process/ProcessAttachmentsTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/process/ProcessAttachmentsTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/process/ProcessAttachmentsTest.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.process;
+
+import java.io.ByteArrayInputStream;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jbpm.ProcessDefinition;
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessAttachmentsTest extends DbTestCase {
+
+  public void testProcessWithNameOnly() {
+    byte[] lotOfBytes = generateString("a lot of bytes ", 5000).getBytes();
+    byte[] otherBytes = generateString("other bytes ", 5000).getBytes();
+    
+    List<ProcessDefinition> deployedProcessDefinitions = 
+    processService.createDeployment()
+      .addString("xmlstring.jpdl.xml", 
+                 "<process name='Insurance claim'>" +
+                 "  <start />" +
+                 "</process>")
+      .addInputStream("a lot of attachment", new ByteArrayInputStream(lotOfBytes))
+      .addInputStream("other attachment", new ByteArrayInputStream(otherBytes))
+      .deploy()
+      .getProcessDefinitions();
+    ProcessDefinition processDefinition = registerDeployedProcessDefinitions(deployedProcessDefinitions);
+
+    byte[] retrievedLotOfBytes = processService.getAttachment(processDefinition.getId(), "a lot of attachment");
+    assertTrue(Arrays.equals(lotOfBytes, retrievedLotOfBytes));
+    
+    byte[] retrievedOtherBytes = processService.getAttachment(processDefinition.getId(), "other attachment");
+    assertTrue(Arrays.equals(otherBytes, retrievedOtherBytes));
+  }
+
+  protected String generateString(String base, int multiplier) {
+    StringBuffer buffer = new StringBuffer();
+    for (int i=0; i<multiplier; i++) {
+      buffer.append(base);
+    }
+    String string = buffer.toString();
+    return string;
+  }
+}


Property changes on: jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/process/ProcessAttachmentsTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -43,13 +43,13 @@
     String taskId = task.getId();
     assertNull("expected null, but was " + taskId, taskId);
     // save task to generate identifier
-    saveTask(task);
+    saveAndRegisterTask(task);
     assertNotNull(task.getId());
   }
 
   public void testSaveTask() {
     Task task = taskService.newTask();
-    saveTask(task);
+    saveAndRegisterTask(task);
     String taskId = task.getId();
     // task was made persistent
     task = taskService.getTask(taskId); 

Modified: jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/task/TaskListTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/task/TaskListTest.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/task/TaskListTest.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -36,22 +36,22 @@
     Task task = taskService.newTask();
     task.setName("do laundry");
     task.setAssignee("johndoe");
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     task = taskService.newTask();
     task.setName("get good idea");
     task.setAssignee("joesmoe");
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     task = taskService.newTask();
     task.setName("find venture capital");
     task.setAssignee("joesmoe");
-    saveTask(task);
+    saveAndRegisterTask(task);
     
     task = taskService.newTask();
     task.setName("start new business");
     task.setAssignee("joesmoe");
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
     assertNotNull(taskList);
@@ -74,31 +74,31 @@
     task.setName("get good idea");
     task.setAssignee("joesmoe");
     task.setPriority(3);
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     task = taskService.newTask();
     task.setName("find venture capital");
     task.setAssignee("joesmoe");
     task.setPriority(2);
-    saveTask(task);
+    saveAndRegisterTask(task);
     
     task = taskService.newTask();
     task.setName("start new business");
     task.setAssignee("joesmoe");
     task.setPriority(1);
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     task = taskService.newTask();
     task.setName("take a day off");
     task.setAssignee("joesmoe");
     task.setPriority(-5);
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     task = taskService.newTask();
     task.setName("make profit");
     task.setAssignee("joesmoe");
     task.setPriority(10);
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     List<Task> taskList = taskService.getPersonalTaskList("joesmoe", 0, 10);
     assertNotNull(taskList);

Modified: jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/task/TaskQueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/task/TaskQueryTest.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/task/TaskQueryTest.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -38,24 +38,24 @@
     task.setName("do laundry");
     task.setAssignee("johndoe");
     task.setPriority(3);
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     task = taskService.newTask();
     task.setName("change dyper");
     task.setAssignee("johndoe");
     task.setPriority(1);
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     task = taskService.newTask();
     task.setName("start new business");
     task.setAssignee("joesmoe");
     task.setPriority(4);
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     task = taskService.newTask();
     task.setName("find venture capital");
     task.setPriority(4);
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     List<Task> taskList = taskService
       .createTaskQuery()
@@ -75,24 +75,24 @@
     task.setName("do laundry");
     task.setAssignee("johndoe");
     task.setPriority(3);
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     task = taskService.newTask();
     task.setName("change dyper");
     task.setAssignee("johndoe");
     task.setPriority(1);
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     task = taskService.newTask();
     task.setName("start new business");
     task.setAssignee("joesmoe");
     task.setPriority(4);
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     task = taskService.newTask();
     task.setName("find venture capital");
     task.setPriority(7);
-    saveTask(task);
+    saveAndRegisterTask(task);
 
     List<Task> taskList = taskService
       .createTaskQuery()

Modified: jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/variables/VariableBasicTypesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/variables/VariableBasicTypesTest.java	2009-02-06 14:41:27 UTC (rev 3790)
+++ jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/variables/VariableBasicTypesTest.java	2009-02-06 17:13:10 UTC (rev 3791)
@@ -117,6 +117,15 @@
   }
   
   public void testVariableTypeSerializable() {
-    checkVariableValue(new SerializeMe("hello world"));
+    checkVariableValue(new SerializeMe(generateString("a lot of text ", 500)));
   }
+  
+  protected String generateString(String base, int multiplier) {
+    StringBuffer buffer = new StringBuffer();
+    for (int i=0; i<multiplier; i++) {
+      buffer.append(base);
+    }
+    String string = buffer.toString();
+    return string;
+  }
 }




More information about the jbpm-commits mailing list