Creating runtime tasks that use simple Java types

This example creates a runtime task that uses only simple Java types in its interface, for example, a String object.

Why and when to perform this task

Steps for this task

  1. Access the ClientTaskFactory and create a resource set to contain the definitions of the new task model.
    ClientTaskFactory factory = ClientTaskFactory.newInstance(); 
    ResourceSet resourceSet = factory.createResourceSet();
  2. Create the WSDL definition and add the descriptions of your operations.
    // 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 );
  3. Create the EMF model of your new human task.

    This step initializes the properties of the task model with default values.

    TTask humanTask = factory.createTTask( resourceSet, 
                                           TTaskKinds.HTASK_LITERAL, 
                                           "TestTask", 
                                           new UTCDate( "2005-01-01T00:00:00" ), 
                                           "http://www.ibm.com/task/test/", 
                                           portType, 
                                           operation );
  4. Modify the properties of your human task model.
    // 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("Everybody");
    
    // 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);
  5. Create the task model that contains all the resource definitions.
    TaskModel taskModel = ClientTaskFactory.createTaskModel( resourceSet );
  6. Validate the task model.
    ValidationProblem[] validationProblems = taskModel.validate();
  7. Create the runtime task instance or template.
    Use the HumanTaskManagerService interface to create the task instance or the task template.
    • The following snippet creates a task instance:
      task.createTask( taskModel, null );
    • The following snippet creates a task template:
      task.createTaskTemplate( taskModel, null );

The runtime task instance or task template can now be started.


Terms of use | | Broken links

Last updated: Mon Mar 27 18:04:06 2006

(c) Copyright IBM Corporation 2005.
This information center is powered by Eclipse technology (http://www.eclipse.org)