📄 dom4jfpdlserializer.java.svn-base
字号:
writeExtendedAttributes(synchronizer.getExtendedAttributes(),
synchronizerElement);
}
protected void writeActivities(List activities, Element parent)
throws FPDLSerializerException {
if (activities == null || activities.size() == 0) {
return;
}
Element activitiesElement = Util4Serializer.addElement(parent,
ACTIVITIES);
Iterator iter = activities.iterator();
while (iter.hasNext()) {
writeActivity((Activity) iter.next(), activitiesElement);
}
}
protected void writeActivity(Activity activity, Element parent)
throws FPDLSerializerException {
Element activityElement = Util4Serializer.addElement(parent, ACTIVITY);
activityElement.addAttribute(ID, activity.getId());
activityElement.addAttribute(NAME, activity.getName());
activityElement.addAttribute(DISPLAY_NAME, activity.getDisplayName());
activityElement.addAttribute(COMPLETION_STRATEGY, activity.getCompletionStrategy());
Util4Serializer.addElement(activityElement, DESCRIPTION, activity.getDescription());
writeEventListeners(activity.getEventListeners(),activityElement);
writeExtendedAttributes(activity.getExtendedAttributes(),
activityElement);
writeTasks(activity.getTasks(), activityElement);
}
protected void writeTasks(List tasks, Element parent)
throws FPDLSerializerException {
Element tasksElement = Util4Serializer.addElement(parent, TASKS);
Iterator iter = tasks.iterator();
while (iter.hasNext()) {
writeTask((Task) iter.next(), tasksElement);
}
}
protected void writeTask(Task task, Element parent)
throws FPDLSerializerException {
Element taskElement = Util4Serializer.addElement(parent, TASK);
taskElement.addAttribute(ID, task.getId());
taskElement.addAttribute(NAME, task.getName());
taskElement.addAttribute(DISPLAY_NAME, task.getDisplayName());
taskElement.addAttribute(TYPE, task.getType());
// taskElement.addAttribute(START_MODE, task.getStartMode());
taskElement.addAttribute(COMPLETION_STRATEGY, task.getAssignmentStrategy());
taskElement.addAttribute(DEFAULT_VIEW, task.getDefaultView());
taskElement.addAttribute(PRIORITY, Integer.toString(task.getPriority()));
taskElement.addAttribute(EXECUTION, task.getExecution());
Util4Serializer.addElement(taskElement, DESCRIPTION, task.getDescription());
writeForm(EDIT_FORM, task.getEditForm(), taskElement);
writeForm(VIEW_FORM, task.getViewForm(), taskElement);
writeForm(LIST_FORM, task.getListForm(), taskElement);
this.writeApplication(task.getApplication(), taskElement);
this.writeSubWorkflowProcess(task.getSubWorkflowProcess(), taskElement);
this.writePerformer(task.getPerformer(), taskElement);
writeDuration(task.getDuration(), taskElement);
writeEventListeners(task.getEventListeners(),taskElement);
writeExtendedAttributes(task.getExtendedAttributes(), taskElement);
}
protected void writeDuration(Duration duration, Element parent) {
if (duration == null) {
return;
}
Element durationElement = Util4Serializer.addElement(parent, DURATION);
durationElement.addAttribute(VALUE, Integer.toString(duration.getValue()));
durationElement.addAttribute(UNIT, duration.getUnit());
durationElement.addAttribute(IS_BUSINESS_TIME, Boolean.toString(duration.isBusinessTime()));
}
protected void writeForm(String formName, Form form, Element parent) {
if (form == null) {
return;
}
Element editFormElement = Util4Serializer.addElement(parent, formName);
editFormElement.addAttribute(NAME, form.getName());
editFormElement.addAttribute(DISPLAY_NAME, form.getDisplayName());
Util4Serializer.addElement(editFormElement, DESCRIPTION, form.getDescription());
Util4Serializer.addElement(editFormElement, URI, form.getUri());
}
protected void writeTransitions(List transitions, Element parent)
throws FPDLSerializerException {
if (transitions == null || transitions.size() == 0) {
return;
}
Element transitionsElement = Util4Serializer.addElement(parent,
TRANSITIONS);
Iterator iter = transitions.iterator();
while (iter.hasNext()) {
writeTransition((Transition) iter.next(), transitionsElement);
}
}
protected void writeTransition(Transition transition, Element parent)
throws FPDLSerializerException {
Element transitionElement = Util4Serializer.addElement(parent,
TRANSITION);
transitionElement.addAttribute(ID, transition.getId());
transitionElement.addAttribute(FROM, transition.getFromNode().getId());
transitionElement.addAttribute(TO, transition.getToNode().getId());
transitionElement.addAttribute(NAME, transition.getName());
transitionElement.addAttribute(DISPLAY_NAME, transition.getDisplayName());
Util4Serializer.addElement(transitionElement, CONDITION, transition.getCondition());
writeExtendedAttributes(transition.getExtendedAttributes(),
transitionElement);
}
protected Element writeExtendedAttributes(Map extendedAttributes,
Element parent) {
if (extendedAttributes == null || extendedAttributes.size() == 0) {
return null;
}
Element extendedAttributesElement =
Util4Serializer.addElement(parent,
EXTENDED_ATTRIBUTES);
// parent
// .addElement(EXTENDED_ATTRIBUTES);
Iterator keys = extendedAttributes.keySet().iterator();
while (keys.hasNext()) {
Object key = keys.next();
Object value = extendedAttributes.get(key);
Element extendedAttributeElement = Util4Serializer.addElement(
extendedAttributesElement, EXTENDED_ATTRIBUTE);
extendedAttributeElement.addAttribute(NAME, key.toString());
if (value != null) {
extendedAttributeElement.addAttribute(VALUE, value.toString());
}
}
return extendedAttributesElement;
}
protected void writePerformer(Participant participant, Element parent) {
if (participant == null) {
return;
}
Element participantElement = Util4Serializer.addElement(parent,
PERFORMER);
participantElement.addAttribute(NAME, participant.getName());
participantElement.addAttribute(DISPLAY_NAME, participant.getDisplayName());
Util4Serializer.addElement(participantElement, DESCRIPTION, participant.getDescription());
Util4Serializer.addElement(participantElement, ASSIGNMENT_HANDLER,
participant.getAssignmentHandler());
}
protected void writeSubWorkflowProcess(SubWorkflowProcess subWorkflowProcess, Element parent) {
if (subWorkflowProcess == null) {
return;
}
Element subflowElement = Util4Serializer.addElement(parent,
SUB_WORKFLOW_PROCESS);
subflowElement.addAttribute(NAME, subWorkflowProcess.getName());
subflowElement.addAttribute(DISPLAY_NAME, subWorkflowProcess.getDisplayName());
Util4Serializer.addElement(subflowElement, DESCRIPTION, subWorkflowProcess.getDescription());
Util4Serializer.addElement(subflowElement, WORKFLOW_PROCESS_ID,
subWorkflowProcess.getWorkflowProcessId());
}
protected void writeApplication(Application application, Element parent)
throws FPDLSerializerException {
if (application == null) {
return;
}
Element applicationElement = Util4Serializer.addElement(parent,
APPLICATION);
applicationElement.addAttribute(NAME, application.getName());
applicationElement.addAttribute(DISPLAY_NAME, application.getDisplayName());
Util4Serializer.addElement(applicationElement, DESCRIPTION, application.getDescription());
Util4Serializer.addElement(applicationElement, HANDLER, application.getHandler());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -