기본 관리 > 공동 작업 지원 > 워크플로 관리 > 워크플로 도구 > 워크플로 템플릿 관리 > 워크플로 코드 예 > 동기화 로봇 샘플 > 객체의 상태 동기화
  
객체의 상태 동기화
이 항목에서는 문서가 지정된 라이프 사이클 상태에 도달하는 시기를 인식하는 동기화 로봇 노드의 예제를 제공합니다.
참조된 워크플로
SynchronizeOn State.xml
설명
이 표현식은 문서의 상태를 수신하여 문서가 릴리즈 상태일 때 발생합니다. 로봇이 수신하는 이벤트는 wt.lifecycle.lifeCycleServiceEvent.STATE_CHANGE이고, 로봇이 수신하는 Windchill 클래스는 wt.doc.WTDocument입니다.
지침
워크플로 템플릿의 시스템 폴더에 문서를 작성합니다. docNumber라는 변수를 정의하고 방금 작성한 문서의 번호에 해당하는 기본값을 지정합니다. 이 변수는 java.lang.String입니다.
다음 코드를 복사합니다.
//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";
}
}