Author |
Message
|
kutulu2000 |
Posted: Thu Mar 29, 2007 12:59 pm Post subject: WorkItem.endTime in JAVA API |
|
|
 Acolyte
Joined: 08 Nov 2005 Posts: 63 Location: Mexico
|
Hi
We have attempted to extrac te end time for a workitem by JAVA API, but we obtain errors.
We are using the next code:
WorkItem[] wi = null;
try{
wi = this.service.queryWorkItems("OWNER LIKE '" +
this.service.userID().trim() +
"' AND DESCRIPTION LIKE 'Tarea0*' AND
STATE IN ( READY , CHECKED_OUT, RUNNING )",
"CREATION_TIME", null);
if(wi.length > 0){
System.out.println("Ejecutando la tarea: " + wi[1].name() +
" del Proceso: " + wi[1].processInstanceName());
wi[1].start();
System.out.println("Hora de INICIO: " +
wi[1].startTime().toString());
wi[1].terminate();
System.out.println("Hora de FIN: " +
wi[1].endTime().toString());
}else
System.out.println("No hay WorkItems asociados al usuario: " +
this.service.userID());
}catch(Exception ex){
System.out.println(ex.getMessage());
ex.printStackTrace();
}
Something know how to do it?  _________________ #10 |
|
Back to top |
|
 |
jmac |
Posted: Thu Mar 29, 2007 1:52 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
You don't say what error you are getting? null pointer exception would mean that the value is not set. _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
hos |
Posted: Thu Mar 29, 2007 10:35 pm Post subject: |
|
|
Chevalier
Joined: 03 Feb 2002 Posts: 470
|
Many oportunities to run into errors! Not only an API problem but also a Java programming skill problem!
Ready workitems cannot be terminated.
Java indexing starts with [0]
Sort expressions need an "ASC" or "DESC" suffix
Ready workitems do not have a starttime
Running workitems do not have an endtime
.... |
|
Back to top |
|
 |
kutulu2000 |
Posted: Mon Apr 02, 2007 6:14 am Post subject: |
|
|
 Acolyte
Joined: 08 Nov 2005 Posts: 63 Location: Mexico
|
Well, I'll try to explain with more detail the goals that I want to reach.
I want to obtain the start time and end time of a workitem to send this information to a DB ( with the information of the data structure), so, the main issue is finding out the correct time in which to do this.
Thanx in advance. _________________ #10 |
|
Back to top |
|
 |
jmac |
Posted: Mon Apr 02, 2007 6:28 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
If you need to get the container information for the activities I would say your only option is to use the ActivityInstances for a process instance. The way I would do this is to have a final automated activity, that will go out and retrieve the ActivityInstances for the process instance then you can get start and terminate times and container info for EVERY activity in the process instance except the one which is currently running... which I believe you would not care about anyway. _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
kutulu2000 |
Posted: Tue May 29, 2007 3:00 pm Post subject: |
|
|
 Acolyte
Joined: 08 Nov 2005 Posts: 63 Location: Mexico
|
Well, but we want to insert the information for each ActivityInstance in real time and query it in real time, so, when a user ends an activity we must insert the end time and register the creation time of the next Activity instance created. We thought to put an automatic activity before each activity to audit, but not sure if this is the best solution.
Thank you so much _________________ #10 |
|
Back to top |
|
 |
jmac |
Posted: Tue May 29, 2007 4:28 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
I am not sure I understand exactly what it is you want to do. _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
kutulu2000 |
Posted: Wed May 30, 2007 5:48 am Post subject: |
|
|
 Acolyte
Joined: 08 Nov 2005 Posts: 63 Location: Mexico
|
For example, I have 2 program activities (A and B) in my diagram and I want to register information of the data structure plus the created time ( not the start time ) and the end time of each activity instance. But I want to insert this information in the database in the precise moment that this events happen, so I can query the database for reports online.
For end time I have no problem, I can register very well this event, but with the creation time I cannot insert the information when the activity insntance is created so I thought to put upes activities A' and B' before each program activity so I can send the information by the upes to the database.
This solution increases the size of the diagrams and I want to know if this could be the best solution to this problem.
Thanx _________________ #10 |
|
Back to top |
|
 |
jmac |
Posted: Wed May 30, 2007 5:52 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
Going from 2 activities to 4 is really not a problem... but if it was going from 50 to 100 that would be a performance concern I would look into.
Have you considered the possibility of using Audit To MQ, This would allow you to capture the Created and ended events. You would have to look to see if you have a way to capture the container data you need. _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
kutulu2000 |
Posted: Wed May 30, 2007 7:34 am Post subject: |
|
|
 Acolyte
Joined: 08 Nov 2005 Posts: 63 Location: Mexico
|
In fact, our diagrams are very small ( 2 or 3 program activities plus 7 or 8 subprocesses). So you think this could be the best solution to perform this?
Thanxxxxx _________________ #10 |
|
Back to top |
|
 |
jmac |
Posted: Wed May 30, 2007 10:45 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
kutulu2000 wrote: |
So you think this could be the best solution to perform this? |
I would say based on what I know so far this is the best solution for you. I am not sure it is absolutely the best way to do this. I say best for you, because it seems you understand what has to be done to implement your solution.
GOOD LUCK _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
kutulu2000 |
Posted: Wed May 30, 2007 3:09 pm Post subject: |
|
|
 Acolyte
Joined: 08 Nov 2005 Posts: 63 Location: Mexico
|
Thanx Jmac, We'll need it.
 _________________ #10 |
|
Back to top |
|
 |
|