-
1. Re: Task node exception!
mdonato Nov 28, 2005 10:09 AM (in response to mdonato)More info:
Task Controller:public void submitParameters(Map parameters, TaskInstance taskInstance) { Token token = taskInstance.getToken(); ProcessInstance processInstance = token.getProcessInstance(); ContextInstance contextInstance = (ContextInstance) processInstance.getInstance(ContextInstance.class); Iterator it = variableList.iterator(); while(it.hasNext()){ Element element = (Element) it.next(); Variable variable = Variable.createVariable(element, contextInstance, processInstance.getRootToken() ); // then do the update if ((variable.getWriteable().equals("S")) && (parameters.get(variable.getName()) != null)) { contextInstance.setVariable(variable.getName(), parameters.get(variable.getName()), token); } } }
processDefinition:<task-node name="task1"> <task name="resp1" swimlane="resp1" description="Autorizacao nivel 1"> <controller config-type="bean" class="br.com.glr.jbpm.handlers.BaseControllerHandler" > <variableList element-type="org.dom4j.Element"> <variable name="pes.atrnomepessoa"></variable> <variable name="fun.atrregistro"></variable> <variable name="tur.atrnometurno"></variable> <variable name="bat.atrcodigobatida"></variable> <variable name="apo.atrdataexcecao"></variable> <variable name="apo.atrdatamarcacaoentrada"></variable> <variable name="apo.atrdatamarcacaosaida"></variable> <variable name="apo.atracumuladohoras"> <showWhen variable="bat.atrdiashorasquantidade" operator="eq" value="H"/> </variable> <variable name="apo.atrquantidadedesconto"> <showWhen variable="bat.atrdiashorasquantidade" operator="neq" value="H"/> </variable> <variable name="apo.atridmotivoautorizacao" writeable="S" required="S"></variable> <variable name="apo.atracumuladohorasautorizado" writeable="S" required="S"> <showWhen variable="bat.atrdiashorasquantidade" operator="eq" value="H"/> </variable> <variable name="apo.atrquantidadedescontoautorizado" writeable="S" required="S"> <showWhen variable="bat.atrdiashorasquantidade" operator="neq" value="H"/> </variable> </variableList> </controller> <event type="task-create"> <action class="br.com.glr.jbpm.handlers.MotivoAutorizacaoActionHandler" config-type="bean" > <atrIdBatida>$apo.atridbatida</atrIdBatida> </action> </event> </task> <transition name="autorizado" to="task2"></transition> <transition name="nao.autorizado" to="node.nao.autorizado"></transition> </task-node>
-
2. Re: Task node exception!
koen.aers Nov 28, 2005 4:23 PM (in response to mdonato)This is a Hibernate message. This is because all node types are stored in the same table. They get loaded by Hibernate lazily (in fact they are not loaded, but there is a stub in the collection representing all the different nodes of the collection). When you are actually using the nodes (in this case a tasknode) the object in the collection gets replaced by an actual TaskNode instance. This operation effectively breaks the == operator.
Nothing really to worry about ;-)
Regards,
Koen -
3. Re: Task node exception!
mdonato Nov 28, 2005 5:00 PM (in response to mdonato)All right!
Thanks for answer! -
4. Re: Task node exception!
christianbacher Feb 22, 2006 9:16 AM (in response to mdonato)ok (jbpm3.1,postgresql8,java1.5,jboss4.0.3SP1),
i have the same warning in the log file.
but i have the problem, that
the methodtoken.getNode()
gives me aorg.jbpm.graph.def.Node$$EnhancerByCGLIB$$a104bdc6
object.
I can't cast this object to a task node (at the time i do this the node is
for sure a task node, because it is equal to a tasknode)
is this a bug or a feature?
thanks and best regards,
christian -
5. Re: Task node exception!
aguizar Feb 23, 2006 1:05 AM (in response to mdonato)It is a well-documented feature. See section 19.1.3, single-ended association proxies of the Hibernate reference manual for details.
In particular, you can make the node castable to a TaskNode this way:TaskNode taskNode = hbSession.load(TaskNode.class, token.getNode().getId());
Note this does not result in a round trip to the database if Node proxy was already initialized and you have a second-level cache in place.