Grundlegende Verwaltung > Unterstützung der Zusammenarbeit > Workflow-Verwaltung > Workflow-Tools > Workflow-Vorlagen-Verwaltung > Workflow-Code-Beispiele > Robot-Beispiele synchronisieren > Mit Status eines Objekts synchronisieren
  
Mit Status eines Objekts synchronisieren
Dieses Thema liefert ein Beispiel dafür, wie der Synchronisierungs-Robot-Knoten erkennt, dass ein Dokument einen bestimmten Lebenszyklusstatus erreicht.
Referenzierter Workflow
SynchronizeOn State.xml
Beschreibung
Der Ausdruck wartet auf den Status eines Dokuments und löst aus, wenn das Dokument zur gemeinsamen Benutzung freigegeben wird. Das Ereignis, auf das der Robot wartet, ist wt.lifecycle.lifeCycleServiceEvent.LZ-STATUSÄNDERUNG, und die Windchill Klasse, auf die der Robot wartet, ist wt.doc.WTDocument.
Anweisungen
Erstellen Sie im Ordner "System" in der Workflow-Vorlage ein Dokument. Definieren Sie eine Variable mit dem Namen "docNumber", und geben Sie ihr einen Standardwert, der der Nummer im soeben erstellten Dokument entspricht. Beachten Sie, dass die Variable ein java.lang.String ist.
Kopieren Sie den folgenden Code:
//fetch the object that emitted the State_change event.
wt.doc.WTDocument targetObject = ( wt.doc.WTDocument ) ((wt.events.KeyedEvent) event).getEventTarget();
//Set the result to null so the robot keeps running until the condition is satisfied.
result=nul
l
//check if the object that emitted the state_change event is the same document that the Robot is looking for.
// docNumber is a variable that holds the number of the document that the Robot is looking for.
if ( targetObject.getNumber( ).equals ((( wt.doc.WTDocument ) primaryBusinessObject). getNumber ())){
//check if the document has been released. If so, fire the next activity else the result is null so the robot keeps running //in the background.
if ( targetObject.getLifeCycleState ().equals ( wt.lifecycle.State.RELEASED )){
result = "released";
}
}