기본 관리 > 공동 작업 지원 > 워크플로 관리 > 워크플로 도구 > 워크플로 템플릿 관리 > 워크플로 코드 예 > 동기화 로봇 샘플 > 프로세스 인스턴스에 걸쳐 동기화
  
프로세스 인스턴스에 걸쳐 동기화
이 항목에서는 활동 상태의 변경을 수신하는 동기화 로봇 노드의 예제를 제공합니다.
참조된 워크플로
SynchronizationAccrossProcessInstances.xml
SynchronizeProcessInstance.xml
설명
이런 유형의 동기화는 독립 프로세스의 동기화와 매우 유사하며, 이 경우에는 로봇이 WfAssignedActivity가 아니라 wt.workflow.engine.WfProcess의 ACTIVITY_STATE_CHANGED 이벤트를 수신한다는 점이 유일한 차이점입니다. 다음 표현식에서는 State_Changed 이벤트를 발생시킨 프로세스가 로봇이 원하는 프로세스와 동일한지 여부를 로봇에서 확인합니다. 동일한 경우 프로세스의 상태를 기반으로 라우팅이 수행됩니다.
지침
processName은 로봇의 상위 프로세스에서 정의된 변수로서, 로봇이 필요로 하는 프로세스의 이름을 나타냅니다.
* 
둘 이상의 프로세스가 이름이 "processName"일 수 있습니다.
다음 코드를 복사합니다.
//get the process that emitted the event
wt.workflow.engine.WfProcess processInstance = ( wt.workflow.engine.WfProcess ) ((wt.events.KeyedEvent)event).getEventTarget();
//Check if the process that triggered the event is the same one we are interested in.
if ( processInstance.getName( ).equals(processName)){
//If so, check for the state of the process. Set result to "completed" if the process has been successfully completed
// and to "terminated" if the process has been terminated. In all other cases, check again.
if ( wt.workflow.engine.WfState.CLOSED_COMPLETED_EXECUTED.equals(processInstance.getState( ))){
result= "completed";
}
else if ( wt.workflow.engine.WfState.CLOSED_TERMINATED.equals(processInstance.getState( ))){
result= "terminated";
}
}