[JBossCache] - Re: Minimizing POJOCache impact on existing codebases
by ben.wang@jboss.com
"gregory.pierce(a)jboss.com" wrote :
| I am working on that very thing. Actually putting together a whitepaper that speaks to JBossCache specifically.
|
Good! The example POJOs are located under examples distro. There is actually a loodtime directory that is using the special classloader (except it is geared toward 1.4). But you can take those structure to modify further.
anonymous wrote :
| While its not all that interesting, you have to be able to show people how to walk before they can run. The problem with the current stuff is that we show people EVERYTHING, and the simple cases are simply missing. I want to do this as a progression showing the bare basics of getting started and going from there - assumig that JBossCache is used in a standalone manner.
OK, I am looking forward to see the examples that you come up then.
Thanks,
-Ben
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972872#3972872
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972872
19 years, 7 months
[JBoss jBPM] - Re: Multiinstances of the same process
by antitrust1982
This is my file code:
public class CreateProcessInstanceAction extends ActionSupport{
|
|
| ////////////////////////////////
|
| private String nameProcess;
| private String currentNode;
| TaskInstance taskinstance=null;
|
| static JbpmConfiguration jbpmConfiguration = null;
| static ProcessDefinition processDefinition= null;
| ProcessInstance pi= null;
| JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext();
| Map session = (Map) ActionContext.getContext().get("session");
| SwimlaneInstance si =null;
| ExecutionContext ec=null;
|
| public void setNameProcess(String nameProcess) {
| System.out.println("set NameProcess");
| this.nameProcess = nameProcess;
| }
|
| public String getNameProcess() {
| System.out.println("get NameProcess");
| return nameProcess;
| }
|
| public void setCurrentNode(String currentNode) {
| System.out.println("set currentNode");
| this.currentNode = currentNode;
| }
|
| public String getCurrentNode() {
| System.out.println("get currentNode");
| return currentNode;
| }
|
| ////////////////////////////////
|
|
| public Long instantiate(ProcessDefinition pd, String userId) {
| Long instanceId = null;
|
| //initialisation du context
|
| GraphSession graphSession = jbpmContext.getGraphSession();
| TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
|
|
| // UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUu
| Collection processinstances= graphSession.findProcessInstances(pd.getId());
| System.out.println("porcess definition id:"+ pd.getId());
| System.out.println("empty:" +processinstances.isEmpty());
| Iterator itpro = processinstances.iterator();
| while(itpro.hasNext()){
| ProcessInstance processinstance =(ProcessInstance) itpro.next();
|
| System.out.println("les elements de la collection de process sont : "+processinstance.getId());
| }
|
| //uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
| System.out.println("creation d'une instance de process");
| pi = new ProcessInstance(pd);
| System.out.println("enregistrement du processinstance");
| jbpmContext.save(pi);
| System.out.println("PROCESS INSTANCE ID:"+ pi.getId());
| jbpmContext.loadProcessInstanceForUpdate(pi.getId());
| System.out.println("reload");
|
|
|
|
|
|
|
| System.out.println("creation des swimlanes");
| Map swimlanes = pd.getTaskMgmtDefinition().getSwimlanes();
| Iterator itr = swimlanes.keySet().iterator();
|
| while(itr.hasNext()) {
| Swimlane swimlane = (Swimlane)swimlanes.get(itr.next());
| System.out.println("SWIMLANE CREE:"+ swimlane.getName());
| swimlane.setPooledActorsExpression("ernie");
| ec= new ExecutionContext(pi.getRootToken());
|
| System.out.println("creation d'une nouvelle instance de swimlane");
| SwimlaneInstance swi = pi.getTaskMgmtInstance().getInitializedSwimlaneInstance(ec, swimlane);
|
| if(swi.getName().equals("Assurimo")){
| swi.setActorId("bert");
| }
|
| Set pooledActors = swi.getPooledActors();
| if(pooledActors != null) {
| Iterator paItr = pooledActors.iterator();
| while(paItr.hasNext()) {
| ((PooledActor)paItr.next() ).setSwimlaneInstance(swi);
| }
| }
| }
| if (pd.getTaskMgmtDefinition().getStartTask() != null) {
| org.jbpm.taskmgmt.def.Task task = pd.getTaskMgmtDefinition().getStartTask();
| String swimlaneName = task.getSwimlane().getName();
| SwimlaneInstance swi = pi.getTaskMgmtInstance().getSwimlaneInstance(swimlaneName);
| String originalActorId = swi.getActorId();
| Set originalPooledActors = swi.getPooledActors();
|
| TaskInstance startTask = pi.getTaskMgmtInstance().createStartTaskInstance();
| System.out.println("task instance name: "+startTask.getName()+" of swimlane "+swi.getName());
|
|
| startTask.setActorId(userId);
|
| if(startTask.getSwimlaneInstance() != null) {
|
| System.out.println("Actor assigné au swimlane: " + startTask.getSwimlaneInstance().getActorId());
| si = startTask.getSwimlaneInstance();
|
| if (startTask.getSwimlaneInstance().getPooledActors() != null) {
| System.out.println("startTask.getSwimlaneInstance().getPooledActors() != null");
| System.out.println("Swimlane assigned pooled actor: " + ( (PooledActor)(startTask.getSwimlaneInstance().getPooledActors().iterator().next()) ).getActorId() );
| }
| }
| }
|
| else {
| System.out.println("################################else#########################################");
| }
|
|
| instanceId = Long.valueOf(pi.getId());
|
| System.out.println("trouver les process definition id ");
|
|
|
| return instanceId;
| }
|
| @Override
| public String execute() throws Exception {
|
| processDefinition = ProcessDefinition.parseXmlString(
| "<process-definition name='DeclarationSinistre'>"+
| "<swimlane name='FONCIA' >"+
| "<assignment expression='user(bert)'/>"+
| "</swimlane>"+
|
| "<swimlane name='Assurimo' >"+
| "<assignment expression='user(ernie)'/>"+
| "</swimlane>"+
|
|
| "<start-state name='start' end-tasks = 'true' >"+
| "<task swimlane='FONCIA'>"+
| "</task>"+
| "<transition name='' to='DeclarationSinistre'>"+"</transition>"+
| "</start-state>"+
|
| "<end-state name='end'>"+"</end-state>"+
|
| "<task-node name='DeclarationSinistre' end-tasks = 'true' >"+
| "<task swimlane='FONCIA'>"+
| "</task>"+
| "<transition name='' to='EnregistrementSinistre'>"+"</transition>"+
| "</task-node>"+
|
| "<task-node name='EnregistrementSinistre' end-tasks = 'true' >"+
| "<task swimlane='Assurimo'>"+
| "</task>"+
| "<transition name='' to='ControlePrime'>"+"</transition>"+
| "</task-node>"+
|
| "<task-node name='ControlePrime' end-tasks = 'true' >"+
| "<task swimlane='Assurimo'>"+
| "</task>"+
| "<transition name='' to='end'>"+"</transition>"+
| "</task-node>"+
| "</process-definition>"
| );
|
|
| jbpmConfiguration = JbpmConfiguration.parseXmlString(
| "<jbpm-configuration>" +
|
| " <jbpm-context>" +
| " <service name='persistence' " +
| " factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" +
| " </jbpm-context>" +
|
| " <string name='resource.hibernate.cfg.xml' " +
| " value='hibernate.cfg.xml' />" +
| " <string name='resource.business.calendar' " +
| " value='org/jbpm/calendar/jbpm.business.calendar.properties' />" +
| " <string name='resource.default.modules' " +
| " value='org/jbpm/graph/def/jbpm.default.modules.properties' />" +
| " <string name='resource.converter' " +
| " value='org/jbpm/db/hibernate/jbpm.converter.properties' />" +
| " <string name='resource.action.types' " +
| " value='org/jbpm/graph/action/action.types.xml' />" +
| " <string name='resource.node.types' " +
| " value='org/jbpm/graph/node/node.types.xml' />" +
| " <string name='resource.varmapping' " +
| " value='org/jbpm/context/exe/jbpm.varmapping.xml' />" +
| "</jbpm-configuration>"
| );
|
| jbpmContext.setActorId("ernie");
|
| Long longVariable = instantiate(processDefinition, "ernie");
| System.out.println("instance Id retournée : "+longVariable);
| try{
| Token token = pi.getRootToken();
|
| System.out.println("jbpmcontext actor : "+jbpmContext.getActorId());
|
| nameProcess=pi.getProcessDefinition().getName();
|
| System.out.println("les taches non finies sont:");
| Collection taskinstances = (Collection) pi.getTaskMgmtInstance().getUnfinishedTasks(token);
| Iterator itr1 = taskinstances.iterator();
| while(itr1.hasNext()) {
| taskinstance=(TaskInstance)itr1.next();
|
| if("ernie"==taskinstance.getActorId()){
| System.out.println("Pour ERNIE :................"+taskinstance.getName());
| System.out.println("ID de la taskinstance"+taskinstance.getId());
| taskinstance.end();
| System.out.println("tache finie:.........."+taskinstance.hasEnded());
| }
|
| else if("bert"==taskinstance.getActorId()){
| System.out.println("Pour BERT :...................."+taskinstance.getName());
| }
|
| else{
| System.out.println("Les autres taches sont :"+taskinstance.getName()+" et sont allouées à"+taskinstance.getActorId());
| taskinstance.getSwimlaneInstance().setActorId("bert");
| System.out.println("Changement effectué.. the task is :"+taskinstance.getName()+" to the user "+taskinstance.getActorId());
|
| }
| }
|
| token.signal();
| System.out.println("finie? : "+token.hasEnded());
| currentNode=token.getNode().getName();
| System.out.println("noeud courant:"+currentNode);
| this.setCurrentNode(currentNode);
|
| this.setNameProcess(nameProcess);
|
| jbpmContext.save(pi);
|
|
|
| Map session = (Map) ActionContext.getContext().get("session");
| session.put("process",pi);
| session.put("jbpmContext",jbpmContext);
| session.put("processName",nameProcess);
| session.put("processDefiniton",processDefinition);
| session.put("ec",ec);
| session.put("si",si);
| session.put("token",token);
| session.put("Idpi",pi.getId());
|
| }
|
| finally {
| }
| return SUCCESS;
| }
| }
this is my log console (i have execute two instances of portlets):
anonymous wrote :
| .
| porcess definition id:0
| empty:true
| creation d'une instance de process
| enregistrement du processinstance
| PROCESS INSTANCE ID:1577
| reload
| creation des swimlanes
| SWIMLANE CREE:FONCIA
| creation d'une nouvelle instance de swimlane
| SWIMLANE CREE:Assurimo
| creation d'une nouvelle instance de swimlane
| task instance name: start of swimlane FONCIA
| Actor assign?® au swimlane: ernie
| trouver les process definition id
| instance Id retourn?®e : 1577
| jbpmcontext actor : ernie
| les taches non finies sont:
| Pour ERNIE :................start
| ID de la taskinstance1522
| tache finie:..........true
| finie? : false
| noeud courant:EnregistrementSinistre
| set currentNode
| set NameProcess
| #### execute
| firstNAmle : null
| #### execute
| firstNAmle : null
| get currentNode
| porcess definition id:0
| empty:true
| creation d'une instance de process
| enregistrement du processinstance
| PROCESS INSTANCE ID:1578
| reload
| creation des swimlanes
| SWIMLANE CREE:FONCIA
| creation d'une nouvelle instance de swimlane
| SWIMLANE CREE:Assurimo
| creation d'une nouvelle instance de swimlane
| task instance name: start of swimlane FONCIA
| Actor assign?® au swimlane: ernie
| trouver les process definition id
| instance Id retourn?®e : 1578
| jbpmcontext actor : ernie
| les taches non finies sont:
| Pour ERNIE :................start
| ID de la taskinstance1525
| tache finie:..........true
| finie? : false
| noeud courant:EnregistrementSinistre
| set currentNode
| set NameProcess
| #### execute
| firstNAmle : null
| get currentNode
| get currentNode
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972863#3972863
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972863
19 years, 7 months