ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | jawe List | March 2004 Index

<--  Date Index  --> <--  Thread Index  -->

Re: [jawe] Condition on transition


Hi,
 
this is not a bug, and it is also not your fault, but this is the way JaWE works.
To simplify things, and to be able to graphically show you all possibilities when you are editing properties of some element (in this case Transition element), JaWE always creates all possible subelements. So, when you have Transition object created, you always have its Condition object created also, and its type is always set to the default value, which is "Condition". When JaWE writes into XPDL, it checks if subelements are empty or not, and if they are, they are not written in XPDL. The mapping among XPDL and JaWE objects is not 1:1, but it could also be 0:1.
Each JaWE object representing some XPDL element is extending JaWE's XMLElement class. XMLElement class has a lot of useful methods, and one of them is isEmpty() method, which can be redefined by some implementations - some elements can be empty and some can't, it depends on schema.
 
In your case, you should probably do following:
 
Condition cond = (Condition)refTransition.get("Condition");
String transitionType = null;
if (!cond.isEmpty()) {
    transitionType=cond.get("Type").toString();
}
 
 
 
Regards,
Sasa.
----- Original Message -----
Sent: Thursday, March 18, 2004 3:52 PM
Subject: [jawe] Condition on transition

Hi,
I have this xpdl file extract:
 
<Transition From="PrintInitialValue" Id="PK2_AA" Name="Transition" To="Increment">
  <Condition Type="CONDITION">a <= b</Condition>
 
With this code I can access from XPDL Parser the "Type" attribute:
 
Condition cond = (Condition)refTransition.get("Condition");
String transitionType = cond.get("Type").toString;
 
refTransition is my Transition object.
After the execution, transitionType is set to "Condition", all ok.
 
Now, if I have this xpdl:
 
<Transition From="PrintInitialValue" Id="PK2_AA" Name="Transition" To="Increment">
 
without a real condition tag, my transitionType string is however set to "Condition".
I thought that the returned value in this case was "" or null.
This is a bug or my fault?
 
Thanks for suggestions,   
    Alessandro
 
 
 
 
 
 


<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.