Samplecodes–AppendixCSamplecodes–AppendixC..................................................................................................1AppendixC–SampleCode..................................................................................................2ProcessManagerInterfaceExample.............................................................................2index.jsp..................................................................................................................2PMIExample#1.-initiateProcess.jsp'''................................................................4PMIExample#2.-startProcess.jsp'''....................................................................5PMIExample#3.-initiateAndStartProcess.jsp..................................................7PMIExample#4.–getProcessVariable.jsp........................................................10PMIExample#5.-setProcessVariable.jsp..........................................................11MainClass....................................................................................................................131.ActivityDefinitionClassReferenceCodes#1-Activity.java.....................132.ActivityFlowControlClassReferenceCodes#1-ComplexActivity.java.153.ProcessDefinitionClass-ProcessDefintion...............................................184.RolesandRoleMappingClass–RolesandRoleMapping.........................185.ProcessVariableClass-ProcessVariable....................................................196.ProcessDefinitionTest,Example#1...........................................................19TransactionUsageexample#1...................................................................................21JDBCExtWorklist.................................................................................................21TypeDeclarationExample#1.....................................................................................23AutomaticUICreationExample#1...........................................................................24ReferencecodesofconsistentwaystoInputdata#1–DateInput.java..................28RoleObjectExtensionExample#1-organizationChartXML.jsp............................33RoleObjectExtensionExample#2–MultipleRoleMappingExample..................35AppendixC–SampleCodeProcessManagerInterfaceExampleindex.jsph1ExampleAPIInvocationDemos/h1olformaction=initiateProcess.jspmethod=POSTliInitiatingProcessDefinition:brulEnterProcessDefinitionNametobeinitiated:inputname=definitionNameinputtype=submit/ul/li/formpformaction=startProcess.jspmethod=POSTliStartingProcessDefinition:brulEnterInstanceIdtobestarted:inputname=instanceIdinputtype=submit/ul/li/formpformaction=initiateAndStartProcess.jspmethod=POSTliInitiatingandStartingProcessDefinition:brulEnterProcessDefinitionNametobeinitiatedandstarted:inputname=definitionNameinputtype=submit/ul/li/formpformaction=getProcessVariable.jspmethod=POSTliGettingValueofVariable:brulEnterinstanceId:inputname=instanceIdbrEntervariablename:inputname=variableNamebrinputtype=submit/ul/li/formpformaction=setProcessVariable.jspmethod=POSTliSettingValuetoVariable:brulEnterinstanceId:inputname=instanceIdbrEntervariablename:inputname=variableNamebrEntervalue(JustStringvalueforthisexample):inputname=valuebrinputtype=submit/ul/li/formPMIExample#1.-initiateProcess.jsp'''%@includefile=../common/header.jsp%%@pageimport=javax.transaction.*%LINKhref=../style/uengine.csstype=text/cssrel=stylesheetjsp:useBeanid=processManagerFactoryscope=applicationclass=org.uengine.processmanager.ProcessManagerFactoryBean/%ProcessManagerRemotepm=processManagerFactory.getProcessManager();InitialContextcontext=newInitialContext();UserTransactiontx=(GlobalContext.useManagedTransaction?(UserTransaction)context.lookup(GlobalContext.USERTRANSACTION_JNDI_NAME):null);try{if(tx!=null)tx.begin();StringdefinitionName=decode(request.getParameter(definitionName));StringproductionVersionId=pm.getProcessDefinitionProductionVersionByName(definitionName);StringinstanceId=pm.initializeProcess(productionVersionId);pm.applyChanges();try{tx.commit();}catch(Exceptiontxe){}%Processinstance'%=instanceId%'hasbeensuccessfullyinitialized.p%}catch(Exceptione){try{pm.cancelChanges();}catch(Exceptiontxe){}try{tx.rollback();}catch(Exceptiontxe){}throwe;}finally{try{pm.remove();}catch(Exceptionex){System.out.println(errorwhentoremovepm);ex.printStackTrace();}}%PMIExample#2.-startProcess.jsp'''%@includefile=../common/header.jsp%%@pageimport=javax.transaction.*%LINKhref=../style/uengine.csstype=text/cssrel=stylesheetjsp:useBeanid=processManagerFactoryscope=applicationclass=org.uengine.processmanager.ProcessManagerFactoryBean/%ProcessManagerRemotepm=processManagerFactory.getProcessManager();InitialContextcontext=newInitialContext();UserTransactiontx=(GlobalContext.useManagedTransaction?(UserTransaction)context.lookup(Global