use of io.milton.principal.PriviledgeList in project lobcder by skoulouzis.
the class PriviledgeListValueWriter method writeValue.
@Override
public void writeValue(XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes) {
if (val instanceof PriviledgeList) {
PriviledgeList list = (PriviledgeList) val;
Element outerEl = writer.begin(prefix, localName).open();
if (list != null) {
for (Priviledge p : list) {
String privilegeString = PriviledgeListValueWriter.priviledgeToStringMap.get(p);
if (privilegeString == null) {
continue;
}
Element privilegeEl = writer.begin(WebDavProtocol.DAV_PREFIX + ":privilege").open(false);
Element privilegeValueEl = privilegeEl.begin(WebDavProtocol.DAV_PREFIX, privilegeString);
privilegeValueEl.noContent();
privilegeEl.close();
}
}
outerEl.close();
} else {
if (val != null) {
throw new RuntimeException("Value is not correct type. Is a: " + val.getClass());
}
}
}
Aggregations