// ---------------------------------------------------------------
// 1. validate package main process
// ---------------------------------------------------------------
{
ExtendedAttribute attribute =
(ExtendedAttribute) workflowPackage.findExtendedAttribute(XPDLGlobals.ID_PROCESS_MAIN);
if (attribute != null)
{
String processId = attribute.getValue();
if (processId == null || processId.length() == 0)
{
errorList.add(
new WorkflowException(
"package attribute '"
+ XPDLGlobals.ID_PROCESS_MAIN
+ "' must be set.{packageID="
+ workflowPackage.getUUID()
+ "}"));
}
}
else
{
errorList.add(
new WorkflowException(
"package attribute '"
+ XPDLGlobals.ID_PROCESS_MAIN
+ "' must be set.{packageID="
+ workflowPackage.getUUID()
+ "}"));
}
}
// ---------------------------------------------------------------
// 2. validate workflowapplication qualified class name
// ---------------------------------------------------------------
List appList = workflowPackage.getWorkflowApplications();
int app_size = appList.size();
for (int i = 0; i < app_size; ++i)
{
WorkflowApplication app = (WorkflowApplication) appList.get(i);
ExtendedAttribute attribute = app.findExtendedAttribute(XPDLGlobals.APPLICATION_QUALIFIED_CLASS_NAME);
if (attribute != null)
{
String className = (String) attribute.getValue();
if (className == null || className.length() == 0)
{
errorList.add(
new WorkflowException(
"application attribute '"
+ XPDLGlobals.APPLICATION_QUALIFIED_CLASS_NAME
+ "' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",applicationID="
+ app.getUUID()
+ "}"));
}
}
else
{
errorList.add(
new WorkflowException(
"application attribute '"
+ XPDLGlobals.APPLICATION_QUALIFIED_CLASS_NAME
+ "' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",applicationID="
+ app.getUUID()
+ "}"));
}
}
// ---------------------------------------------------------------
// 3. validate workflowprocess beginActivity and endActivity
// ---------------------------------------------------------------
for (int i = 0; i < process_size; ++i)
{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
ExtendedAttribute attribute = workflowProcess.findExtendedAttribute(XPDLGlobals.ID_ACTIVITY_BEGIN);
String activityId = null;
if (attribute != null)
{
activityId = (String) attribute.getValue();
if (activityId == null || activityId.length() == 0)
{
errorList.add(
new WorkflowException(
"process attribute '"
+ XPDLGlobals.ID_ACTIVITY_BEGIN
+ "' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ "}"));
}
}
else
{
errorList.add(
new WorkflowException(
"process attribute '"
+ XPDLGlobals.ID_ACTIVITY_BEGIN
+ "' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ "}"));
}
attribute = (ExtendedAttribute) workflowProcess.findExtendedAttribute(XPDLGlobals.ID_ACTIVITY_END);
if (attribute != null)
{
activityId = (String) attribute.getValue();
if (activityId == null || activityId.length() == 0)
{
errorList.add(
new WorkflowException(
"process attribute '"
+ XPDLGlobals.ID_ACTIVITY_END
+ "' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ "}"));
}
}
else
{
errorList.add(
new WorkflowException(
"process attribute '"
+ XPDLGlobals.ID_ACTIVITY_END
+ "' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ "}"));
}
}
// ---------------------------------------------------------------
// 4. validate workflowActivity activity type
// ---------------------------------------------------------------
for (int i = 0; i < process_size; ++i)
{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
List activies = workflowProcess.getWorkflowActivities();
int activitySize = activies.size();
for (int j = 0; j < activitySize; ++j)
{
WorkflowActivity activity = (WorkflowActivity) activies.get(j);
ExtendedAttribute attribute = activity.findExtendedAttribute(XPDLGlobals.ACTIVITY_TYPE);
if (attribute != null)
{
String activity_type = (String) attribute.getValue();
if (activity_type == null || activity_type.length() == 0)
{
errorList.add(
new WorkflowException(
"activity attribute '"
+ XPDLGlobals.ACTIVITY_TYPE
+ "' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ ",activityID="
+ activity.getUUID()
+ "}"));
}
}
else
{
errorList.add(
new WorkflowException(
"activity attribute '"
+ XPDLGlobals.ACTIVITY_TYPE
+ "' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ ",activityID="
+ activity.getUUID()
+ "}"));
}
}
}
// ---------------------------------------------------------------
// 5. validate workflowActivity performer type
// ---------------------------------------------------------------
for (int i = 0; i < process_size; ++i)
{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
List activies = workflowProcess.getWorkflowActivities();
int activitySize = activies.size();
for (int j = 0; j < activitySize; ++j)
{
WorkflowActivity activity = (WorkflowActivity) activies.get(j);
ExtendedAttribute attribute = activity.findExtendedAttribute(XPDLGlobals.ACTIVITY_TYPE);
if (attribute != null)
{
if (!ActivityType.parse((String) attribute.getValue()).equals(ActivityType.ACTIVITY_BUSINESS))
{
continue;
}
}
attribute = (ExtendedAttribute) activity.findExtendedAttribute(XPDLGlobals.PERFORMER_TYPE);
if (attribute != null)
{
String performer_type = (String) attribute.getValue();
if (performer_type == null || performer_type.length() == 0)
{
errorList.add(
new WorkflowException(
"activity attribute '"
+ XPDLGlobals.PERFORMER_TYPE
+ "' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ ",activityID="
+ activity.getUUID()
+ "}"));
}
}
else
{
errorList.add(
new WorkflowException(
"activity attribute '"
+ XPDLGlobals.PERFORMER_TYPE
+ "' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ ",activityID="
+ activity.getUUID()
+ "}"));
}
}
}
// ---------------------------------------------------------------
// 6. validate workflowActivity Implementation referrence
// ---------------------------------------------------------------
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 (impl == null)
{
continue;
}
if ((impl instanceof ToolImplementation) && ActivityType.ACTIVITY_BUSINESS.equals(activity.getActivityType()))
{
toolImpl = (ToolImplementation) impl;
String appId = toolImpl.getApplicationID();
if ((appId == null) || (workflowPackage.findWorkflowApplication(appId) == null))
{
errorList.add(
new WorkflowException(
"Tool attribute 'Id' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ ",activityID="
+ activity.getUUID()
+ "}"));
}
}
if ((impl instanceof ToolSet) && ActivityType.ACTIVITY_BUSINESS.equals(activity.getActivityType()))
{
toolSet = (ToolSet) impl;
List toolImpls = toolSet.getToolKits();
int toolImpls_size = toolImpls.size();
for (int k = 0; k < toolImpls_size; ++k)
{
toolImpl = (ToolImplementation) toolImpls.get(k);
String appId = toolImpl.getApplicationID();
if ((appId == null) || (workflowPackage.findWorkflowApplication(appId) == null))
{
errorList.add(
new WorkflowException(
"Tool attribute 'Id' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ ",activityID="
+ activity.getUUID()
+ "}"));
}
}
}
if ((impl instanceof SubFlowImplementation)
&& ActivityType.ACTIVITY_SUBFLOW.equals(activity.getActivityType()))
{
subFlowImpl = (SubFlowImplementation) impl;
String processId = subFlowImpl.getProcessID();
if ((processId == null) || (workflowPackage.findWorkflowProcess(processId) == null))
{
errorList.add(
new WorkflowException(
"SubFlow attribute 'Id' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ ",activityID="
+ activity.getUUID()
+ "}"));
}
}
}
}
// ---------------------------------------------------------------
// 7. validate WorkflowTransition formActivity & toActivity
// ---------------------------------------------------------------
for (int i = 0; i < process_size; ++i)
{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
List trans = workflowProcess.getWorkflowTransitions();
int trans_size = trans.size();
WorkflowTransition tran = null;
for (int j = 0; j < trans_size; ++j)
{
tran = (WorkflowTransition) trans.get(j);
if (tran.getFromWorkflowActivity() == null)
{
errorList.add(
new WorkflowException(
"Transition attribute 'From' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ ",transitionID="
+ tran.getUUID()
+ "}"));
}
if (tran.getToWorkflowActivity() == null)
{
errorList.add(
new WorkflowException(
"Transition attribute 'To' must be set.{packageID="
+ workflowPackage.getUUID()
+ ",processID="
+ workflowProcess.getUUID()
+ ",transitionID="
+ tran.getUUID()
+ "}"));
}
}
}
// ---------------------------------------------------------------
// 8. validate workflowActivity activity type match performer Type
// ---------------------------------------------------------------
for (int i = 0; i < process_size; ++i)
{
WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
List activies = workflowProcess.getWorkflowActivities();
int activitySize = activies.size();
for (int j = 0; j < activitySize; ++j)
{
WorkflowActivity activity = (WorkflowActivity) activies.get(j);
ExtendedAttribute attribute = activity.findExtendedAttribute(XPDLGlobals.ACTIVITY_TYPE);
if (attribute != null)
{
if (ActivityType.parse((String) attribute.getValue()).equals(ActivityType.ACTIVITY_BUSINESS))
{
continue;
}
attribute = (ExtendedAttribute) activity.findExtendedAttribute(XPDLGlobals.PERFORMER_TYPE);
if (attribute != null
&& !(PerformerType.parse(attribute.getValue()).equals(PerformerType.PERFORMER_AUTOMATION)))
{
errorList.add(
new WorkflowException(
"activity attribute '"
+ XPDLGlobals.PERFORMER_TYPE