[jboss-user] [JBoss jBPM] - solved - Re: Dynamic task creation

2008-04-29 Thread massimiliano_cuccia
Scull, I doesn't understood. But now It works.

At the end of all my attempts I resolved. Continue reading to know all the 
story.. Hope this will help someone.

I moved The action that creates all the dynamic tasks to the node-enter of the 
task to "clone" (if you followed the example in the previous post, the task in 
tCompDoc)
This is the code of dynamic creation:


  | Token token = executionContext.getToken();
  | TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance();
  | TaskNode taskNode = (TaskNode) executionContext.getNode();
  | Task task = taskNode.getTask("task compilazione");
  | TaskInstance taskInstance = tmi.createTaskInstance(task, 
executionContext);
  | taskInstance.setActorId(user);
  | 
But the important part of this is the execution point. Remembar "node-enter of 
the cloning task". Elsewhere will cause errors and token scramble.

In my sample I need a task to close every dynamic task created early, still not 
ended, I put this code to the node-leave of chiusura-interpello.
This is the relevant part of code:

  | if (!ti.hasEnded())
  | ti.cancel();
  | 

thanks to every one helped me to achieve this goal
Hoping this will help someone else.

If you have any question, ask.
bye

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4147466#4147466

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4147466
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Re: Dynamic task creation

2008-04-28 Thread massimiliano_cuccia
"scull" wrote : hello massimiliano_cuccia
  | I see you 
  | I recommend you, that you should create an ActionHandler and asosiate it 
with node-enter event in tasks nodes after fork-node

Scull, doesn't work, or maybe I don't understand.

The node after fork-node is ChiusuraInterpello.
I moved the actionIstruttoriaInterpello to the node-enter of 
ChiusuraInterpello, But doing so, the actionChusuraInterpello is ignored.

After this test I commented all the code of actionIstruttoriaInterpello, the 
action actually just do some output. It seems that the dynamic creation of the 
tasks generates some problem to the process instance ... but i don't understand.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4147152#4147152

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4147152
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Re: Dynamic task creation

2008-04-24 Thread massimiliano_cuccia
I've tested the dleerob solution. But it doesn't works.

this is the image of the process i'm modelling
[img]http://web.tiscali.it/mcuccia/various/processimage.jpg[/img]

and this is the par file
http://web.tiscali.it/mcuccia/various/interpello.par

As you can see in this code

  |
  |
  |   
  |  
  |   
  |   
  |
  | 
when the token leaves the inizioInterpello node I execute the action class 
IstruttoriaInterpello. This is the place where the new task instances are 
created.

Next you can see the relevant code of IstruttoriaInterpello: for each selected 
user, I create a new task, cloning "task compilazione".

  | TaskMgmtDefinition tmd = 
(TaskMgmtDefinition)executionContext.getDefinition(TaskMgmtDefinition.class);
  | Task task = tmd.getTask("task compilazione");
  | TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance();
  | TaskInstance taskInstance = tmi.createTaskInstance(task, 
executionContext);
  | taskInstance.setActorId(user);
  | 

BUT (here is the problem)
the newly created task has two leaving transictions named "tr1" and "tr2", and 
doesn't have the (aspected) leaving transiction named "toJoinFromCompilazione".

dleerob, do you have similar problems?
anyone knows why this appens?

thanks

PS sample at 11.2.2 
http://docs.jboss.com/jbpm/v3/userguide/taskmanagement.html#taskinstancesandgraphexecution
is very very similar to the dleerob code

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4146545#4146545

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4146545
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Re: Dynamic task creation

2008-04-01 Thread massimiliano_cuccia
"kukeltje" wrote : how to 'bind' new tasks to a process is in the example in 
the wiki
can you post a link? I cant find the exact paragraph I need
thanks

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140632#4140632

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140632
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Re: Dynamic task creation

2008-04-01 Thread massimiliano_cuccia
Actually I doesn't understand the problem.
All the above code is inside a par file.
You could test it by deploying the par on your jbpm engine.

Should I upload the par file here?



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140630#4140630

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140630
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Re: Dynamic task creation

2008-03-25 Thread massimiliano_cuccia
I can't find any documentation on how to dinamically create a task instance at 
runtime. So the code below (and in previous post) is fruit of hours spend  in 
trying ... I achieved something that (seems to) works. And this is the result. 

