복합 유형을 사용하는 런타임 타스크 작성

이 예는 해당 인스턴스에서 복합 유형을 사용하는 런타임 타스크를 작성합니다. 복합 유형은 이미 정의되어 있습니다. 즉, 클라이언트의 로컬 파일 시스템에 복합 유형의 설명이 있는 XSD 파일이 들어 있습니다.

이 타스크의 수행 목적 및 시기

이 예는 자원이 로드된 호출 엔터프라이즈 응용프로그램의 컨텍스트 내부에서만 실행됩니다.

이 타스크의 단계

  1. ClientTaskFactory에 액세스하여 새 타스크 모델의 정의를 포함시킬 자원 세트를 작성하십시오.
    ClientTaskFactory factory = ClientTaskFactory.newInstance(); 
    ResourceSet resourceSet = factory.createResourceSet();
  2. 복합 유형의 XSD 정의를 자원 세트에 추가하여 조작을 정의할 때 이를 사용할 수 있도록 하십시오.
    파일은 코드가 실행되는 위치에 따라 위치합니다.
    factory.loadXSDSchema( resourceSet, "InputBO.xsd" );
    factory.loadXSDSchema( resourceSet, "OutputBO.xsd" );
  3. WSDL 정의를 작성하고 조작 설명을 추가하십시오.
    // create the WSDL interface
    Definition definition = factory.createWSDLDefinition
             ( resourceSet, new QName( "http://www.ibm.com/task/test/", "test" ) );
        
    // create a port type
    PortType portType = factory.createPortType( definition, "doItPT" );
    
    // create an operation; the input message is an InputBO and 
    // the output message an OutputBO; 
    // a fault message is not specified
    Operation operation = factory.createOperation
            ( definition, portType, "doIt", 
              new QName( "http://Input", "InputBO" ),
              new QName( "http://Output", "OutputBO" ),
              (Map)null );
  4. 새 휴먼 타스크의 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 );

    이 단계는 타스크 모델의 특성을 기본값으로 초기화합니다.

  5. 휴먼 타스크 모델의 특성을 수정하십시오.
    // 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);
  6. 모든 자원 정의가 들어 있는 타스크 모델을 작성하십시오.
    TaskModel taskModel = ClientTaskFactory.createTaskModel( resourceSet );
  7. 타스크 모델의 유효성을 검증한 후 발견된 모든 유효성 검증 문제점을 정정하십시오.
    ValidationProblem[] validationProblems = taskModel.validate();
  8. 런타임 타스크 인스턴스 또는 템플리트를 작성하십시오.
    HumanTaskManagerService 인터페이스를 사용하여 타스크 인스턴스 또는 타스크 템플리트를 작성하십시오. 데이터 유형 정의가 들어 있는 응용프로그램 이름을 제공하여 액세스할 수 있도록 해야 합니다. 응용프로그램에는 더미 타스크 또는 프로세스가 들어 있어 Business Process Choreographer가 이 응용프로그램을 로드하도록 해야 합니다.
    • 다음 스니펫은 타스크 인스턴스를 작성합니다.
      task.createTask( taskModel, "BOapplication", "HTM" );
    • 다음 스니펫은 타스크 템플리트를 작성합니다.
      task.createTaskTemplate( taskModel, "BOapplication" );

결과

런타임 인스턴스가 작성되면 이제 시작할 수 있습니다. 런타임 타스크 템플리트가 작성되면 이제 템플리트로부터 타스크 인스턴스를 작성할 수 있습니다.


ⓒ Copyright IBM Corporation 2005, 2006.
이 Information Center는 Eclipse 기술을 기반으로 합니다. (http://www.eclipse.org)