Grundlegende Verwaltung > Unterstützung der Zusammenarbeit > Workflow-Verwaltung > Workflow-Tools > Workflow-Vorlagen-Verwaltung > Workflow-Code-Beispiele > Robot-Beispiele synchronisieren > Benutzerdefinierte Workflow-Ereignisse synchronisieren
  
Benutzerdefinierte Workflow-Ereignisse synchronisieren
Dieses Thema liefert ein Beispiel für einen Synchronisierungs-Robot-Knoten, der einen Prozessablauf anhält, bis ein bestimmtes benutzerdefiniertes Ereignis in einem anderen Prozess ausgelöst wird.
Referenzierte Workflows
SynchronizationOfUserDefinedEvents.xml
UserEventsWorkflow.xml
Beschreibung
Sie können einen Robot so definieren, dass er den Prozessablauf anhält, bis ein bestimmtes benutzerdefiniertes Ereignis in einem anderen Prozess ausgelöst wird. In dem nachfolgenden Ausdruck wartet der Robot auf das Ereignis AKTIVITÄTSSTATUS_GEÄNDERT einer Aktivität und prüft, ob eines der drei benutzerdefinierten Ereignisse - thermische Analyse, Ermüdungsanalyse oder Belastungsanalyse - ausgelöst hat. Für jedes dieser Ereignisse hat er seine eigenen entsprechenden Ereignisse, die ausgelöst haben müssen und die er zu dem Vektor tempResult hinzufügt. Schließlich setzt er sein Ergebnis auf den Vektor tempResult. Jetzt löst der Robot alle Ereignisse aus, die der Ergebnis-Vektor enthält.
Anweisungen
Kopieren Sie den folgenden Code:
Vector tempResult = new Vector ();
//Get activity that caused the event
WfAssignedActivity activity = (WfAssignedActivity) (( wt.events.KeyedEvent) event).getEventTarget();
//Check if the activity and process are the one's we're looking for
if (activity.getName().equals(activityName)){
//Check if the Parent process of the activity is the one we are interested in.
if (activity.getParentProcess().getName().equals(processName)){
//Check if the list of events for the activity contains the event "thermal analysis".
//If so, add to the Vector tempResult, the appropriate event to fire for the robot.
if (activity.getAllEvents().contains("thermal analysis")){
tempResult.addElement("thermal analysis");
}
//Check if the list of events for the activity contains the event "fatigue analysis".
//If so, add to the Vector tempResult, appropriate event for the robot.
if (activity.getAllEvents().contains("fatigue analysis")){
tempResult.addElement("fatigue analysis");
}
//Check if the list of events for the activity contains the event "stress analysis".
//If so, add to the Vector tempResult, appropriate event for the robot.
if (activity.getAllEvents().contains("stress analysis")){
tempResult.addElement("stress analysis");
}
}
}
//Set result to the Vector tempResult.
//Note that in the previous steps, all the events that the robot must fire were added to tempResult.
result = tempResult;