Maybe this is not the correct way, so any help needed!!



  | 
  | 
  |
  |   
  |
  |
  |   
  |
  |
  |
  |   
  |   
  |   
  |
  |
  |   
  |   
  |  
  |   
  |   
  |
  |
  |
  |
  |   
  |   
  |  
  |   
  |   
  |
  |
  |
  | 


as you can see in the xml, I created a node-leave action handler, and I call 
the same class (for testing purpose only) on leaving InizioInterpello and on 
leaving ChiusuraInterpello.

Below you can read the code of the action handler.
When I execute the InizioInterpello task the code is executed: I can see the 
output (System.out) and when I show the task list 
(context.getProcessInstance(processInstanceId).getTaskMgmtInstance().getTaskInstances())
 of the process instance I see a task for every user.

But If I execute ChiusuraInterpello I can't see no output, no new task instance 
were created ... it seems that my action is ignored at all. But the task is 
closed correctly.

package it.unict.interpello;
  | 
  | 
  | import it.unict.consulta.ManagerBeansProxy;
  | import it.unict.consulta.driver.data.IDocente;
  | import it.unict.consulta.driver.manager.IEducationManager;
  | 
  | import java.util.Collection;
  | 
  | import org.jbpm.graph.exe.ExecutionContext;
  | import org.jbpm.graph.exe.Token;
  | import org.jbpm.graph.node.TaskNode;
  | import org.jbpm.taskmgmt.def.Task;
  | import org.jbpm.taskmgmt.exe.TaskInstance;
  | import org.jbpm.taskmgmt.exe.TaskMgmtInstance;
  | 
  | public class IstruttoriaInterpello implements 
