1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.efaps.update.schema.ui;
22
23 import java.net.URL;
24 import java.util.HashSet;
25 import java.util.List;
26 import java.util.Map;
27 import java.util.Set;
28
29 import org.efaps.admin.event.EventType;
30 import org.efaps.update.LinkInstance;
31 import org.efaps.update.event.Event;
32 import org.efaps.util.EFapsException;
33
34
35
36
37
38 public class FormUpdate
39 extends AbstractCollectionUpdate
40 {
41
42
43 private static final Link LINK2TYPE = new UniqueLink("Admin_UI_LinkIsTypeFormFor", "From", "Admin_DataModel_Type",
44 "To");
45
46
47
48
49 private static final Set<Link> ALLLINKS = new HashSet<Link>();
50 static {
51 FormUpdate.ALLLINKS.add(FormUpdate.LINK2TYPE);
52 }
53
54
55
56
57
58 public FormUpdate(final URL _url)
59 {
60 super(_url, "Admin_UI_Form", FormUpdate.ALLLINKS);
61 }
62
63
64
65
66
67
68
69 @Override
70 protected AbstractDefinition newDefinition()
71 {
72 return new FormDefinition();
73 }
74
75
76
77
78 public class FormDefinition
79 extends Definition
80 {
81
82
83
84
85 @Override
86 protected void readXML(final List<String> _tags,
87 final Map<String, String> _attributes,
88 final String _text)
89 throws EFapsException
90 {
91 final String value = _tags.get(0);
92 if ("type".equals(value)) {
93
94
95 addLink(FormUpdate.LINK2TYPE, new LinkInstance(_text));
96 } else if ("trigger".equals(value)) {
97 if (_tags.size() == 1) {
98 addEvent(new Event(_attributes.get("name"), EventType.valueOf(_attributes.get("event")),
99 _attributes.get("program"), _attributes.get("method"), _attributes.get("index")));
100 } else if ((_tags.size() == 2) && "property".equals(_tags.get(1))) {
101 getEvents().get(getEvents().size() - 1).addProperty(_attributes.get("name"), _text);
102 } else {
103 super.readXML(_tags, _attributes, _text);
104 }
105
106 } else {
107 super.readXML(_tags, _attributes, _text);
108 }
109 }
110 }
111 }