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--------------");
}