기본 관리 > 공동 작업 지원 > 워크플로 관리 > 워크플로 도구 > 워크플로 템플릿 관리 > 워크플로 코드 예 > 동기화 로봇 샘플 > 사용자 정의 워크플로 이벤트의 동기화
  
사용자 정의 워크플로 이벤트의 동기화
이 항목에서는 다른 프로세스에서 특정 사용자 정의 이벤트가 발생할 때까지 프로세스를 중단하는 동기화 로봇 노드의 예제를 제공합니다.
참조된 워크플로
SynchronizationOfUserDefinedEvents.xml
UserEventsWorkflow.xml
설명
로봇을 정의하여 다른 프로세스에서 특정 사용자 정의 이벤트가 발생할 때까지 프로세스의 진행을 중단할 수 있습니다. 아래 표현식에서 로봇은 활동의 ACTIVITY_STATE_CHANGED 이벤트를 수신하고, 사용자가 정의한 세 개의 이벤트인 온도 분석(thermal analysis), 피로 분석(fatigue analysis) 또는 응력 분석(stress analysis) 중 하나라도 발생했는지 확인합니다. 각 이벤트는 함께 발생해야 하는 해당 이벤트를 가지고 있으며 이런 이벤트는 벡터: tempResult에 추가됩니다. 마침내 이벤트는 결과를 벡터 tempResult로 설정합니다. 이제 로봇은 벡터에 포함된 결과가 발생된 모든 이벤트를 발생시킵니다.
지침
다음 코드를 복사합니다.
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;