1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.serializer.objects;
18 import javolution.xml.XMLFormat;
19 import javolution.xml.stream.XMLStreamException;
20
21 import org.apache.commons.lang.StringEscapeUtils;
22
23 public class JSPrincipalRule
24 {
25
26
27 private String locator;
28
29 private String rule;
30
31 public JSPrincipalRule()
32 {
33 }
34 public JSPrincipalRule(String locator, String rule)
35 {
36
37 this.locator = locator;
38 this.rule = rule;
39 }
40
41 /****************************************************************************
42 * SERIALIZER
43 */
44 private static final XMLFormat XML = new XMLFormat(JSPrincipalRule.class)
45 {
46 public void write(Object o, OutputElement xml)
47 throws XMLStreamException
48 {
49 try
50 {
51 JSPrincipalRule g = (JSPrincipalRule) o;
52 xml.setAttribute("locator", g.locator);
53 xml.setAttribute("rule", g.rule);
54 } catch (Exception e)
55 {
56 e.printStackTrace();
57 }
58 }
59
60 public void read(InputElement xml, Object o)
61 {
62 try
63 {
64 JSPrincipalRule g = (JSPrincipalRule) o;
65 g.setLocator(StringEscapeUtils.unescapeHtml(xml.getAttribute("locator","unknown")));
66 g.setRule(StringEscapeUtils.unescapeHtml(xml.getAttribute("rule","unknown")));
67
68
69 } catch (Exception e)
70 {
71 e.printStackTrace();
72 }
73 }
74
75 };
76
77
78
79
80 /***
81 * @return Returns the locator.
82 */
83 public String getLocator()
84 {
85 return locator;
86 }
87
88 /***
89 * @param locator The locator to set.
90 */
91 public void setLocator(String locator)
92 {
93 this.locator = locator;
94 }
95
96 /***
97 * @return Returns the rule.
98 */
99 public String getRule()
100 {
101 return rule;
102 }
103
104 /***
105 * @param rule The rule to set.
106 */
107 public void setRule(String rule)
108 {
109 this.rule = rule;
110 }
111 }