Search in sources :

Example 1 with Priviledge

use of io.milton.resource.AccessControlledResource.Priviledge 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());
        }
    }
}
Also used : PriviledgeList(io.milton.principal.PriviledgeList) Element(io.milton.http.XmlWriter.Element) Priviledge(io.milton.resource.AccessControlledResource.Priviledge)

Aggregations

Element (io.milton.http.XmlWriter.Element)1 PriviledgeList (io.milton.principal.PriviledgeList)1 Priviledge (io.milton.resource.AccessControlledResource.Priviledge)1