01: // This code was generated by GenerateDataObjects
02: package net.sf.borg.model.beans;
03:
04: import net.sf.borg.common.XTree;
05:
06: public class ProjectXMLAdapter extends BeanXMLAdapter {
07:
08: public XTree toXml(KeyedBean b) {
09: Project o = (Project) b;
10: XTree xt = new XTree();
11: xt.name("Project");
12: xt.appendChild("KEY", Integer.toString(o.getKey()));
13: if (o.getId() != null)
14: xt.appendChild("Id", BeanXMLAdapter.toString(o.getId()));
15: if (o.getStartDate() != null)
16: xt.appendChild("StartDate", BeanXMLAdapter.toString(o
17: .getStartDate()));
18: if (o.getDueDate() != null)
19: xt.appendChild("DueDate", BeanXMLAdapter.toString(o
20: .getDueDate()));
21: if (o.getDescription() != null
22: && !o.getDescription().equals(""))
23: xt.appendChild("Description", o.getDescription());
24: if (o.getCategory() != null && !o.getCategory().equals(""))
25: xt.appendChild("Category", o.getCategory());
26: if (o.getStatus() != null && !o.getStatus().equals(""))
27: xt.appendChild("Status", o.getStatus());
28: if (o.getParent() != null)
29: xt.appendChild("Parent", BeanXMLAdapter.toString(o
30: .getParent()));
31: return (xt);
32: }
33:
34: public KeyedBean fromXml(XTree xt) {
35: Project ret = new Project();
36: String ks = xt.child("KEY").value();
37: ret.setKey(BeanXMLAdapter.toInt(ks));
38: String val = "";
39: val = xt.child("Id").value();
40: ret.setId(BeanXMLAdapter.toInteger(val));
41: val = xt.child("StartDate").value();
42: ret.setStartDate(BeanXMLAdapter.toDate(val));
43: val = xt.child("DueDate").value();
44: ret.setDueDate(BeanXMLAdapter.toDate(val));
45: val = xt.child("Description").value();
46: if (!val.equals(""))
47: ret.setDescription(val);
48: val = xt.child("Category").value();
49: if (!val.equals(""))
50: ret.setCategory(val);
51: val = xt.child("Status").value();
52: if (!val.equals(""))
53: ret.setStatus(val);
54: val = xt.child("Parent").value();
55: ret.setParent(BeanXMLAdapter.toInteger(val));
56: return (ret);
57: }
58: }
|