Package workflow.test

Source Code of workflow.test.WillowClientTest

/*
* Created on 2004-6-27
*
* To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package workflow.test;

import java.rmi.RemoteException;
import java.util.Date;
import java.util.Hashtable;

import javax.naming.NamingException;

import org.huihoo.workflow.WorkflowException;
import org.huihoo.workflow.client.InitialSerialClient;
import org.huihoo.workflow.client.WorkflowClient;
import org.huihoo.workflow.client.serial.model.SerialCase;
import org.huihoo.workflow.client.serial.model.SerialCaseDatabase;
import org.huihoo.workflow.client.serial.model.SerialPackage;
import org.huihoo.workflow.client.serial.model.SerialParticipant;
import org.huihoo.workflow.client.serial.model.SerialProcess;
import org.huihoo.workflow.client.serial.model.SerialService;
import org.huihoo.workflow.client.serial.model.SerialUserDatabase;
import org.huihoo.workflow.client.serial.model.SerialWork;
import org.huihoo.workflow.runtime.Constants;

/**
* @author reic
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class WillowClientTest
{

  public static void main(String[] args) throws NamingException, ClassNotFoundException, RemoteException, WorkflowException
  {
    Hashtable env=new Hashtable();
    env.put(WorkflowClient.INITIAL_CLIENT_FACTORY,"org.huihoo.willow.client.SerialClientFactoryImpl");
    env.put(WorkflowClient.PROVIDER_URL,"workflow://localhost:2126");
    env.put(WorkflowClient.SECURITY_PRINCIPAL,"zosatapo");
    env.put(WorkflowClient.SECURITY_CREDENTIALS,"zosatapo");
   
    InitialSerialClient liveClient=new InitialSerialClient(env);
   
    String package_id="willow-or-join";
    if(args.length>0)
    {
      package_id=args[0];
    }
   
    SerialService liveService=liveClient.findService("examples");
   
    System.err.println("-----------------------------------------------");
    System.err.println("org.huihoo.workflow="+liveService.getName());
     
    SerialUserDatabase userDatabase=liveService.getUserDatabase()
    SerialParticipant zosatapo=userDatabase.findParticipant("zosatapo");
    SerialCaseDatabase caseDatabase=liveService.getCaseDatabase();
    String sessionID=liveClient.getSessionID();
   
    SerialPackage livePackage=liveService.findPackage(package_id);
    System.err.println("livePackage : "+livePackage);
   
    SerialProcess liveProcess=livePackage.getMainProcess();
   
    System.err.println("liveProcess : "+liveProcess+",PackageID : "+liveProcess.getPackageID());
    System.err.println("caseDatabase : "+caseDatabase);
    System.err.println("maxInactiveInterval : "+liveClient.getMaxInactiveInterval()+" [s] ");
    String caseId=caseDatabase.createLiveCase(sessionID,liveProcess,zosatapo,new Date(),"first case"," "," ");
   
    SerialCase liveCase=caseDatabase.findLiveCase(sessionID,liveProcess,caseId);   
    System.err.println("PackageID="+liveCase.getPackageID());
   
    SerialWork liveWork=(SerialWork)caseDatabase.getLiveWorkList(sessionID,liveProcess,liveCase,zosatapo,Constants.WORK_STATUS_ACCEPTED).get(0);
    caseDatabase.dispatch(sessionID,liveWork);
    liveClient.disconnect();
   
    System.err.println("-------org.huihoo.workflow execution completed--------------");
  }
}
TOP

Related Classes of workflow.test.WillowClientTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.