{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
List transitions = workflowProcess.getWorkflowTransitions();
int tran_size = transitions.size();
WorkflowTransition transition = null;
WorkflowActivity fromActivity = null;
WorkflowActivity toActivity = null;
for (int j = 0; j < tran_size; ++j)
{
transition = (WorkflowTransition) transitions.get(j);
fromActivity = transition.getFromWorkflowActivity();
toActivity = transition.getToWorkflowActivity();
if (fromActivity != null)
{
fromActivity.addOutgoingTransition(transition);
}
// else
// {
// System.err.println("transition=" + transition.getUUID() + ",from=<null>");
// }
if (toActivity != null)
{
toActivity.addIncomingTransition(transition);
}
// else
// {
// System.err.println("transition=" + transition.getUUID() + ",to=<null>");
// }
}
}
// ---------------------------------------------------------------
// 2. format transition condition
// ---------------------------------------------------------------
for (int i = 0; i < process_size; ++i)
{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
List transitions = workflowProcess.getWorkflowTransitions();
int tran_size = transitions.size();
WorkflowTransition transition = null;
for (int j = 0; j < tran_size; ++j)
{
transition = (WorkflowTransition) transitions.get(j);
WorkflowCondition condition = transition.getCondition();
if (condition != null && condition.getContent() != null)
{
ExtendedAttribute attribute = transition.findExtendedAttribute(XPDLGlobals.CONDITION_TYPE);
if (attribute != null)
{
ConditionType ctype = ConditionType.parse(attribute.getValue());
if (ConditionType.CONDITION_SCRIPT.equals(ctype))
{
transition.setCondition(new ScriptCondition(condition.getContent()));
}
transition.removeExtendedAttribute(XPDLGlobals.CONDITION_TYPE);
}
}
}
}
// ---------------------------------------------------------------
// 3. format activity type
// ---------------------------------------------------------------
for (int i = 0; i < processList.size(); ++i)
{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
List activies = workflowProcess.getWorkflowActivities();
int activitySize = activies.size();
WorkflowActivity activity = null;
Implementation impl = null;
ExtendedAttribute attribute = null;
for (int j = 0; j < activitySize; ++j)
{
activity = (WorkflowActivity) activies.get(j);
attribute = (ExtendedAttribute) activity.findExtendedAttribute(XPDLGlobals.ACTIVITY_TYPE);
if (attribute != null)
{
activity.setActivityType(ActivityType.parse(attribute.getValue()));
activity.removeExtendedAttribute(XPDLGlobals.ACTIVITY_TYPE);
}
}
}
// ---------------------------------------------------------------
// 4. format activity implementation
// ---------------------------------------------------------------
for (int i = 0; i < processList.size(); ++i)
{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
List activies = workflowProcess.getWorkflowActivities();
int activitySize = activies.size();
WorkflowActivity activity = null;
Implementation impl = null;
ExtendedAttribute attribute = null;
for (int j = 0; j < activitySize; ++j)
{
activity = (WorkflowActivity) activies.get(j);
impl = activity.getImplementation();
if (impl != null)
{
if (impl instanceof NoImplementation)
{
attribute = activity.findExtendedAttribute(XPDLGlobals.PAGE_URL);
if (attribute != null)
{
activity.setImplementation(new PageImplementation(attribute.getValue()));
}
}
}
}
}
// ---------------------------------------------------------------
// 5. format performer type
// ---------------------------------------------------------------
for (int i = 0; i < processList.size(); ++i)
{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
List activies = workflowProcess.getWorkflowActivities();
int activitySize = activies.size();
WorkflowActivity activity = null;
Implementation impl = null;
ExtendedAttribute attribute = null;
for (int j = 0; j < activitySize; ++j)
{
activity = (WorkflowActivity) activies.get(j);
attribute = (ExtendedAttribute) activity.findExtendedAttribute(XPDLGlobals.PERFORMER_TYPE);
if (attribute != null)
{
activity.setPerformerType(PerformerType.parse(attribute.getValue()));
activity.removeExtendedAttribute(XPDLGlobals.PERFORMER_TYPE);
}
}
}
// ---------------------------------------------------------------
// 6. format application QualifiedClassName
// ---------------------------------------------------------------
List wfApps = workflowPackage.getWorkflowApplications();
int wfAppSize = wfApps.size();
WorkflowApplication wfApp = null;
for (int i = 0; i < wfAppSize; ++i)
{
wfApp = (WorkflowApplication) wfApps.get(i);
ExtendedAttribute attribute = wfApp.findExtendedAttribute(XPDLGlobals.APPLICATION_QUALIFIED_CLASS_NAME);
if (attribute != null)
{
wfApp.setQualifiedClassName(attribute.getValue());
wfApp.removeExtendedAttribute(XPDLGlobals.APPLICATION_QUALIFIED_CLASS_NAME);
}
}
// ---------------------------------------------------------------
// 7. validate workflowActivity Implementation & ActivityType
// ---------------------------------------------------------------
for (int i = 0; i < process_size; ++i)
{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
List activies = workflowProcess.getWorkflowActivities();
int activitySize = activies.size();
WorkflowActivity activity = null;
Implementation impl = null;
ToolImplementation toolImpl = null;
ToolSet toolSet = null;
SubFlowImplementation subFlowImpl = null;
for (int j = 0; j < activitySize; ++j)
{
activity = (WorkflowActivity) activies.get(j);
impl = activity.getImplementation();
if (ActivityType.ACTIVITY_BUSINESS.equals(activity.getActivityType()))
{
if (impl != null && (impl instanceof SubFlowImplementation))
{
errorList.add(
new WorkflowException(
"ActivityType 'ACTIVITY_BUSINESS' Implementation can not be 'SubFlow'.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ ",activityID="
+ activity.getUUID()
+ "}"));
}
}
if (ActivityType.ACTIVITY_SUBFLOW.equals(activity.getActivityType()))
{
if (impl != null && !(impl instanceof SubFlowImplementation))
{
errorList.add(
new WorkflowException(
"ActivityType 'ACTIVITY_SUBFLOW' Implementation must be 'SubFlow'.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ ",activityID="
+ activity.getUUID()
+ "}"));
}
}
if (ActivityType.ACTIVITY_ROUTE.equals(activity.getActivityType()))
{
if (impl != null && !(impl instanceof NoImplementation))
{
errorList.add(
new WorkflowException(
"ActivityType 'ACTIVITY_ROUTE' Implementation must be 'No'.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ ",activityID="
+ activity.getUUID()
+ "}"));
}
}
}
}
// ---------------------------------------------------------------
// 8. format workflowProcess listener class name
// ---------------------------------------------------------------
for (int i = 0; i < process_size; ++i)
{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
ExtendedAttribute attribute = workflowProcess.findExtendedAttribute(XPDLGlobals.LISTENER_QUALIFIED_CLASS_NAME);
if (attribute != null)
{
workflowProcess.setListenerClassName(attribute.getValue());
workflowProcess.removeExtendedAttribute(XPDLGlobals.LISTENER_QUALIFIED_CLASS_NAME);
}
}
// ---------------------------------------------------------------
// 9. format workflowActivity listener class name
// ---------------------------------------------------------------
for (int i = 0; i < processList.size(); ++i)
{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
List activies = workflowProcess.getWorkflowActivities();
int activitySize = activies.size();
WorkflowActivity activity = null;
Implementation impl = null;
ExtendedAttribute attribute = null;
for (int j = 0; j < activitySize; ++j)
{
activity = (WorkflowActivity) activies.get(j);
attribute = (ExtendedAttribute) activity.findExtendedAttribute(XPDLGlobals.LISTENER_QUALIFIED_CLASS_NAME);
if (attribute != null)
{
activity.setListenerClassName(attribute.getValue());
activity.removeExtendedAttribute(XPDLGlobals.LISTENER_QUALIFIED_CLASS_NAME);
}
}
}
return errorList;