이 예는 해당 인터페이스에서 단순 Java 유형(예: String 오브젝트)만 사용하는 런타임 타스크를 작성합니다.
ClientTaskFactory factory = ClientTaskFactory.newInstance(); ResourceSet resourceSet = factory.createResourceSet();
// 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 and output messages are of type String: // a fault message is not specified Operation operation = factory.createOperation ( definition, portType, "doIt", new QName( "http://www.w3.org/2001/XMLSchema", "string" ), new QName( "http://www.w3.org/2001/XMLSchema", "string" ), null );
타스크 인스턴스를 작성 중이면 유효 시작 날짜(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();
task.createTask( taskModel, null, "HTM" );
task.createTaskTemplate( taskModel, null );
런타임 인스턴스가 작성되면 이제 시작할 수 있습니다. 런타임 타스크 템플리트가 작성되면 이제 템플리트로부터 타스크 인스턴스를 작성할 수 있습니다 .