1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.impl.jaxb; |
17 | |
|
18 | |
import org.kuali.rice.core.util.jaxb.NameAndNamespacePair; |
19 | |
import org.kuali.rice.core.util.jaxb.NameAndNamespacePairValidatingAdapter; |
20 | |
import org.kuali.rice.core.util.jaxb.StringTrimmingAdapter; |
21 | |
import org.kuali.rice.kim.api.jaxb.NameAndNamespacePairToPermTemplateIdAdapter; |
22 | |
import org.kuali.rice.kim.api.jaxb.PermissionDetailListAdapter; |
23 | |
import org.kuali.rice.kim.api.permission.PermissionContract; |
24 | |
|
25 | |
import javax.xml.bind.annotation.XmlAccessType; |
26 | |
import javax.xml.bind.annotation.XmlAccessorType; |
27 | |
import javax.xml.bind.annotation.XmlElement; |
28 | |
import javax.xml.bind.annotation.XmlTransient; |
29 | |
import javax.xml.bind.annotation.XmlType; |
30 | |
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
31 | |
import java.io.Serializable; |
32 | |
import java.util.HashMap; |
33 | |
import java.util.Map; |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
@XmlAccessorType(XmlAccessType.FIELD) |
41 | |
@XmlType(name="PermissionType", propOrder={ |
42 | |
"permissionNameAndNamespace", "permissionTemplateId", "permissionDescription", "active", "permissionDetails" |
43 | |
}) |
44 | |
public class PermissionXmlDTO implements Serializable { |
45 | |
|
46 | |
private static final long serialVersionUID = 1L; |
47 | |
|
48 | |
@XmlTransient |
49 | |
private String permissionId; |
50 | |
|
51 | |
@XmlElement(name="permissionName") |
52 | |
@XmlJavaTypeAdapter(NameAndNamespacePairValidatingAdapter.class) |
53 | |
private NameAndNamespacePair permissionNameAndNamespace; |
54 | |
|
55 | |
@XmlElement(name="templateName") |
56 | |
@XmlJavaTypeAdapter(NameAndNamespacePairToPermTemplateIdAdapter.class) |
57 | |
private String permissionTemplateId; |
58 | |
|
59 | |
@XmlElement(name="description") |
60 | |
@XmlJavaTypeAdapter(StringTrimmingAdapter.class) |
61 | |
private String permissionDescription; |
62 | |
|
63 | |
@XmlElement(name="active") |
64 | |
private Boolean active; |
65 | |
|
66 | |
@XmlElement(name="permissionDetails") |
67 | |
@XmlJavaTypeAdapter(PermissionDetailListAdapter.class) |
68 | |
private Map<String, String> permissionDetails; |
69 | |
|
70 | 0 | public PermissionXmlDTO() { |
71 | 0 | this.active = Boolean.TRUE; |
72 | 0 | } |
73 | |
|
74 | 0 | public PermissionXmlDTO(PermissionContract permission) { |
75 | 0 | this.permissionNameAndNamespace = new NameAndNamespacePair(permission.getNamespaceCode(), permission.getName()); |
76 | 0 | this.permissionTemplateId = permission.getTemplate().getId(); |
77 | 0 | this.permissionDescription = permission.getDescription(); |
78 | 0 | this.active = Boolean.valueOf(permission.isActive()); |
79 | 0 | this.permissionDetails = (permission.getAttributes() != null) ? |
80 | |
new HashMap<String, String>(permission.getAttributes()) : new HashMap<String, String>(); |
81 | 0 | } |
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
public String getPermissionId() { |
87 | 0 | return this.permissionId; |
88 | |
} |
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
public void setPermissionId(String permissionId) { |
94 | 0 | this.permissionId = permissionId; |
95 | 0 | } |
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
public NameAndNamespacePair getPermissionNameAndNamespace() { |
101 | 0 | return this.permissionNameAndNamespace; |
102 | |
} |
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
public void setPermissionNameAndNamespace(NameAndNamespacePair permissionNameAndNamespace) { |
108 | 0 | this.permissionNameAndNamespace = permissionNameAndNamespace; |
109 | 0 | } |
110 | |
|
111 | |
|
112 | |
|
113 | |
|
114 | |
public String getPermissionTemplateId() { |
115 | 0 | return this.permissionTemplateId; |
116 | |
} |
117 | |
|
118 | |
|
119 | |
|
120 | |
|
121 | |
public void setPermissionTemplateId(String permissionTemplateId) { |
122 | 0 | this.permissionTemplateId = permissionTemplateId; |
123 | 0 | } |
124 | |
|
125 | |
|
126 | |
|
127 | |
|
128 | |
public String getPermissionDescription() { |
129 | 0 | return this.permissionDescription; |
130 | |
} |
131 | |
|
132 | |
|
133 | |
|
134 | |
|
135 | |
public void setPermissionDescription(String permissionDescription) { |
136 | 0 | this.permissionDescription = permissionDescription; |
137 | 0 | } |
138 | |
|
139 | |
|
140 | |
|
141 | |
|
142 | |
public Boolean getActive() { |
143 | 0 | return this.active; |
144 | |
} |
145 | |
|
146 | |
|
147 | |
|
148 | |
|
149 | |
public void setActive(Boolean active) { |
150 | 0 | this.active = active; |
151 | 0 | } |
152 | |
|
153 | |
|
154 | |
|
155 | |
|
156 | |
public Map<String, String> getPermissionDetails() { |
157 | 0 | return this.permissionDetails; |
158 | |
} |
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | |
public void setPermissionDetails(Map<String, String> permissionDetails) { |
164 | 0 | this.permissionDetails = permissionDetails; |
165 | 0 | } |
166 | |
|
167 | |
|
168 | |
|
169 | |
|
170 | |
|
171 | |
|
172 | |
public String getPermissionName() { |
173 | 0 | return (permissionNameAndNamespace != null) ? permissionNameAndNamespace.getName() : null; |
174 | |
} |
175 | |
|
176 | |
|
177 | |
|
178 | |
|
179 | |
|
180 | |
|
181 | |
public String getNamespaceCode() { |
182 | 0 | return (permissionNameAndNamespace != null) ? permissionNameAndNamespace.getNamespaceCode() : null; |
183 | |
} |
184 | |
} |