[jbpm-commits] JBoss JBPM SVN: r5260 - in jbpm4/branches/jbpm-4.0/modules: pvm/src/main/java/org/jbpm/pvm/internal/model and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jul 8 14:48:00 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-07-08 14:48:00 -0400 (Wed, 08 Jul 2009)
New Revision: 5260

Modified:
   jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java
   jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
   jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
   jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
   jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java
   jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
Log:
JBPM-2393 fixed audit logs, make variable history optional, default is disabled

Modified: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java	2009-07-08 18:12:04 UTC (rev 5259)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java	2009-07-08 18:48:00 UTC (rev 5260)
@@ -104,10 +104,6 @@
    * the type automagically. */
   void createVariable(String key, Object value);
 
-  /** create a new variable in this execution scope with  
-   * the given type name. */
-  void createVariable(String key, Object value, String typeName);
-  
   // priority /////////////////////////////////////////////////////////////////
   
   /** setter for the priority.  The default priority is 0, which means 

Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java	2009-07-08 18:12:04 UTC (rev 5259)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java	2009-07-08 18:48:00 UTC (rev 5260)
@@ -51,14 +51,12 @@
 import org.jbpm.pvm.internal.env.Environment;
 import org.jbpm.pvm.internal.env.ExecutionContext;
 import org.jbpm.pvm.internal.history.HistoryEvent;
-import org.jbpm.pvm.internal.history.HistorySession;
 import org.jbpm.pvm.internal.history.events.ActivityEnd;
 import org.jbpm.pvm.internal.history.events.ActivityStart;
 import org.jbpm.pvm.internal.history.events.AutomaticEnd;
 import org.jbpm.pvm.internal.history.events.DecisionEnd;
-import org.jbpm.pvm.internal.history.events.ProcessInstanceEnd;
 import org.jbpm.pvm.internal.history.events.ProcessInstanceCreate;
-import org.jbpm.pvm.internal.history.events.TaskActivityStart;
+import org.jbpm.pvm.internal.history.events.ProcessInstanceEnd;
 import org.jbpm.pvm.internal.job.JobImpl;
 import org.jbpm.pvm.internal.job.MessageImpl;
 import org.jbpm.pvm.internal.model.op.AtomicOperation;
@@ -70,11 +68,8 @@
 import org.jbpm.pvm.internal.session.RepositorySession;
 import org.jbpm.pvm.internal.session.TimerSession;
 import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
-import org.jbpm.pvm.internal.task.ParticipationImpl;
 import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
 import org.jbpm.pvm.internal.task.SwimlaneImpl;
-import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.task.TaskImpl;
 import org.jbpm.pvm.internal.type.Variable;
 import org.jbpm.pvm.internal.util.EqualsUtil;
 import org.jbpm.pvm.internal.util.Priority;
@@ -923,7 +918,7 @@
   }
 
   public void createSystemVariable(String key, Object value, String typeName) {
-    Variable variable = createVariableObject(key, value, typeName);
+    Variable variable = createVariableObject(key, value, typeName, false);
     systemVariables.put(variable.getKey(), variable);
   }
 

Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java	2009-07-08 18:12:04 UTC (rev 5259)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java	2009-07-08 18:48:00 UTC (rev 5260)
@@ -75,22 +75,23 @@
         String key = variableDefinition.getName();
         Object value = variableDefinition.getInitValue(outerExecution);
         String typeName = variableDefinition.getTypeName();
-        createVariable(key, value, typeName);
+        boolean isHistoryEnabled = variableDefinition.isHistoryEnabled();
+        createVariable(key, value, typeName, isHistoryEnabled);
       }
     }
   }
 
   public void createVariable(String key, Object value) {
-    createVariable(key, value, null);
+    createVariable(key, value, null, false);
   }
 
-  public void createVariable(String key, Object value, String typeName) {
-    Variable variable = createVariableObject(key, value, typeName);
+  public void createVariable(String key, Object value, String typeName, boolean isHistoryEnabled) {
+    Variable variable = createVariableObject(key, value, typeName, isHistoryEnabled);
     variables.put(variable.getKey(), variable);
     hasVariables = true;
   }
 
-  protected Variable createVariableObject(String key, Object value, String typeName) {
+  protected Variable createVariableObject(String key, Object value, String typeName, boolean isHistoryEnabled) {
     log.debug("create variable '"+key+"' in '"+this+"' with value '"+value+"'");
     
     Type type = null;
@@ -133,8 +134,11 @@
     variable.setKey(key);
     variable.setExecution(getExecution());
     variable.setTask(getTask());
+    variable.setHistoryEnabled(isHistoryEnabled);
 
-    HistoryEvent.fire(new VariableCreate(variable));
+    if (isHistoryEnabled) {
+      HistoryEvent.fire(new VariableCreate(variable));
+    }
     
     variable.setValue(value);
 
@@ -158,7 +162,7 @@
       variable.setValue(value);
 
     } else if (getParentVariableScope()==null) {
-      createVariable(key, value, null);
+      createVariable(key, value, null, false);
 
     } else {
       getParentVariableScope().setVariable(key,value);

Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java	2009-07-08 18:12:04 UTC (rev 5259)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java	2009-07-08 18:48:00 UTC (rev 5260)
@@ -43,6 +43,7 @@
 
   protected String name;
   protected String typeName;
+  protected boolean isHistoryEnabled;
 
   protected String initExpression;
   protected String initLanguage;
@@ -89,4 +90,10 @@
   public void setInitLanguage(String initLanguage) {
     this.initLanguage = initLanguage;
   }
+  public boolean isHistoryEnabled() {
+    return isHistoryEnabled;
+  }
+  public void setHistoryEnabled(boolean isHistoryEnabled) {
+    this.isHistoryEnabled = isHistoryEnabled;
+  }
 }

Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java	2009-07-08 18:12:04 UTC (rev 5259)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java	2009-07-08 18:48:00 UTC (rev 5260)
@@ -45,6 +45,7 @@
   protected String key = null;
   protected Converter converter = null;
   protected String textValue = null;
+  protected boolean isHistoryEnabled = false;
   
   protected ExecutionImpl execution;
   protected TaskImpl task;
@@ -89,7 +90,9 @@
     setObject(value);
     
     HistorySession historySession = Environment.getFromCurrent(HistorySession.class, false);
-    if (historySession!=null) {
+    if ( isHistoryEnabled 
+         && (historySession!=null)
+       ) {
       HistoryEvent.fire(new VariableUpdate(this));
     }
   }
@@ -108,7 +111,7 @@
   public String toString() {
     return "${"+key+"}";
   }
-  
+
   public Type getType() {
     Type type = new Type();
     type.setConverter(converter);
@@ -152,4 +155,10 @@
   public void setTask(TaskImpl task) {
     this.task = task;
   }
+  public boolean isHistoryEnabled() {
+    return isHistoryEnabled;
+  }
+  public void setHistoryEnabled(boolean isHistoryEnabled) {
+    this.isHistoryEnabled = isHistoryEnabled;
+  }
 }

Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml	2009-07-08 18:12:04 UTC (rev 5259)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml	2009-07-08 18:48:00 UTC (rev 5260)
@@ -125,6 +125,8 @@
     
     <property name="key" column="KEY_"/>
     <property name="converter" type="converter" column="CONVERTER_" />
+    <property name="isHistoryEnabled" column="HIST_" />
+    
     <many-to-one name="execution"
                  column="EXECUTION_" 
                  class="org.jbpm.pvm.internal.model.ExecutionImpl"




More information about the jbpm-commits mailing list