Example usage for com.liferay.portal.kernel.webdav Resource isCollection

List of usage examples for com.liferay.portal.kernel.webdav Resource isCollection

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.webdav Resource isCollection.

Prototype

public boolean isCollection();

Source Link

Usage

From source file:it.smc.calendar.sync.caldav.methods.BasePropMethodImpl.java

License:Open Source License

protected void addResponse(WebDAVRequest webDAVRequest, Resource resource, Element multistatus,
        Set<QName> props) throws Exception {

    // Make a deep copy of the props

    if (props.contains(CalDAVProps.DAV_ALLPROP)) {
        props.remove(CalDAVProps.DAV_ALLPROP);

        if (resource.isCollection()) {
            props.addAll(CalDAVProps.getAllCollectionProps());
        } else {//w w w  . j ava2s.co m
            props.addAll(CalDAVProps.getAllResourceProps());
        }
    }

    PropsProcessor propsProcessor = CalDAVPropsProcessorFactory.create(webDAVRequest, resource, multistatus);

    propsProcessor.processProperties(props);
}

From source file:it.smc.calendar.sync.caldav.methods.BasePropMethodImpl.java

License:Open Source License

protected void addResponse(WebDAVStorage storage, WebDAVRequest webDAVRequest, Resource resource,
        Set<QName> props, Element multistatusElement, long depth) throws Exception {

    addResponse(webDAVRequest, resource, multistatusElement, props);

    if (resource.isCollection() && (depth != 0)) {
        List<Resource> calendarResources = storage.getResources(webDAVRequest);

        for (Resource calendarResource : calendarResources) {
            addResponse(webDAVRequest, calendarResource, multistatusElement, props);
        }// w  w w .  java2  s  .  c  o m
    }
}

From source file:it.smc.calendar.sync.caldav.util.CalDAVUtil.java

License:Open Source License

public static Set<QName> getRequestDAVProps(WebDAVRequest webDAVRequest) throws InvalidRequestException {

    try {//from  ww  w.j a v a2  s .  c o  m
        Set<QName> props = new HashSet<QName>();

        Resource resource = webDAVRequest.getWebDAVStorage().getResource(webDAVRequest);

        Document document = CalDAVRequestThreadLocal.getRequestDocument();

        if (document == null) {
            if (resource.isCollection()) {
                return CalDAVProps.getAllCollectionProps();
            } else {
                return CalDAVProps.getAllResourceProps();
            }
        }

        Element rootElement = document.getRootElement();

        if (rootElement.element("allprop") != null) {
            if (resource.isCollection()) {
                return CalDAVProps.getAllCollectionProps();
            } else {
                return CalDAVProps.getAllResourceProps();
            }
        }

        Element propElement = rootElement.element("prop");

        List<Element> elements = propElement.elements();

        for (Element element : elements) {
            String prefix = element.getNamespacePrefix();
            String uri = element.getNamespaceURI();

            Namespace namespace = WebDAVUtil.createNamespace(prefix, uri);

            props.add(SAXReaderUtil.createQName(element.getName(), namespace));
        }

        return props;
    } catch (Exception e) {
        throw new InvalidRequestException(e);
    }
}