Search in sources :

Example 1 with Element

use of io.milton.http.XmlWriter.Element in project lobcder by skoulouzis.

the class WrappedHrefWriter method writeValue.

public void writeValue(XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes) {
    writer.open(prefix, localName);
    WrappedHref wrappedHref = (WrappedHref) val;
    if (wrappedHref != null && wrappedHref.getValue() != null) {
        // TODO: Replace explicit namespace declaration with reference to constant
        Element hrefEl = writer.begin(WebDavProtocol.NS_DAV.getPrefix(), "href").open();
        hrefEl.writeText(wrappedHref.getValue());
        hrefEl.close();
    }
    writer.close(prefix, localName);
}
Also used : Element(io.milton.http.XmlWriter.Element)

Example 2 with Element

use of io.milton.http.XmlWriter.Element in project lobcder by skoulouzis.

the class AddressDataTypeListValueWriter 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 AddressDataTypeList) {
        Element parent = writer.begin(prefix, localName).open();
        AddressDataTypeList list = (AddressDataTypeList) val;
        if (list != null) {
            for (Pair<String, String> pair : list) {
                Element child = writer.begin(prefix + ":address-data-type").open(false);
                child.writeAtt("content-type", pair.getObject1());
                child.writeAtt("version", pair.getObject2());
                child.close();
            }
        }
        parent.close();
    } else {
        if (val != null) {
            throw new RuntimeException("Value is not correct type. Is a: " + val.getClass());
        }
    }
}
Also used : Element(io.milton.http.XmlWriter.Element)

Example 3 with Element

use of io.milton.http.XmlWriter.Element in project lobcder by skoulouzis.

the class HrefListValueWriter 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 HrefList) {
        Element outerEl = writer.begin(prefix, localName).open();
        HrefList list = (HrefList) val;
        if (list != null) {
            for (String s : list) {
                Element hrefEl = writer.begin(WebDavProtocol.DAV_PREFIX + ":href").open(false);
                hrefEl.writeText(s);
                hrefEl.close();
            }
        }
        outerEl.close();
    } else {
        if (val != null) {
            throw new RuntimeException("Value is not correct type. Is a: " + val.getClass());
        }
    }
}
Also used : Element(io.milton.http.XmlWriter.Element)

Example 4 with Element

use of io.milton.http.XmlWriter.Element 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)

Example 5 with Element

use of io.milton.http.XmlWriter.Element in project lobcder by skoulouzis.

the class PropFindResponseListWriter method writeValue.

@Override
public void writeValue(XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes) {
    Element outerEl = writer.begin(prefix, localName).open();
    PropFindResponseList list = (PropFindResponseList) val;
    if (list != null) {
        for (PropFindResponse s : list) {
            propFindXmlGeneratorHelper.appendResponse(writer, s, nsPrefixes);
        }
    }
    outerEl.close();
}
Also used : Element(io.milton.http.XmlWriter.Element) PropFindResponse(io.milton.http.webdav.PropFindResponse)

Aggregations

Element (io.milton.http.XmlWriter.Element)7 PropFindResponse (io.milton.http.webdav.PropFindResponse)1 PriviledgeList (io.milton.principal.PriviledgeList)1 Priviledge (io.milton.resource.AccessControlledResource.Priviledge)1 List (java.util.List)1 QName (javax.xml.namespace.QName)1