이 예는 이미 정의된 인터페이스를 사용하는 런타임 타스크를 작성합니다. 즉,
클라이언트의 로컬 파일 시스템에 인터페이스 설명이 있는 파일이 들어 있습니다.
이 타스크의 수행 목적 및 시기
이 예는 자원이 로드된 호출 엔터프라이즈 응용프로그램의 컨텍스트 내부에서만 실행됩니다.
이 타스크의 단계
- ClientTaskFactory에 액세스하여 새 타스크 모델의 정의를 포함시킬 자원 세트를 작성하십시오.
ClientTaskFactory factory = ClientTaskFactory.newInstance();
ResourceSet resourceSet = factory.createResourceSet();
- WSDL 정의 및 사용자 조작의 설명에 액세스하십시오.
인터페이스 설명은 코드가 실행되는 위치에 따라 위치합니다.
Definition definition = factory.loadWSDLDefinition(
resourceSet, "interface.wsdl" );
PortType portType = definition.getPortType(
new QName( definition.getTargetNamespace(), "doItPT" ) );
Operation operation = portType.getOperation("doIt", (String)null, (String)null);
- 새 휴먼 타스크의 EMF 모델을 작성하십시오.
타스크 인스턴스를 작성 중이면
유효 시작 날짜(UTCDate)가 필요하지 않습니다.
TTask humanTask = factory.createTTask( resourceSet,
TTaskKinds.HTASK_LITERAL,
"TestTask",
new UTCDate( "2005-01-01T00:00:00" ),
"http://www.ibm.com/task/test/",
portType,
operation );
이 단계는 타스크 모델의 특성을 기본값으로 초기화합니다.
- 휴먼 타스크 모델의 특성을 수정하십시오.
// use the methods from the com.ibm.wbit.tel package, for example,
humanTask.setBusinessRelevance( TBoolean, YES_LITERAL );
// retrieve the task factory to create or modify composite task elements
TaskFactory taskFactory = factory.getTaskFactory();
// specify escalation settings
TVerb verb = taskFactory.createTVerb();
verb.setName("John");
// create escalationReceiver and add verb
TEscalationReceiver escalationReceiver =
taskFactory.createTEscalationReceiver();
escalationReceiver.setVerb(verb);
// create escalation and add escalation receiver
TEscalation escalation = taskFactory.createTEscalation();
escalation.setEscalationReceiver(escalationReceiver);
- 모든 자원 정의가 들어 있는 타스크 모델을 작성하십시오.
TaskModel taskModel = ClientTaskFactory.createTaskModel( resourceSet );
- 타스크 모델의 유효성을 검증한 후 발견된 모든 유효성 검증 문제점을 정정하십시오.
ValidationProblem[] validationProblems = taskModel.validate();
- 런타임 타스크 인스턴스 또는 템플리트를 작성하십시오.
HumanTaskManagerService 인터페이스를 사용하여 타스크 인스턴스 또는 타스크 템플리트를 작성하십시오. 데이터 유형 정의가 들어 있는 응용프로그램 이름을 제공하여 액세스할 수 있도록 해야 합니다. 응용프로그램에는 더미 타스크 또는 프로세스가 들어 있어 Business Process Choreographer가 이 응용프로그램을 로드하도록 해야 합니다.
- 다음 스니펫은 타스크 인스턴스를 작성합니다.
task.createTask( taskModel, "BOapplication", "HTM" );
- 다음 스니펫은 타스크 템플리트를 작성합니다.
task.createTaskTemplate( taskModel, "BOapplication" );
결과
런타임 인스턴스가 작성되면 이제 시작할 수 있습니다.
런타임 타스크 템플리트가 작성되면 이제 템플리트로부터 타스크 인스턴스를 작성할 수 있습니다.