Java Code Examples for org.apache.jackrabbit.webdav.xml.DomUtil#setText()

The following examples show how to use org.apache.jackrabbit.webdav.xml.DomUtil#setText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrincipalSearchPropertySetReport.java    From cosmo with Apache License 2.0 6 votes vote down vote up
public Element toXml(Document document) {
    Element root = DomUtil.
        createElement(document, "principal-search-property-set",
                      NAMESPACE);

    Element psp = DomUtil.
        createElement(document, "principal-search-property",
                      NAMESPACE);
    root.appendChild(psp);

    Element prop = DomUtil.createElement(document, "prop", NAMESPACE);
    psp.appendChild(prop);

    prop.appendChild(DavPropertyName.DISPLAYNAME.toXml(document));

    // XXX I18N
    Element desc =
        DomUtil.createElement(document, "description", NAMESPACE);
    DomUtil.setAttribute(desc, "lang", NAMESPACE_XML, "en_US");
    DomUtil.setText(desc, "Display name");
    psp.appendChild(desc);

    return root;
}
 
Example 2
Source File: AlternateUriSet.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    for (String href : getHrefs()) {
        Element e = DomUtil.createElement(document, XML_HREF, NAMESPACE);
        DomUtil.setText(e, href);
        name.appendChild(e);
    }

    return name;
}
 
Example 3
Source File: PrincipalCollectionSet.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    for (String href : getHrefs()) {
        Element e = DomUtil.createElement(document, XML_HREF, NAMESPACE);
        DomUtil.setText(e, href);
        name.appendChild(e);
    }

    return name;
}
 
Example 4
Source File: GroupMembership.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    for (String href : getHrefs()) {
        Element e = DomUtil.createElement(document, XML_HREF, NAMESPACE);
        DomUtil.setText(e, href);
        name.appendChild(e);
    }

    return name;
}
 
Example 5
Source File: PrincipalUrl.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    Element href = DomUtil.createElement(document, XML_HREF, NAMESPACE);
    DomUtil.setText(href, getHref());
    name.appendChild(href);

    return name;
}
 
Example 6
Source File: CurrentUserPrincipal.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    Element href = DomUtil.createElement(document, XML_HREF, NAMESPACE);
    DomUtil.setText(href, getHref());
    name.appendChild(href);

    return name;
}
 
Example 7
Source File: Recipient.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    Element e = DomUtil.createElement(document, XML_HREF, NAMESPACE);
    DomUtil.setText(e, getHref());
    name.appendChild(e);

    return name;
}
 
Example 8
Source File: ScheduleOutboxURL.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    Element e = DomUtil.createElement(document, XML_HREF, NAMESPACE);
    DomUtil.setText(e, getHref());
    name.appendChild(e);

    return name;
}
 
Example 9
Source File: ScheduleInboxURL.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    Element e = DomUtil.createElement(document, XML_HREF, NAMESPACE);
    DomUtil.setText(e, getHref());
    name.appendChild(e);

    return name;
}
 
Example 10
Source File: CalendarUserAddressSet.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element calendarUserAddressSetNode = getName().toXml(document);
    
    for(String emailAddress : userEmails){
     Element e = DomUtil.createElement(document, XML_HREF, NAMESPACE);
     DomUtil.setText(e, href(emailAddress));
     calendarUserAddressSetNode.appendChild(e);
    }

    return calendarUserAddressSetNode;
}
 
Example 11
Source File: SupportedCollationSet.java    From cosmo with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * {@inheritDoc}
 */
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    for (String collation : getCollations()) {
        Element e = DomUtil.createElement(document,
                ELEMENT_CALDAV_SUPPORTEDCOLLATION, NAMESPACE_CALDAV);
        DomUtil.setText(e, collation);
        name.appendChild(e);
    }

    return name;
}
 
Example 12
Source File: CalendarHomeSet.java    From cosmo with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * {@inheritDoc}
 */
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    Element e = DomUtil.createElement(document, XML_HREF, NAMESPACE);
    DomUtil.setText(e, getHref());
    name.appendChild(e);

    return name;
}
 
Example 13
Source File: TicketContent.java    From cosmo with Apache License 2.0 5 votes vote down vote up
/**
 * Converts the underlying ticket to an XML fragment suitable
 * for use as request content (ignores any key, owner, created
 * date).
 * @param doc The document.
 * @return The element.
 */
public Element toXml(Document doc) {
    Element e = DomUtil.createElement(doc, ELEMENT_TICKET_TICKETINFO,
                                      NAMESPACE_TICKET);

    Element timeout = DomUtil.createElement(doc, ELEMENT_TICKET_TIMEOUT,
                                            NAMESPACE_TICKET);
    DomUtil.setText(timeout, ticket.getTimeout());
    e.appendChild(timeout);

    DavPrivilegeSet privileges = new DavPrivilegeSet(ticket);
    e.appendChild(privileges.toXml(doc));

    return e;
}
 
Example 14
Source File: TicketDiscovery.java    From cosmo with Apache License 2.0 4 votes vote down vote up
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    String ownerBase = locator.getBaseHref(false);

    for (Ticket ticket : getTickets()) {
        Element ticketInfo =
            DomUtil.createElement(document, ELEMENT_TICKET_TICKETINFO,
                                  NAMESPACE_TICKET);
        name.appendChild(ticketInfo);

        Element id =
            DomUtil.createElement(document, ELEMENT_TICKET_ID,
                                  NAMESPACE_TICKET);
        DomUtil.setText(id, ticket.getKey());
        ticketInfo.appendChild(id);

        Element owner =
            DomUtil.createElement(document, XML_OWNER, NAMESPACE);
        Element href =
            DomUtil.createElement(document, XML_HREF, NAMESPACE);
        String url =
            TEMPLATE_USER.bindAbsolute(ownerBase,
                                       ticket.getOwner().getUsername());
        DomUtil.setText(href, url);
        owner.appendChild(href);
        ticketInfo.appendChild(owner);

        Element timeout =
            DomUtil.createElement(document, ELEMENT_TICKET_TIMEOUT,
                                  NAMESPACE_TICKET);
        DomUtil.setText(timeout, ticket.getTimeout());
        ticketInfo.appendChild(timeout);
 
        // visit limits are not supported; the element remains to
        // comply with the current draft of the spec
        Element visits =
            DomUtil.createElement(document, ELEMENT_TICKET_VISITS,
                                  NAMESPACE_TICKET);
        DomUtil.setText(visits, VALUE_INFINITY);
        ticketInfo.appendChild(visits);

        DavPrivilegeSet privileges = new DavPrivilegeSet(ticket);
        ticketInfo.appendChild(privileges.toXml(document));
    }

    return name;
}
 
Example 15
Source File: DavAce.java    From cosmo with Apache License 2.0 4 votes vote down vote up
protected Element principalXml(Document document) {
    Element root = DomUtil.createElement(document, "href", NAMESPACE);
    DomUtil.setText(root, href);
    return root;
}