001: // This code was generated by GenerateDataObjects
002: package net.sf.borg.model.beans;
003:
004: import net.sf.borg.common.XTree;
005:
006: public class TaskXMLAdapter extends BeanXMLAdapter {
007:
008: public XTree toXml(KeyedBean b) {
009: Task o = (Task) b;
010: XTree xt = new XTree();
011: xt.name("Task");
012: xt.appendChild("KEY", Integer.toString(o.getKey()));
013: if (o.getTaskNumber() != null)
014: xt.appendChild("TaskNumber", BeanXMLAdapter.toString(o
015: .getTaskNumber()));
016: if (o.getStartDate() != null)
017: xt.appendChild("StartDate", BeanXMLAdapter.toString(o
018: .getStartDate()));
019: if (o.getCD() != null)
020: xt.appendChild("CD", BeanXMLAdapter.toString(o.getCD()));
021: if (o.getDueDate() != null)
022: xt.appendChild("DueDate", BeanXMLAdapter.toString(o
023: .getDueDate()));
024: if (o.getET() != null)
025: xt.appendChild("ET", BeanXMLAdapter.toString(o.getET()));
026: if (o.getPersonAssigned() != null
027: && !o.getPersonAssigned().equals(""))
028: xt.appendChild("PersonAssigned", o.getPersonAssigned());
029: if (o.getPriority() != null)
030: xt.appendChild("Priority", BeanXMLAdapter.toString(o
031: .getPriority()));
032: if (o.getState() != null && !o.getState().equals(""))
033: xt.appendChild("State", o.getState());
034: if (o.getType() != null && !o.getType().equals(""))
035: xt.appendChild("Type", o.getType());
036: if (o.getDescription() != null
037: && !o.getDescription().equals(""))
038: xt.appendChild("Description", o.getDescription());
039: if (o.getResolution() != null && !o.getResolution().equals(""))
040: xt.appendChild("Resolution", o.getResolution());
041: if (o.getTodoList() != null && !o.getTodoList().equals(""))
042: xt.appendChild("TodoList", o.getTodoList());
043: if (o.getUserTask1() != null && !o.getUserTask1().equals(""))
044: xt.appendChild("UserTask1", o.getUserTask1());
045: if (o.getUserTask2() != null && !o.getUserTask2().equals(""))
046: xt.appendChild("UserTask2", o.getUserTask2());
047: if (o.getUserTask3() != null && !o.getUserTask3().equals(""))
048: xt.appendChild("UserTask3", o.getUserTask3());
049: if (o.getUserTask4() != null && !o.getUserTask4().equals(""))
050: xt.appendChild("UserTask4", o.getUserTask4());
051: if (o.getUserTask5() != null && !o.getUserTask5().equals(""))
052: xt.appendChild("UserTask5", o.getUserTask5());
053: if (o.getCategory() != null && !o.getCategory().equals(""))
054: xt.appendChild("Category", o.getCategory());
055: if (o.getProject() != null)
056: xt.appendChild("Project", BeanXMLAdapter.toString(o
057: .getProject()));
058: return (xt);
059: }
060:
061: public KeyedBean fromXml(XTree xt) {
062: Task ret = new Task();
063: String ks = xt.child("KEY").value();
064: ret.setKey(BeanXMLAdapter.toInt(ks));
065: String val = "";
066: val = xt.child("TaskNumber").value();
067: ret.setTaskNumber(BeanXMLAdapter.toInteger(val));
068: val = xt.child("StartDate").value();
069: ret.setStartDate(BeanXMLAdapter.toDate(val));
070: val = xt.child("CD").value();
071: ret.setCD(BeanXMLAdapter.toDate(val));
072: val = xt.child("DueDate").value();
073: ret.setDueDate(BeanXMLAdapter.toDate(val));
074: val = xt.child("ET").value();
075: ret.setET(BeanXMLAdapter.toDate(val));
076: val = xt.child("PersonAssigned").value();
077: if (!val.equals(""))
078: ret.setPersonAssigned(val);
079: val = xt.child("Priority").value();
080: ret.setPriority(BeanXMLAdapter.toInteger(val));
081: val = xt.child("State").value();
082: if (!val.equals(""))
083: ret.setState(val);
084: val = xt.child("Type").value();
085: if (!val.equals(""))
086: ret.setType(val);
087: val = xt.child("Description").value();
088: if (!val.equals(""))
089: ret.setDescription(val);
090: val = xt.child("Resolution").value();
091: if (!val.equals(""))
092: ret.setResolution(val);
093: val = xt.child("TodoList").value();
094: if (!val.equals(""))
095: ret.setTodoList(val);
096: val = xt.child("UserTask1").value();
097: if (!val.equals(""))
098: ret.setUserTask1(val);
099: val = xt.child("UserTask2").value();
100: if (!val.equals(""))
101: ret.setUserTask2(val);
102: val = xt.child("UserTask3").value();
103: if (!val.equals(""))
104: ret.setUserTask3(val);
105: val = xt.child("UserTask4").value();
106: if (!val.equals(""))
107: ret.setUserTask4(val);
108: val = xt.child("UserTask5").value();
109: if (!val.equals(""))
110: ret.setUserTask5(val);
111: val = xt.child("Category").value();
112: if (!val.equals(""))
113: ret.setCategory(val);
114: val = xt.child("Project").value();
115: ret.setProject(BeanXMLAdapter.toInteger(val));
116: return (ret);
117: }
118: }
|