You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2009/03/27 18:03:06 UTC
svn commit: r759268 - in
/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow: ./ client/
definition/ impl/
Author: doogie
Date: Fri Mar 27 17:03:06 2009
New Revision: 759268
URL: http://svn.apache.org/viewvc?rev=759268&view=rev
Log:
Fix lines that *only* have whitespace.
Modified:
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/EvaluationException.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/TransitionCondition.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfFactory.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfProcess.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfUtil.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WorkflowEngine.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/StartActivityJob.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowClient.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/ServiceCondition.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityAbstractImplementation.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityImpl.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityToolImplementation.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfAssignmentImpl.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfEventAuditImpl.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfExecutionObjectImpl.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfProcessImpl.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfProcessMgrImpl.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfRequesterImpl.java
ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfResourceImpl.java
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/EvaluationException.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/EvaluationException.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/EvaluationException.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/EvaluationException.java Fri Mar 27 17:03:06 2009
@@ -22,15 +22,15 @@
* Transition Evaluation Workflow Exception
*/
public class EvaluationException extends WfException {
-
+
public EvaluationException() {
super();
}
-
+
public EvaluationException(String msg) {
super(msg);
}
-
+
public EvaluationException(String msg, Throwable nested) {
super(msg, nested);
}
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/TransitionCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/TransitionCondition.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/TransitionCondition.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/TransitionCondition.java Fri Mar 27 17:03:06 2009
@@ -26,7 +26,7 @@
* TransitionCondition - Interface for implementing transition conditions
*/
public interface TransitionCondition {
-
+
/**
* Evaluate a condition and return the result as a Boolean
* @param context Map of environment info (processContext) for use in evaluation
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfFactory.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfFactory.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfFactory.java Fri Mar 27 17:03:06 2009
@@ -38,12 +38,12 @@
* WfFactory - Workflow Factory Class
*/
public class WfFactory {
-
+
public static final String module = WfFactory.class.getName();
-
+
protected static UtilCache wfProcessMgrCache = new UtilCache("workflow.processmgr");
protected static UtilCache wfClientCache = new UtilCache("workflow.client");
-
+
/**
* Creates a new {@link WfActivity} instance.
* @param value GenericValue object defining this activity.
@@ -135,7 +135,7 @@
if (delegator == null) throw new WfException("Delegator cannot be null");
if (pkg == null) throw new WfException("Workflow package id cannot be null.");
if (pid == null) throw new WfException("Workflow process id cannot be null");
-
+
String key = delegator.getDelegatorName() + ":" + pkg + ":" + pkver + ":" + pid + ":" + pver;
if (!wfProcessMgrCache.containsKey(key)) {
synchronized (WfFactory.class) {
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfProcess.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfProcess.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfProcess.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfProcess.java Fri Mar 27 17:03:06 2009
@@ -105,7 +105,7 @@
* @throws AlreadyRunning
*/
public void start() throws WfException, CannotStart, AlreadyRunning;
-
+
/**
* Starts the Workflow process on the defined activity
* @param activityId The activity to start
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfUtil.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfUtil.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfUtil.java Fri Mar 27 17:03:06 2009
@@ -26,11 +26,11 @@
* WorkflowUtil - Workflow Engine Utilities
*/
public final class WfUtil {
-
+
private static final Map typeMap = UtilMisc.toMap("WDT_BOOLEAN", "java.lang.Boolean",
"WDT_STRING", "java.lang.String", "WDT_INTEGER", "java.lang.Long",
"WDT_FLOAT", "java.lang.Double", "WDT_DATETIME", "java.sql.Timestamp");
-
+
/**
* Gets the Java type from a XPDL datatype
* @param xpdlType XPDL data type to be translated
@@ -42,7 +42,7 @@
else
return "java.lang.Object";
}
-
+
/**
* Returns the OFB status code which refers to the passed OMG status code
* @param state
@@ -78,6 +78,6 @@
}
return null;
}
-
-
+
+
}
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WorkflowEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WorkflowEngine.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WorkflowEngine.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WorkflowEngine.java Fri Mar 27 17:03:06 2009
@@ -52,7 +52,7 @@
public WorkflowEngine(ServiceDispatcher dispatcher) {
super(dispatcher);
}
-
+
/**
* @see org.ofbiz.service.engine.GenericEngine#runSync(java.lang.String, org.ofbiz.service.ModelService, java.util.Map)
*/
@@ -61,21 +61,21 @@
runAsync(localName, modelService, context, waiter, false);
return waiter.waitForResult();
}
-
+
/**
* @see org.ofbiz.service.engine.GenericEngine#runSyncIgnore(java.lang.String, org.ofbiz.service.ModelService, java.util.Map)
*/
public void runSyncIgnore(String localName, ModelService modelService, Map context) throws GenericServiceException {
runAsync(localName, modelService, context, null, false);
}
-
+
/**
* @see org.ofbiz.service.engine.GenericEngine#runAsync(java.lang.String, org.ofbiz.service.ModelService, java.util.Map, boolean)
*/
public void runAsync(String localName, ModelService modelService, Map context, boolean persist) throws GenericServiceException {
runAsync(localName, modelService, context, null, persist);
}
-
+
/**
* @see org.ofbiz.service.engine.GenericEngine#runAsync(java.lang.String, org.ofbiz.service.ModelService, java.util.Map, org.ofbiz.service.GenericRequester, boolean)
*/
@@ -90,7 +90,7 @@
} catch (GenericTransactionException e) {
Debug.logError(e, "Cannot begin nested transaction: " + e.getMessage(), module);
}
-
+
// Build the requester
WfRequester req = null;
try {
@@ -166,7 +166,7 @@
Debug.logError(e, "Un-handled process exception", module);
throw new GenericServiceException(e.getMessage(), e);
}
-
+
// Assign the owner of the process
GenericValue userLogin = null;
if (context.containsKey("userLogin")) {
@@ -198,10 +198,10 @@
throw new GenericServiceException(errMsg);
}
}
-
+
// Grab the locale from the context
Locale locale = (Locale) context.remove("locale");
-
+
// Grab the starting activityId from the context
String startActivityId = (String) context.remove("startWithActivityId");
@@ -221,7 +221,7 @@
}
throw new GenericServiceException(wfe.getMessage(), wfe);
}
-
+
// Set the initial locale - (in context)
if (locale != null) {
try {
@@ -237,7 +237,7 @@
throw new GenericServiceException(wfe.getMessage(), wfe);
}
}
-
+
// Use the WorkflowRunner to start the workflow in a new thread
try {
Job job = new WorkflowRunner(process, requester, startActivityId);
@@ -251,7 +251,7 @@
}
throw new GenericServiceException(je.getMessage(), je);
}
-
+
try {
TransactionUtil.commit(beganTransaction);
} catch (GenericTransactionException e) {
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/StartActivityJob.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/StartActivityJob.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/StartActivityJob.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/StartActivityJob.java Fri Mar 27 17:03:06 2009
@@ -30,7 +30,7 @@
* Workflow Client API - Start Activity Async-Job
*/
public class StartActivityJob extends AbstractJob {
-
+
public static final String module = StartActivityJob.class.getName();
protected WfActivity activity = null;
@@ -39,7 +39,7 @@
public StartActivityJob(WfActivity activity) {
this(activity, null);
}
-
+
public StartActivityJob(WfActivity activity, GenericRequester requester) {
super(activity.toString() + "." + System.currentTimeMillis(), activity.toString());
this.activity = activity;
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowClient.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowClient.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowClient.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowClient.java Fri Mar 27 17:03:06 2009
@@ -44,12 +44,12 @@
public class WorkflowClient {
public static final String module = WorkflowClient.class.getName();
-
+
protected GenericDelegator delegator = null;
protected LocalDispatcher dispatcher = null;
-
+
protected WorkflowClient() {}
-
+
/**
* Get a new instance of the Workflow Client
* @param delegator the GenericDelegator object which matchs the delegator used by the workflow engine.
@@ -139,11 +139,11 @@
public WfAssignment delegate(String workEffortId, String fromPartyId, String fromRoleTypeId, Timestamp fromFromDate, String toPartyId, String toRoleTypeId, Timestamp toFromDate) throws WfException {
WfActivity activity = WfFactory.getWfActivity(delegator, workEffortId);
WfAssignment fromAssign = null;
-
+
// check status and delegateAfterStart attribute
if (activity.state().equals("open.running") && !activity.getDefinitionObject().getBoolean("delegateAfterStart").booleanValue())
throw new WfException("This activity cannot be delegated once it has been started");
-
+
if (fromPartyId == null && fromRoleTypeId == null && fromFromDate == null) {
Iterator i = activity.getIteratorAssignment();
fromAssign = (WfAssignment) i.next();
@@ -157,7 +157,7 @@
fromAssign = WfFactory.getWfAssignment(delegator, workEffortId, fromPartyId, fromRoleTypeId, fromFromDate);
}
fromAssign.delegate();
-
+
// check for a restartOnDelegate
WfActivity newActivity = null;
if (activity.getDefinitionObject().getBoolean("restartOnDelegate").booleanValue()) {
@@ -174,14 +174,14 @@
newActivity = WfFactory.getWfActivity(activity.getDefinitionObject(), parentProcessId);
}
}
-
+
WfAssignment assign = null;
if (newActivity != null) {
assign = assign(newActivity.runtimeKey(), toPartyId, toRoleTypeId, toFromDate, true);
} else {
assign = assign(workEffortId, toPartyId, toRoleTypeId, toFromDate, true);
}
-
+
return assign;
}
@@ -199,7 +199,7 @@
WfAssignment assign = delegate(workEffortId, fromPartyId, fromRoleTypeId, fromFromDate, toPartyId, toRoleTypeId, toFromDate);
assign.accept();
Debug.logVerbose("Delegated assignment.", module);
-
+
if (start) {
Debug.logVerbose("Starting activity.", module);
if (!activityRunning(assign.activity())) {
@@ -222,13 +222,13 @@
if (dispatcher == null) {
throw new WfException("LocalDispatcher is null; cannot create job for activity startup");
}
-
+
WfActivity activity = WfFactory.getWfActivity(delegator, workEffortId);
if (Debug.verboseOn()) Debug.logVerbose("Starting activity: " + activity.name(), module);
if (activityRunning(activity))
throw new WfException("Activity is already running");
-
+
Job job = new StartActivityJob(activity);
if (Debug.verboseOn()) Debug.logVerbose("Job: " + job, module);
@@ -237,7 +237,7 @@
} catch (JobManagerException e) {
throw new WfException(e.getMessage(), e);
}
-
+
}
/**
@@ -255,7 +255,7 @@
assign.setResult(result);
assign.complete();
}
-
+
/**
* Suspend an activity
* @param workEffortId The WorkEffort entity key for the activity object
@@ -263,14 +263,14 @@
*/
public void suspend(String workEffortId) throws WfException {
WfActivity activity = WfFactory.getWfActivity(delegator, workEffortId);
-
+
if (Debug.verboseOn()) Debug.logVerbose("Suspending activity: " + activity.name(), module);
if (!activityRunning(activity))
throw new WfException("Activity is not running");
-
+
activity.suspend();
}
-
+
/**
* Resume an activity
* @param workEffortId The WorkEffort entity key for the activity object
@@ -285,7 +285,7 @@
activity.resume();
}
-
+
/**
* Abort a process
* @param workEffortId The workeffort entity key for the process to abort
@@ -295,7 +295,7 @@
WfProcess process = WfFactory.getWfProcess(delegator, workEffortId);
process.abort();
}
-
+
/**
* Append data to the execution object's process context.
* @param workEffortId The WorkEffort entity key for the execution object.
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java Fri Mar 27 17:03:06 2009
@@ -46,7 +46,7 @@
* Workflow Services - 'Services' and 'Workers' for interaction with Workflow API
*/
public class WorkflowServices {
-
+
public static final String module = WorkflowServices.class.getName();
// -------------------------------------------------------------------
@@ -59,7 +59,7 @@
GenericDelegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
String workEffortId = (String) context.get("workEffortId");
-
+
// if we passed in an activity id, lets get the process id instead
try {
GenericValue testObject = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId));
@@ -82,7 +82,7 @@
result.put(ModelService.ERROR_MESSAGE, "Problems looking up runtime object; invalid id");
return result;
}
-
+
GenericValue userLogin = (GenericValue) context.get("userLogin");
if (!hasPermission(security, workEffortId, userLogin)) {
@@ -100,7 +100,7 @@
}
return result;
}
-
+
/** Suspend activity */
public static Map suspendActivity(DispatchContext ctx, Map context) {
Map result = new HashMap();
@@ -125,7 +125,7 @@
}
return result;
}
-
+
/** Resume activity */
public static Map resumeActivity(DispatchContext ctx, Map context) {
Map result = new HashMap();
@@ -281,7 +281,7 @@
String partyId = (String) context.get("partyId");
String roleType = (String) context.get("roleTypeId");
Timestamp fromDate = (Timestamp) context.get("fromDate");
-
+
try {
WorkflowClient client = WfFactory.getClient(ctx);
client.acceptAndStart(workEffortId, partyId, roleType, fromDate);
@@ -294,7 +294,7 @@
return result;
}
-
+
/** Delegate an assignment */
public static Map delegateAssignment(DispatchContext ctx, Map context) {
Map result = new HashMap();
@@ -305,7 +305,7 @@
String toParty = (String) context.get("toPartyId");
String toRole = (String) context.get("toRoleTypeId");
Timestamp toFromDate = (Timestamp) context.get("toFromDate");
-
+
// optional fromDate (default now)
if (toFromDate == null)
toFromDate = UtilDateTime.nowTimestamp();
@@ -321,7 +321,7 @@
}
return result;
}
-
+
/** Delegate, accept an assignment */
public static Map delegateAcceptAssignment(DispatchContext ctx, Map context) {
Map result = new HashMap();
@@ -333,16 +333,16 @@
String toRole = (String) context.get("toRoleTypeId");
Timestamp toFromDate = (Timestamp) context.get("toFromDate");
Boolean startObj = (Boolean) context.get("startActivity");
-
+
// optional start activity (default false)
boolean start = false;
if (startObj != null)
start = startObj.booleanValue();
-
+
// optional fromDate (default now)
if (toFromDate == null)
toFromDate = UtilDateTime.nowTimestamp();
-
+
try {
WorkflowClient client = new WorkflowClient(ctx);
client.delegateAndAccept(workEffortId, fromParty, fromRole, fromFromDate, toParty, toRole, toFromDate, start);
@@ -354,7 +354,7 @@
}
return result;
}
-
+
/** Accept a role assignment and attempt to start the activity */
public static Map acceptRoleAssignment(DispatchContext ctx, Map context) {
Map result = new HashMap();
@@ -362,7 +362,7 @@
String partyId = (String) context.get("partyId");
String roleType = (String) context.get("roleTypeId");
Timestamp fromDate = (Timestamp) context.get("fromDate");
-
+
try {
WorkflowClient client = new WorkflowClient(ctx);
client.delegateAndAccept(workEffortId, "_NA_", roleType, fromDate, partyId, roleType, fromDate, true);
@@ -392,7 +392,7 @@
result.put(ModelService.ERROR_MESSAGE, "You do not have permission to access this assignment");
return result;
}
-
+
try {
WorkflowClient client = WfFactory.getClient(ctx);
client.complete(workEffortId, partyId, roleType, fromDate, actResults);
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java Fri Mar 27 17:03:06 2009
@@ -62,7 +62,7 @@
* datasource through the given delegator */
public static void importXpdl(URL location, GenericDelegator delegator) throws DefinitionParserException {
List values = readXpdl(location, delegator);
-
+
// attempt to start a transaction
boolean beganTransaction = false;
try {
@@ -70,7 +70,7 @@
} catch (GenericTransactionException gte) {
Debug.logError(gte, "Unable to begin transaction", module);
}
-
+
try {
delegator.storeAll(values);
TransactionUtil.commit(beganTransaction);
@@ -520,7 +520,7 @@
List transitions = UtilXml.childElementList(transitionsElement, "Transition");
readTransitions(transitions, packageId, packageVersion, processId, processVersion);
-
+
// ExtendedAttributes?
workflowProcessValue.set("defaultStartActivityId", getExtendedAttributeValue(workflowProcessElement, "defaultStartActivityId", workflowProcessValue.getString("defaultStartActivityId")));
workflowProcessValue.set("sourceReferenceField", getExtendedAttributeValue(workflowProcessElement, "sourceReferenceField", "sourceReferenceId"));
@@ -912,7 +912,7 @@
// Description?
transitionValue.set("description", UtilXml.childElementValue(transitionElement, "Description"));
-
+
// ExtendedAttributes?
Element extendedAttributesElement = UtilXml.firstChildElement(transitionElement, "ExtendedAttributes");
List extendedAttributes = UtilXml.childElementList(extendedAttributesElement, "ExtendedAttribute");
@@ -1012,21 +1012,21 @@
if (participants == null || participants.size() == 0)
return;
Iterator participantsIter = participants.iterator();
-
+
while (participantsIter.hasNext()) {
Element participantElement = (Element) participantsIter.next();
String participantId = participantElement.getAttribute("Id");
GenericValue participantValue = delegator.makeValue("WorkflowParticipant");
-
+
values.add(participantValue);
-
+
participantValue.set("packageId", packageId);
participantValue.set("packageVersion", packageVersion);
participantValue.set("processId", processId);
participantValue.set("processVersion", processVersion);
participantValue.set("participantId", participantId);
participantValue.set("participantName", participantElement.getAttribute("Name"));
-
+
// ParticipantType
Element participantTypeElement = UtilXml.firstChildElement(participantElement, "ParticipantType");
@@ -1042,7 +1042,7 @@
participantValue.set("roleTypeId", getExtendedAttributeValue(participantElement, "roleTypeId", null), false);
}
}
-
+
/*
protected void readParticipants(List participants, String packageId, String packageVersion, String processId, String processVersion, GenericValue valueObject) throws DefinitionParserException {
if (participants == null || participants.size() == 0)
@@ -1302,7 +1302,7 @@
}
return defaultValue;
}
-
+
// ---------------------------------------------------------
// RUNTIME, TEST, AND SAMPLE METHODS
// ---------------------------------------------------------
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/ServiceCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/ServiceCondition.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/ServiceCondition.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/ServiceCondition.java Fri Mar 27 17:03:06 2009
@@ -45,16 +45,16 @@
String serviceName = (String) attrs.get("serviceName");
if (serviceName == null || serviceName.length() == 0)
throw new EvaluationException("Invalid serviceName; be sure to set the serviceName ExtendedAttribute");
-
+
// get the dispatcher
LocalDispatcher dispatcher = dctx.getDispatcher();
if (dispatcher == null)
throw new EvaluationException("Bad LocalDispatcher found in the DispatchContext");
-
+
// create a map of all context and extended attributes, attributes will overwrite context values
Map newContext = new HashMap(context);
newContext.putAll(attrs);
-
+
// build the context for the service
Map serviceContext = null;
ModelService model = null;
@@ -64,7 +64,7 @@
} catch (GenericServiceException e) {
throw new EvaluationException("Cannot get ModelService object for service named: " + serviceName, e);
}
-
+
// invoke the service
Map serviceResult = null;
try {
@@ -72,7 +72,7 @@
} catch (GenericServiceException e) {
throw new EvaluationException("Cannot invoke the service named: " + serviceName, e);
}
-
+
// get the evaluationResult object from the result
Boolean evaluationResult = null;
try {
@@ -80,7 +80,7 @@
} catch (ClassCastException e) {
throw new EvaluationException("Service did not return a valid evaluationResult object");
}
-
+
return evaluationResult;
}
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityAbstractImplementation.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityAbstractImplementation.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityAbstractImplementation.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityAbstractImplementation.java Fri Mar 27 17:03:06 2009
@@ -72,9 +72,9 @@
List paramNames = service.getParameterNames(ModelService.IN_PARAM, true);
if (paramNames != null && paramNames.size() == 0)
paramNames = null;
-
+
Map ctx = getActivity().actualContext(params, extend, paramNames, false);
-
+
GenericResultWaiter waiter = new GenericResultWaiter();
Debug.logVerbose("[WfActivityAbstractImplementation.runService] : Invoking the service.", module);
try {
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityImpl.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityImpl.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityImpl.java Fri Mar 27 17:03:06 2009
@@ -67,7 +67,7 @@
public class WfActivityImpl extends WfExecutionObjectImpl implements WfActivity {
public static final String module = WfActivityImpl.class.getName();
-
+
private static final int CHECK_ASSIGN = 1;
private static final int CHECK_COMPLETE = 2;
@@ -88,10 +88,10 @@
private void init() throws WfException {
GenericValue valueObject = getDefinitionObject();
-
+
// set the activity context
this.setProcessContext(container().contextKey());
-
+
// parse the descriptions
this.parseDescriptions(this.processContext());
@@ -116,7 +116,7 @@
}
}
}
-
+
GenericValue performer = null;
if (valueObject.get("performerParticipantId") != null) {
try {
@@ -133,7 +133,7 @@
}
if (performer != null)
createAssignments(performer);
-
+
boolean limitAfterStart = valueObject.getBoolean("limitAfterStart").booleanValue();
if (Debug.verboseOn()) {
@@ -153,7 +153,7 @@
if (valueObject.get("acceptAllAssignments") != null) {
assignAll = valueObject.getBoolean("acceptAllAssignments").booleanValue();
}
-
+
// first check for single assignment
if (!assignAll) {
if (performer != null) {
@@ -204,7 +204,7 @@
assign(WfFactory.getWfResource(performer), false);
}
}
-
+
// check for role types
else if (performer.get("roleTypeId") != null && !performer.getString("roleTypeId").equals("_NA_")) {
Collection partyRoles = null;
@@ -230,10 +230,10 @@
private List getAssignments() throws WfException {
List assignments = new ArrayList();
List assignList = this.getAllAssignments();
-
+
if (assignList == null)
return assignments;
-
+
Iterator i = assignList.iterator();
while (i.hasNext()) {
GenericValue value = (GenericValue) i.next();
@@ -248,7 +248,7 @@
if (Debug.verboseOn()) Debug.logVerbose("Found [" + assignments.size() + "] assignment(s)", module);
return assignments;
}
-
+
private List getAllAssignments() throws WfException {
List assignList = null;
try {
@@ -256,7 +256,7 @@
} catch (GenericEntityException e) {
throw new WfException(e.getMessage(), e);
}
-
+
if (assignList != null) {
assignList = EntityUtil.filterByDate(assignList);
} else {
@@ -283,11 +283,11 @@
private GenericValue checkPerformer(GenericValue performer) throws WfException {
GenericValue newPerformer = GenericValue.create(performer);
Map context = processContext();
-
+
String performerType = performer.getString("participantTypeId");
String partyId = performer.getString("partyId");
String roleTypeId = performer.getString("roleTypeId");
-
+
// check for dynamic party
if (partyId != null && partyId.trim().toLowerCase().startsWith("expr:")) {
if (Debug.verboseOn()) Debug.logVerbose("Dynamic performer: Found a party expression", module);
@@ -305,7 +305,7 @@
}
}
}
-
+
// check for dynamic role
if (roleTypeId != null && roleTypeId.trim().toLowerCase().startsWith("expr:")) {
if (Debug.verboseOn()) Debug.logVerbose("Dynamic performer: Found a role expression", module);
@@ -323,21 +323,21 @@
}
}
}
-
+
// check for un-defined party
if (performerType.equals("HUMAN") || performerType.equals("ORGANIZATIONAL_UNIT")) {
if (partyId == null) {
newPerformer.set("partyId", performer.getString("participantId"));
}
}
-
+
// check for un-defined role
if (performerType.equals("ROLE")) {
if (roleTypeId == null) {
newPerformer.set("roleTypeId", performer.getString("participantId"));
}
}
-
+
return newPerformer;
}
@@ -396,7 +396,7 @@
container().activityComplete(this);
}
-
+
/**
* @see org.ofbiz.workflow.WfExecutionObject#resume()
*/
@@ -409,13 +409,13 @@
throw new CannotResume("Attempt to complete activity failed", e);
}
}
-
+
/**
* @see org.ofbiz.workflow.WfExecutionObject#abort()
*/
public void abort() throws WfException, CannotStop, NotRunning {
super.abort();
-
+
// cancel the active assignments
Iterator assignments = this.getAssignments().iterator();
while (assignments.hasNext()) {
@@ -437,7 +437,7 @@
public WfProcess container() throws WfException {
return WfFactory.getWfProcess(delegator, processId);
}
-
+
/**
* @see org.ofbiz.workflow.WfActivity#setResult(java.util.Map)
*/
@@ -568,7 +568,7 @@
return false;
}
}
-
+
// we are here only if all are done, or complete/assign is false; so if not false we are done
if ((type == CHECK_COMPLETE && completeAll) || (type == CHECK_ASSIGN && acceptAll)) {
return true;
@@ -634,7 +634,7 @@
private void setLimitService() throws WfException {
LocalDispatcher dispatcher = getDispatcher();
-
+
DispatchContext dctx = dispatcher.getDispatchContext();
String limitService = getDefinitionObject().getString("limitService");
ModelService service = null;
@@ -653,7 +653,7 @@
// make the limit service context
List inList = new ArrayList(service.getInParamNames());
String inParams = StringUtil.join(inList, ",");
-
+
Map serviceContext = actualContext(inParams, null, null, true);
Debug.logVerbose("Setting limit service with context: " + serviceContext, module);
@@ -753,7 +753,7 @@
context.put("assignedPartyId", res.resourcePartyId());
context.put("assignedRoleTypeId", res.resourceRoleId());
}
-
+
// first we will pull out the values from the context for the actual parameters
if (actualParameters != null) {
List params = StringUtil.split(actualParameters, ",");
@@ -762,7 +762,7 @@
while (i.hasNext()) {
Object key = i.next();
String keyStr = (String) key;
-
+
if (keyStr != null && keyStr.trim().toLowerCase().startsWith("expr:")) {
// check for bsh expressions; this does not place values into the context
try {
@@ -775,11 +775,11 @@
List couple = StringUtil.split(keyStr.trim().substring(5).trim(), "=");
String mName = (String) couple.get(0); // mapped name
String cName = (String) couple.get(1); // context name
-
+
// trim out blank space
if (mName != null) mName = mName.trim();
if (cName != null) cName = cName.trim();
-
+
if (mName != null && cName != null && context.containsKey(cName)) {
actualContext.put(mName, context.get(cName));
}
@@ -791,7 +791,7 @@
}
}
}
-
+
// the serviceSignature should not limit which parameters are in the actualContext
// so instead we will use this signature to pull out values so they do not all have to be defined
if (serviceSignature != null) {
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityToolImplementation.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityToolImplementation.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityToolImplementation.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityToolImplementation.java Fri Mar 27 17:03:06 2009
@@ -71,15 +71,15 @@
String toolId = thisTool.getString("toolId");
String params = thisTool.getString("actualParameters");
String toolTypeEnumId = thisTool.getString("toolTypeEnumId");
-
+
//Linea agregada por Oswin Ondarza
allParams = allParams + "," + params;
String extend = thisTool.getString("extendedAttributes");
-
+
Map extendedAttr = StringUtil.strToMap(extend);
if (extendedAttr != null && extendedAttr.containsKey("serviceName"))
serviceName = (String) extendedAttr.get("serviceName");
-
+
serviceName = serviceName != null ? serviceName : (toolTypeEnumId.equals("WTT_APPLICATION") ?
"wfActivateApplication" : toolId);
waiters.add(runService(serviceName, params, extend));
@@ -90,7 +90,7 @@
Collection remove = new ArrayList();
while (wi.hasNext()) {
GenericResultWaiter thw = (GenericResultWaiter) wi.next();
-
+
if (thw.isCompleted()) {
Map thwResult = null;
if (thw.status() == GenericResultWaiter.SERVICE_FINISHED) {
@@ -106,7 +106,7 @@
}
thwResult.remove(ModelService.RESPONSE_MESSAGE);
}
-
+
try {
if (thwResult != null)
this.setResult(thwResult, allParams);
@@ -118,7 +118,7 @@
}
waiters.removeAll(remove);
}
-
+
setComplete(true);
}
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfAssignmentImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfAssignmentImpl.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfAssignmentImpl.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfAssignmentImpl.java Fri Mar 27 17:03:06 2009
@@ -109,7 +109,7 @@
if (value == null)
throw new WfException("No existing assignment found or create failed");
}
-
+
/**
* @see org.ofbiz.workflow.WfAssignment#accept()
*/
@@ -148,7 +148,7 @@
// set this assignment as accepted
changeStatus("CAL_ACCEPTED");
}
-
+
/**
* @see org.ofbiz.workflow.WfAssignment#setResult(java.util.Map)
*/
@@ -175,7 +175,7 @@
// check and make sure we are not already delegated
if (status().equals("CAL_DELEGATED"))
throw new WfException("Assignment has already been delegated");
-
+
// set the thru-date
GenericValue valueObject = valueObject();
try {
@@ -186,7 +186,7 @@
e.printStackTrace();
throw new WfException(e.getMessage(), e);
}
-
+
// change the status
changeStatus("CAL_DELEGATED");
}
@@ -273,18 +273,18 @@
throw new WfException("Invalid assignment; no runtime entity");
return value;
}
-
+
private boolean isEqual(WfAssignment asgn) throws WfException {
// compare this to null = different assignment
if (asgn == null) {
return false;
}
-
+
// if status is different; we must be different
if (!this.status().equals(asgn.status())) {
return false;
}
-
+
// different activity = different assignment
WfActivity thisActivity = this.activity();
WfActivity compActivity = asgn.activity();
@@ -299,7 +299,7 @@
return false;
}
}
-
+
// different participantId = different assignment - the rest doesn't matter
WfResource thisResource = this.assignee();
WfResource compResource = asgn.assignee();
@@ -314,7 +314,7 @@
return false;
}
}
-
+
// same status, same activity, same participantId = same assignement
return true;
}
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfEventAuditImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfEventAuditImpl.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfEventAuditImpl.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfEventAuditImpl.java Fri Mar 27 17:03:06 2009
@@ -43,14 +43,14 @@
this.eventType = eventType;
this.timeStamp = new Timestamp(new Date().getTime());
}
-
+
/**
* @see org.ofbiz.workflow.WfEventAudit#source()
*/
public WfExecutionObject source() throws WfException, SourceNotAvailable {
return object;
}
-
+
/**
* @see org.ofbiz.workflow.WfEventAudit#timeStamp()
*/
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfExecutionObjectImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfExecutionObjectImpl.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfExecutionObjectImpl.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfExecutionObjectImpl.java Fri Mar 27 17:03:06 2009
@@ -103,7 +103,7 @@
if (Debug.verboseOn()) Debug.logVerbose(" Process ID: " + processId + " V: " + processVersion, module);
if (Debug.verboseOn()) Debug.logVerbose("Activity ID: " + activityId, module);
}
-
+
// creates the stored runtime workeffort data.
private void createRuntime(String parentId) throws WfException {
GenericValue valueObject = getDefinitionObject();
@@ -138,21 +138,21 @@
try {
dataObject = getDelegator().makeValue("WorkEffort", dataMap);
getDelegator().create(dataObject);
-
+
String objectId = activityId != null ? activityId : processId;
if (Debug.verboseOn()) Debug.logVerbose("Created new runtime object [" + objectId + "] (Workeffort: " + runtimeKey() + ")", module);
} catch (GenericEntityException e) {
throw new WfException(e.getMessage(), e);
}
}
-
+
protected void parseDescriptions(Map parseContext) throws WfException {
GenericValue runtime = getRuntimeObject();
String name = runtime.getString("workEffortName");
String desc = runtime.getString("description");
String nameExp = FlexibleStringExpander.expandString(name, parseContext);
String descExp = FlexibleStringExpander.expandString(desc, parseContext);
-
+
boolean changed = false;
if (nameExp != null && !nameExp.equals(name)) {
changed = true;
@@ -162,7 +162,7 @@
changed = true;
runtime.set("description", descExp);
}
-
+
if (changed) {
try {
runtime.store();
@@ -178,7 +178,7 @@
public String name() throws WfException {
return getRuntimeObject().getString("workEffortName");
}
-
+
/**
* @see org.ofbiz.workflow.WfExecutionObject#setName(java.lang.String)
*/
@@ -192,7 +192,7 @@
throw new WfException(e.getMessage(), e);
}
}
-
+
/**
* @see org.ofbiz.workflow.WfExecutionObject#setPriority(long)
*/
@@ -233,7 +233,7 @@
if (stateStr == null)
throw new WfException("Stored state is not a valid type.");
-
+
if (Debug.verboseOn()) Debug.logVerbose("Current state: " + stateStr, module);
return stateStr;
}
@@ -288,15 +288,15 @@
public void abort() throws WfException, CannotStop, NotRunning {
Debug.logInfo("Aborting current state : " + state(), module);
String stateStr = "closed.aborted";
-
+
if (!state().startsWith("open")) {
throw new NotRunning();
}
-
+
if (!validStates().contains(stateStr)) {
throw new CannotStop();
}
-
+
changeState(stateStr);
}
@@ -372,7 +372,7 @@
else
return getRuntimeObject().getString("runtimeDataId");
}
-
+
/**
* @see org.ofbiz.workflow.WfExecutionObject#processContext()
*/
@@ -623,7 +623,7 @@
}
return context;
}
-
+
private GenericValue getWorkEffort(String workEffortId) throws WfException {
GenericValue we = null;
try {
@@ -633,7 +633,7 @@
}
return we;
}
-
+
/**
* Evaluate a condition expression using an implementation of TransitionCondition
* @param className The class name of the TransitionCondition implementation
@@ -656,23 +656,23 @@
Debug.logError(e, "Cannot access class " + className, module);
return false;
}
-
+
// make sure we implement the TransitionCondition interface
if (!ObjectType.instanceOf(conditionObject, "org.ofbiz.workflow.TransitionCondition")) {
Debug.logError("Class " + className + " is not an instance of TransitionCondition", module);
return false;
}
-
+
// cast to the interface
TransitionCondition cond = (TransitionCondition) conditionObject;
-
+
// trim up the expression if it isn't empty
if (expression != null)
expression = expression.trim();
-
+
// get a DispatchContext object to pass over to the eval
DispatchContext dctx = this.getDispatcher().getDispatchContext();
-
+
// evaluate the condition
Boolean evaluation = null;
try {
@@ -680,7 +680,7 @@
} catch (EvaluationException e) {
throw new WfException("Problems evaluating condition", e);
}
-
+
return evaluation.booleanValue();
}
@@ -696,7 +696,7 @@
Debug.logVerbose("Null or empty expression, returning true.", module);
return true;
}
-
+
Object o = null;
try {
o = BshUtil.eval(expression.trim(), context);
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfProcessImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfProcessImpl.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfProcessImpl.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfProcessImpl.java Fri Mar 27 17:03:06 2009
@@ -66,14 +66,14 @@
protected WfRequester requester = null;
protected WfProcessMgr manager = null;
-
+
public WfProcessImpl(GenericValue valueObject, WfProcessMgr manager) throws WfException {
super(valueObject, null);
this.manager = manager;
this.requester = null;
init();
}
-
+
/**
* @see org.ofbiz.workflow.impl.WfExecutionObjectImpl#WfExecutionObjectImpl(org.ofbiz.entity.GenericDelegator, java.lang.String)
*/
@@ -84,7 +84,7 @@
this.manager = WfFactory.getWfProcessMgr(delegator, packageId, packageVersion, processId, processVersion);
this.requester = null;
}
-
+
private void init() throws WfException {
// since we are a process we don't have a context yet
// get the context to use with parsing descriptions from the manager
@@ -109,13 +109,13 @@
return new ArrayList(activeSteps().subList(0, maxNumber - 1));
return activeSteps();
}
-
+
/**
* @see org.ofbiz.workflow.WfExecutionObject#abort()
*/
public void abort() throws WfException, CannotStop, NotRunning {
super.abort();
-
+
// cancel the active activities
Iterator activities = this.activeSteps().iterator();
while (activities.hasNext()) {
@@ -123,14 +123,14 @@
activity.abort();
}
}
-
+
/**
* @see org.ofbiz.workflow.WfProcess#start()
*/
public void start() throws WfException, CannotStart, AlreadyRunning {
start(null);
}
-
+
/**
* @see org.ofbiz.workflow.WfProcess#start()
*/
@@ -153,7 +153,7 @@
processDef.getString("packageVersion"), "processId", processDef.getString("processId"),
"processVersion", processDef.getString("processVersion"), "activityId", activityId);
start = getDelegator().findByPrimaryKey("WorkflowActivity", fields);
-
+
// here we must check and make sure this activity is defined to as a starting activity
if (!start.getBoolean("canStart").booleanValue())
throw new CannotStart("The specified activity cannot initiate the workflow process");
@@ -170,7 +170,7 @@
if (Debug.verboseOn())
Debug.logVerbose("[WfProcess.start] : Started the workflow process.", module);
-
+
// set the actualStartDate
try {
GenericValue v = getRuntimeObject();
@@ -182,35 +182,35 @@
}
startActivity(start);
}
-
+
/**
* @see org.ofbiz.workflow.WfProcess#manager()
*/
public WfProcessMgr manager() throws WfException {
return manager;
}
-
+
/**
* @see org.ofbiz.workflow.WfProcess#requester()
*/
public WfRequester requester() throws WfException {
return requester;
}
-
+
/**
* @see org.ofbiz.workflow.WfProcess#getIteratorStep()
*/
public Iterator getIteratorStep() throws WfException {
return activeSteps().iterator();
}
-
+
/**
* @see org.ofbiz.workflow.WfProcess#isMemberOfStep(org.ofbiz.workflow.WfActivity)
*/
public boolean isMemberOfStep(WfActivity member) throws WfException {
return activeSteps().contains(member);
}
-
+
/**
* @see org.ofbiz.workflow.WfProcess#getActivitiesInState(java.lang.String)
*/
@@ -226,7 +226,7 @@
}
return res.iterator();
}
-
+
/**
* @see org.ofbiz.workflow.WfProcess#result()
*/
@@ -248,14 +248,14 @@
}
return results;
}
-
+
/**
* @see org.ofbiz.workflow.WfProcess#howManyStep()
*/
public int howManyStep() throws WfException {
return activeSteps().size();
}
-
+
/**
* @see org.ofbiz.workflow.WfProcess#receiveResults(org.ofbiz.workflow.WfActivity, java.util.Map)
*/
@@ -264,7 +264,7 @@
context.putAll(results);
setSerializedData(context);
}
-
+
/**
* @see org.ofbiz.workflow.WfProcess#activityComplete(org.ofbiz.workflow.WfActivity)
*/
@@ -384,16 +384,16 @@
GenericResultWaiter req = new GenericResultWaiter();
if (Debug.verboseOn()) Debug.logVerbose("[WfProcess.startActivity] : Attempting to start activity (" + activity.name() + ")", module);
-
+
// locate the dispatcher to use
LocalDispatcher dispatcher = this.getDispatcher();
-
+
// get the job manager
JobManager jm = dispatcher.getJobManager();
if (jm == null) {
throw new WfException("No job manager found on the service dispatcher; cannot start activity");
}
-
+
// using the StartActivityJob class to run the activity within its own thread
try {
Job activityJob = new StartActivityJob(activity, req);
@@ -401,7 +401,7 @@
} catch (JobManagerException e) {
throw new WfException("JobManager error", e);
}
-
+
// the GenericRequester object will hold any exceptions; and report the job as failed
if (req.status() == GenericResultWaiter.SERVICE_FAILED) {
Throwable reqt = req.getThrowable();
@@ -434,7 +434,7 @@
// the default value is TRUE, so if no expression is supplied we evaluate as true
boolean transitionOk = true;
-
+
// the otherwise condition (only used by XOR splits)
GenericValue otherwise = null;
@@ -449,13 +449,13 @@
otherwise = transition;
continue;
}
-
+
// get the condition body from the condition tag
String conditionBody = transition.getString("conditionExpr");
-
+
// get the extended attributes for the transition
Map extendedAttr = StringUtil.strToMap(transition.getString("extendedAttributes"));
-
+
// check for a conditionClassName attribute if exists use it
if (extendedAttr != null && extendedAttr.get("conditionClassName") != null) {
String conditionClassName = (String) extendedAttr.get("conditionClassName");
@@ -466,7 +466,7 @@
transitionOk = this.evalBshCondition(conditionBody, this.processContext());
}
}
-
+
if (transitionOk) {
transList.add(transition);
if (split.equals("WST_XOR"))
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfProcessMgrImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfProcessMgrImpl.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfProcessMgrImpl.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfProcessMgrImpl.java Fri Mar 27 17:03:06 2009
@@ -54,14 +54,14 @@
public static final String module = WfProcessMgrImpl.class.getName();
protected GenericValue processDef;
-
+
protected String state; // will probably move to a runtime entity for the manager
protected List processList; // will probably be a related entity to the runtime entity
-
+
protected Map contextSignature = null;
protected Map resultSignature = null;
protected Map initialContext = null;
-
+
/**
* Method WfProcessMgrImpl.
* @param delegator
@@ -144,7 +144,7 @@
public Map contextSignature() throws WfException {
return this.contextSignature;
}
-
+
/**
* @see org.ofbiz.workflow.WfProcessMgr#howManyProcess()
*/
@@ -194,7 +194,7 @@
public Map resultSignature() throws WfException {
return this.resultSignature;
}
-
+
/**
* Method getInitialContext.
* @return Map
@@ -252,7 +252,7 @@
resultSignature.put(name, WfUtil.getJavaType(type));
}
}
-
+
private void buildInitialContext() throws WfException {
GenericDelegator delegator = processDef.getDelegator();
this.initialContext = new HashMap();
@@ -262,13 +262,13 @@
Map fields = new HashMap();
fields.put("packageId", processDef.get("packageId"));
fields.put("packageVersion", processDef.get("packageVersion"));
-
+
// first get all package fields
fields.put("processId", "_NA_");
fields.put("processVersion", "_NA_");
List data1 = delegator.findByAnd("WorkflowDataField", fields);
dataFields.addAll(data1);
-
+
// now get all process fields
fields.put("processId", processDef.get("processId"));
fields.put("processVersion", processDef.get("processVersion"));
@@ -281,13 +281,13 @@
return;
Iterator i = dataFields.iterator();
-
+
while (i.hasNext()) {
GenericValue dataField = (GenericValue) i.next();
String name = dataField.getString("dataFieldName");
String type = dataField.getString("dataTypeEnumId");
String value = dataField.getString("initialValue");
-
+
try {
initialContext.put(name, ObjectType.simpleTypeConvert(value, WfUtil.getJavaType(type), null, null));
} catch (GeneralException e) {
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfRequesterImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfRequesterImpl.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfRequesterImpl.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfRequesterImpl.java Fri Mar 27 17:03:06 2009
@@ -43,11 +43,11 @@
* WfRequesterImpl - Workflow Requester implementation
*/
public class WfRequesterImpl implements WfRequester {
-
+
public static final String module = WfRequesterImpl.class.getName();
protected Map performers = null;
-
+
/**
* Method WfRequesterImpl.
*/
@@ -79,7 +79,7 @@
Map localContext = new HashMap(context);
localContext.putAll(mgr.getInitialContext());
process.setProcessContext(localContext);
-
+
// Set the source reference id if one was passed
GenericValue processDefinition = process.getDefinitionObject();
String sourceReferenceField = processDefinition.getString("sourceReferenceField");
@@ -94,7 +94,7 @@
}
}
}
-
+
}
/**
@@ -103,14 +103,14 @@
public int howManyPerformer() throws WfException {
return performers.size();
}
-
+
/**
* @see org.ofbiz.workflow.WfRequester#getIteratorPerformer()
*/
public Iterator getIteratorPerformer() throws WfException {
return performers.keySet().iterator();
}
-
+
/**
* @see org.ofbiz.workflow.WfRequester#getSequencePerformer(int)
*/
@@ -119,14 +119,14 @@
return new ArrayList(performers.keySet()).subList(0, (maxNumber - 1));
return new ArrayList(performers.keySet());
}
-
+
/**
* @see org.ofbiz.workflow.WfRequester#isMemberOfPerformer(org.ofbiz.workflow.WfProcess)
*/
public boolean isMemberOfPerformer(WfProcess member) throws WfException {
return performers.containsKey(member);
}
-
+
/**
* @see org.ofbiz.workflow.WfRequester#receiveEvent(org.ofbiz.workflow.WfEventAudit)
*/
Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfResourceImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfResourceImpl.java?rev=759268&r1=759267&r2=759268&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfResourceImpl.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfResourceImpl.java Fri Mar 27 17:03:06 2009
@@ -83,21 +83,21 @@
if (roleTypeId == null)
roleTypeId = "_NA_";
}
-
+
/**
* @see org.ofbiz.workflow.WfResource#howManyWorkItem()
*/
public int howManyWorkItem() throws WfException {
return workItems().size();
}
-
+
/**
* @see org.ofbiz.workflow.WfResource#getIteratorWorkItem()
*/
public Iterator getIteratorWorkItem() throws WfException {
return workItems().iterator();
}
-
+
/**
* @see org.ofbiz.workflow.WfResource#getSequenceWorkItem(int)
*/