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

The following examples show how to use org.apache.jackrabbit.webdav.xml.DomUtil#createElement() . 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: SupportedCalendarData.java    From cosmo with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * {@inheritDoc}
 */
public Element toXml(Document document) {
    Element name = getName().toXml(document);
    
    Element element =
        DomUtil.createElement(document, ELEMENT_CALDAV_CALENDAR_DATA,
                              NAMESPACE_CALDAV);
    DomUtil.setAttribute(element, ATTR_CALDAV_CONTENT_TYPE,
                         NAMESPACE_CALDAV, ICALENDAR_MEDIA_TYPE);
    DomUtil.setAttribute(element, ATTR_CALDAV_VERSION,
                         NAMESPACE_CALDAV, ICALENDAR_VERSION);
    
    name.appendChild(element);
    
    return name;
}
 
Example 2
Source File: ScheduleResponse.java    From cosmo with Apache License 2.0 6 votes vote down vote up
/**
 * @param document The document.
 * @return The element created.
 */
public Element toXml(Document document) {
    Element response = DomUtil.createElement(document, ELEMENT_CALDAV_RESPONSE, NAMESPACE_CALDAV);
    response.appendChild(recipient.toXml(document));

    Element statusElem = DomUtil.createElement(document, ELEMENT_CALDAV_REQUEST_STATUS, NAMESPACE_CALDAV, getStatus()
            .getValue());
    response.appendChild(statusElem);

    if (calendarData != null) {
        response.appendChild(calendarData.toXml(document));
    }
    if (description != null) {
        Element respDesc = DomUtil.createElement(document, XML_RESPONSEDESCRIPTION, NAMESPACE, description);
        response.appendChild(respDesc);
    }
    return response;
}
 
Example 3
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 4
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 5
Source File: DavAcl.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element root =
        DomUtil.createElement(document, "acl", NAMESPACE);

    for (DavAce ace : aces)
        root.appendChild(ace.toXml(document));

    return root;
}
 
Example 6
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 7
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 8
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 9
Source File: DavPrivilegeSet.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element root =
        DomUtil.createElement(document, "privilege", NAMESPACE);
    for (DavPrivilege p : this) {
        if (p.isAbstract()) {
            continue;
        }
        root.appendChild(p.toXml(document));
    }
    return root;
}
 
Example 10
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 11
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 12
Source File: StandardDavResponse.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element prop = DomUtil.createElement(document, XML_PROP, NAMESPACE);
    if (td != null) {
        prop.appendChild(td.toXml(document));
    }
    return prop;
}
 
Example 13
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 14
Source File: DavPrivilege.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    if (isAbstract) {
        return null;
    }
    Element privilege = DomUtil.createElement(document, 
            XML_PRIVILEGE, DavConstants.NAMESPACE); 
    privilege.appendChild(DomUtil.createElement(document, 
            qname.getLocalPart(), ns(qname)));
    return privilege;
}
 
Example 15
Source File: DavAce.java    From cosmo with Apache License 2.0 4 votes vote down vote up
protected Element principalXml(Document document) {
    return DomUtil.createElement(document, "authenticated", NAMESPACE);
}
 
Example 16
Source File: DavAce.java    From cosmo with Apache License 2.0 4 votes vote down vote up
protected Element principalXml(Document document) {
    return DomUtil.createElement(document, "self", NAMESPACE);
}
 
Example 17
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, "property", NAMESPACE);
    root.appendChild(property.toXml(document));
    return root;
}
 
Example 18
Source File: DavAce.java    From cosmo with Apache License 2.0 4 votes vote down vote up
protected Element principalXml(Document document) {
    return DomUtil.createElement(document, "unauthenticated", NAMESPACE);
}
 
Example 19
Source File: DavAce.java    From cosmo with Apache License 2.0 4 votes vote down vote up
protected Element principalXml(Document document) {
    return DomUtil.createElement(document, "all", NAMESPACE);
}
 
Example 20
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;
}