Java Reference
In-Depth Information
}
catch
(Exception e){
e.printStackTrace();
}
}
// generate the XPDL representation of a process
// description
public
Element toXML(Document doc){
Element process
#
doc.createElement(TAG);
process.setAttribute("ID",id);
process.setAttribute("NAME",id);
process.setAttribute("VERSION",version);
process.setAttribute("CATEGORY",category);
Element descrE
#
doc.createElement("DESCRIPTION");
descrE.appendChild(doc.createTextNode(description));
process.appendChild(descrE);
// Activities
Iterator it
#
activities.values().iterator();
while
(it.hasNext()){
WfActivityDefinition activity
#
(WfActivityDefinition)it.next();
process.appendChild(activity.toXML(doc));
}
// Transitions
it
#
activities.values().iterator();
while
(it.hasNext()){
WfActivityDefinition from
#
(WfActivityDefinition)it.next();
Iterator trans
#
from.out.iterator();
while
(trans.hasNext()){
WfActivityDefinition to
#
(WfActivityDefinition)trans.next();
Element transition
#
doc.createElement("TRANSITION");
transition.setAttribute("FROM",from.id);
transition.setAttribute("TO",to.id);
process.appendChild(transition);
}
}
// Participants
it
#
participants.values().iterator();
while
(it.hasNext()){
WfParticipant participant
#
(WfParticipant)it.next();
process.appendChild(participant.toXML(doc));
}
return
process;
}
}
An exception is the
WfTransitionInformation
class that does not contain