1 | void set(String key, String value) {↵ | | 1 | void set(String key, String value) {↵
|
2 | Element child = getParentElement().getChild(key);↵ | | 2 | Element child = getParentElement().getChild(key);↵
|
3 | if (child == null) {↵ | | 3 | if (child == null) {↵
|
4 | child = new Element(key);↵ | | 4 | child = new Element(key);↵
|
5 | getParentElement().addContent(child);↵ | | 5 | getParentElement().addContent(child);↵
|
6 | }↵ | | 6 | }↵
|
7 | child.setText(value);↵ | | 7 | child.setText(value);↵
|
8 | }↵ | | 8 | }↵
|
|
9 | public↵ | | 9 | /**↵
|
| | | 10 | * @see org.columba.calendar.model.api.IBasicModel#set(java.lang.String,↵
|
| | | 11 | * java.lang.String, java.lang.String)↵
|
| | | 12 | */↵
|
10 | void set(String key, String prefix, String value) {↵ | | 13 | protected void set(String key, String prefix, String value) {↵
|
11 | Element child = getParentElement().getChild(key);↵ | | 14 | Element child = getParentElement().getChild(key);↵
|
12 | if (child == null) {↵ | | 15 | if (child == null) {↵
|
13 | child = new Element(key);↵ | | 16 | child = new Element(key);↵
|
14 | getParentElement().addContent(child);↵ | | 17 | getParentElement().addContent(child);↵
|
15 | }↵ | | 18 | }↵
|
16 | Element prefixchild = child.getChild(prefix);↵ | | 19 | Element prefixchild = child.getChild(prefix);↵
|
17 | if (prefixchild == null) {↵ | | 20 | if (prefixchild == null) {↵
|
18 | prefixchild = new Element(prefix);↵ | | 21 | prefixchild = new Element(prefix);↵
|
19 | child.addContent(prefixchild);↵ | | 22 | child.addContent(prefixchild);↵
|
20 | }↵ | | 23 | }↵
|
21 | prefixchild.setText(value);↵ | | 24 | prefixchild.setText(value);↵
|
22 | }↵ | | 25 | }↵
|
|
23 | public↵ | | 26 | /**↵
|
| | | 27 | * @see org.columba.calendar.model.api.IBasicModel#get(java.lang.String)↵
|
| | | 28 | */↵
|
24 | String get(String key) {↵ | | 29 | protected String get(String key) {↵
|
25 | Element child = getParentElement().getChild(key);↵ | | 30 | Element child = getParentElement().getChild(key);↵
|
26 | if (child == null) {↵ | | 31 | if (child == null) {↵
|
27 | child = new Element(key);↵ | | 32 | child = new Element(key);↵
|
28 | getParentElement().addContent(child);↵ | | 33 | getParentElement().addContent(child);↵
|
29 | }↵ | | 34 | }↵
|
30 | return child.getTextNormalize();↵ | | 35 | return child.getTextNormalize();↵
|
31 | }↵ | | 36 | }↵
|
|
32 | public↵ | | 37 | /**↵
|
| | | 38 | * @see org.columba.calendar.model.api.IBasicModel#get(java.lang.String,↵
|
| | | 39 | * java.lang.String)↵
|
| | | 40 | */↵
|
33 | String get(String key, String prefix) {↵ | | 41 | protected String get(String key, String prefix) {↵
|
34 | Element child = getParentElement().getChild(key);↵ | | 42 | Element child = getParentElement().getChild(key);↵
|
35 | if (child == null) {↵ | | 43 | if (child == null) {↵
|
36 | child = new Element(key);↵ | | 44 | child = new Element(key);↵
|
37 | getParentElement().addContent(child);↵ | | 45 | getParentElement().addContent(child);↵
|
38 | }↵ | | 46 | }↵
|
39 | Element prefixchild = child.getChild(prefix);↵ | | 47 | Element prefixchild = child.getChild(prefix);↵
|
40 | if (prefixchild == null) {↵ | | 48 | if (prefixchild == null) {↵
|
41 | prefixchild = new Element(prefix);↵ | | 49 | prefixchild = new Element(prefix);↵
|
42 | child.addContent(prefixchild);↵ | | 50 | child.addContent(prefixchild);↵
|
43 | }↵ | | 51 | }↵
|
|
44 | return prefixchild.getTextNormalize();↵ | | 52 | return prefixchild.getTextNormalize();↵
|
45 | }↵ | | 53 | }↵
|
|
| | | 54 | /**↵
|
| | | 55 | * @see org.columba.calendar.model.api.IBasicModel#getDocument()↵
|
| | | 56 | */↵
|
46 | public Document getDocument() {↵ | | 57 | public Document getDocument() {↵
|
47 | return doc;↵ | | 58 | return doc;↵
|
48 | }↵ | | 59 | }↵
|
|
49 | /**↵ | | 60 | /**↵
|
50 | * @return Returns the id.↵ | | 61 | * @return Returns the id.↵
|
51 | */↵ | | 62 | */↵
|
52 | public String getId() {↵ | | 63 | public String getId() {↵
|
53 | return get(VCARD.ID);↵ | | 64 | return get(ICALENDAR.UID);↵
|
54 | }↵ | | 65 | }↵
|
|
55 | public void setId(String id) {↵ | | 66 | public void setId(String id) {↵
|
56 | set(VCARD.ID, id);↵ | | 67 | set(ICALENDAR.UID, id);↵
|
57 | } | | 68 | }
|