org.jbpm.graph.def.ActionHandler
  | {
  | ManagerBeansProxy mbProxy = null;
  | 
  | public void execute(ExecutionContext executionContext) throws Exception
  | {
  | 
System.out.println("q***");
  | System.out.println("*** I can see this only when leaving 
InizioInterpello, but nothing is shown when executing ChiusuraInterpello ***");
  | 
System.out.println("***");
  | 
System.out.println("***");
  | 
System.out.println("***");
  | 
System.out.println("***");
  | 
  | mbProxy = new ManagerBeansProxy();
  | IEducationManager edu = mbProxy.getMEducation();
  | 
  | if (edu == null)
  | throw new RuntimeException("EducationManager non 
disponibile");
  | 
  | try
  | {
  | // determine the sets of users
  | Collection lDoc = edu.listaDocenti();
  | 
  | if (lDoc == null || lDoc.size() == 0)
  | throw new RuntimeException("Nessun docente");   
  | 
  | // for each user creates a personal task instance
  | for (IDocente d : lDoc)
  | {
  | String uname = d.getUsername();
  | createAndAssignTask(uname, executionContext);
  | }
  | }
  | catch (Exception ex)
  | {
  | System.out.println(ex);
  | createAndAssignTask("admin", executionContext);
  | }
  | }
  | 
  | public void createAndAssignTask(String user, ExecutionContext 
executionContext)
  | {
  | Token token = null;
  | TaskMgmtInstance tmi = null;
  | TaskNode taskNode = null;
  | 
  | try
  | {
  | token = executionContext.getToken();
  | tmi = executionContext.getTaskMgmtInstance();
  | taskNode = (TaskNode) executionContext.getNode();
  | 
  | // create the new task instance, a clone of tCompDoc
  | Task doCompilaDocumento = taskNode.getTask("tCompDoc");
  | TaskInstance tCompDoc = 
tmi.createTaskInstance(doCompilaDocumento, token);
  | 
  | // set the name of the task, the actor that this task 
is assigned to, and set the creation date
  | tCompDoc.setName("consulta: convocazione " + user);
  | tCompDoc.setActorId(user);
  | tCompDoc.setCreate(token.getEnd(

[jboss-user] [JBoss jBPM] - Re: Dynamic task creation

2008-03-25 Thread massimiliano_cuccia
Thanks kukeltje, but I really don't know what information i omitted!

Now I try to explain what I want to achieve, maybe someone can inspire me a new 
way.

I want that, after a certain process task, each user in a set must execute a 
task.
I don't know in advance how many users can be involved (i have a query to 
determine the set of users)
this is why my process can't be fully designed in advance.

any ideas?
thanks

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138672#4138672

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138672
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Re: Dynamic task creation

2008-03-25 Thread massimiliano_cuccia
UP!

please help

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138666#4138666

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138666
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Dynamic task creation

2008-03-21 Thread massimiliano_cuccia
Hi all
I have a process named Interpello that, at a certains point, executes the task 
InizioInterpello.
I attached at the node-leave event an action (actionIstruttoriaInterpello).

This action have to create a task instance for a number of users (i mean a task 
that each selected user must execute).

The code below (createAndAssignTask) does the work, but when the process 
arrives to the task ChiusuraInterpello, it should execute the action 
actionChiusuraInterpello (actually just display some outputs via println) 
but it doesn't execute nothing (I can't see the output), and the execution 
process doesn't step to verificaFinale.
Everything goes well if I comment all the createAndAssignTask code invocation 
in the actionIstruttoriaInterpello

There is something wrong in the code below (dynamic task creation)?

thanks
I'm using jbpm 3.1.2


  | 
  | 
  | 
  |
  |   
  |
  |
  |   
  |
  |
  |
  |   
  |   
  |   
  |
  |
  |   
  |   
  |  
  |   
  |   
  |
  |
  |
  |
  |   
  |   
  |  
  |   
  |   
  |
  | 
  | 



  | public void createAndAssignTask(String user, ExecutionContext 
executionContext)
  | {
  | Token token = null;
  | TaskMgmtInstance tmi = null;
  | TaskNode taskNode = null;
  | 
  | try
  | {
  | token = executionContext.getToken();
  | tmi = executionContext.getTaskMgmtInstance();
  | taskNode = (TaskNode) executionContext.getNode();
  | 
  | Task doCompilaDocumento = taskNode.getTask("tCompDoc");
  | TaskInstance tCompDoc = 
tmi.createTaskInstance(doCompilaDocumento, token);
  | 
  | tCompDoc.setName("consulta: convocazione " + user);
  | tCompDoc.setActorId(user);
  | tCompDoc.setCreate(token.getEnd());
  | 
  | tCompDoc.setVariableLocally("XXX"+user, "");
  | //tCompDoc.assign(executionContext);
  | tmi.addTaskInstance(tCompDoc);
  | System.out.println("creato: " + 
tCompDoc);
  | } catch (Exception ex)
  | {
  | ex.printStackTrace();
  | }
  | }
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138326#4138326

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138326
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - terminate a process instance

2007-09-24 Thread massimiliano_cuccia
I'm sorry, but I'm not finding how to terminate a process instance

with "terminate" i mean that the process has a termination date and there can't 
be executable tasks

how can I achieve this???

thanks
regards
Massimiliano Cuccia

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4087844#4087844

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4087844
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - How to stop a process instance?

2007-09-17 Thread massimiliano_cuccia
How to stop the execution of a process instance?

Suppose to have a process instance executing in jBPM, what have I to do to stop 
it?
I mean "suddendly stop" it,
an operation that the admin user can apply to process instances where execution 
accidentally started  (for example)

I have read about the method cancel, but it is not clear what really happens 
when this method is called
have I to call the cancel method for every task instance of the process 
instance?

thanks

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085109#4085109

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085109
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - revoke assignment

2007-09-13 Thread massimiliano_cuccia
I have a task assigned to group(administrators)
and i get a TaskInstance and assign the actor to admin1 using this code

ti.setActorId("admin1");

so the task is corrently assigned to the user "admin1" (member of group 
"administrators")

How do I revoke this assignment?
actually I want that the task goes into original state: assigned to the 
"administrators" group. Is it possible?

thanks
regards

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084038#4084038

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084038
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Re: create task at runtime

2007-07-25 Thread massimiliano_cuccia
FIXED!!!

I changed some things
I attached the handler on node leave
in the handler I created the new task and created a new variable using
tCompDoc.setVariableLocally(varname, varvalue);

then in the action to execute a task I called 
ti.getVariablesLocally()
to obtains the list of variables defined in the executing task

now I doesn't care about ti.getTask that is null
i doesn't care about a taskcontroller
i doesn't care about any other boring stuff

thanks to syngolis!

If someone has any questions about my code can ask me!

regards


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067390#4067390

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067390
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Re: create task at runtime

2007-07-25 Thread massimiliano_cuccia
"syngolis" wrote : "massimiliano_cuccia" wrote : (this means that ti.getTask() 
is null)
  | 
  | No, this means getTaskController() is null, 
  | 
I'm sorry, but you are wrong

to prove this I added these few lines
System.out.println( "ti: " + ti );
  | System.out.println( "ti.getTask(): " + ti.getTask() );
  | System.out.println( "ti.getTask().getTaskController(): " + 
ti.getTask().getTaskController() );
  | 

and obtained this output
ti: TaskInstance[creato a runtime]
  | ti.getTask(): null
  | java.lang.NullPointerException
  | at it.acme.action.AttivitaEsecuzione.execute(AttivitaEsecuzione.java:71)
  | 


"syngolis" wrote : 
  | Try it without the controller 
  | 
do you know a way to do this without the controller?

"syngolis" wrote : 
  | or create one.
  | 
ok, i'm trying this

"syngolis" wrote : 
  | In order to get variables (without variableaccess):
  | taskInstance.getVariable("Name")
  | 
but I doesn't know the variable name
I'm writing an action to execute a generic task and the variable name is 
decided at design time!!

I'm searching for the testcases
thanks

any other can help?


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067336#4067336

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067336
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Re: create task at runtime

2007-07-24 Thread massimiliano_cuccia
"syngolis" wrote : I think the null pointer exception is correct. AFAIK if you 
create a task, there is no task controller created automatically. (Think of a 
processdefinition; there you have to declare the controller as well)
  | And the get operation results in a null pointer because no controller 
exists.
  | 

thanks syngolis
I think that you are right: it is possible.

So I want to list all and only the variables linked to the task (not the "all 
task of the process"). At now I'm doing this

TaskController taskController = ti.getTask().getTaskController();
  | if (taskController!=null)
  | {
  | List variableAccesses = taskController.getVariableAccesses();
  | Iterator i = variableAccesses.iterator();
  | while (i.hasNext())
  | {
  |  // do something
  |  }
  | }

but the first row gives the null pointer exception (this means that 
ti.getTask() is null)

so if you are right, the question is
how to list the variables of the task?

regards

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067103#4067103

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067103
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Re: create task at runtime

2007-07-24 Thread massimiliano_cuccia
the first portion of code is from the handler, the name for the newly created 
task is newti
the second portion of code is from the struts action to execute a generic task, 
that i'm using to execute this task also. In this fragment the name of the task 
instance is ti.

It isn't a java mistake ... be sure!


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067048#4067048

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067048
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Re: Defining the type of a task variable in XML

2007-07-24 Thread massimiliano_cuccia
well, we are overriding jpdl name for the variables using syntax like

name:type

so if in a task I have a variable named SAMPLE of type INT we will design our 
task variables using this name "SAMPLE:INT"

We wrote a jsp page to understand and format the input accordingly to this 
syntax

hope this helps
regards

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067032#4067032

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067032
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - create task at runtime

2007-07-24 Thread massimiliano_cuccia
In a process I defined an handler for a transition.
This handler should create a new task, this is the code of the handler:

TaskInstance newti = 
executionContext.getProcessInstance().getTaskMgmtInstance().createTaskInstance();
  | newti.setName("created at runtime");
  | newti.addComment("created after the task named 'definition1' .");
  | newti.setActorId("admin");
  | newti.setVariable("sample_var", "12345");
  | 

so, when I try to execute this task (and even other tasks) I obtains a null 
pointer exception executing this code

TaskController taskController = ti.getTask().getTaskController();

I'm using this code to obtains the list of variables for the executing task (so 
this list should contain only "sample_var" in this example)

Now, am I wrong on task creation code?
or maybe have I to retrieve the list of variables in another way?

thanks for your help
regards

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067028#4067028

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067028
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss jBPM] - Re: can't get task list of an actor

2007-07-24 Thread massimiliano_cuccia
it seems something like the user ernie doesn't exists.

maybe is "ernie" the user involved in the subsequent task? or maybe it is 
"participant", that I see resolves to "ernie"

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067021#4067021

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067021
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user