Package org.apache.jackrabbit.webdav.property

Examples of org.apache.jackrabbit.webdav.property.PropContainer


            int propFindType) {
        this(resource.getHref(), null, TYPE_PROPSTAT);

        // only property names requested
        if (propFindType == PROPFIND_PROPERTY_NAMES) {
            PropContainer status200 =
                getPropContainer(DavServletResponse.SC_OK, true);
            for (DavPropertyName propName : resource.getPropertyNames()) {
                status200.addContent(propName);
            }
        // all or a specified set of property and their values requested.
        } else {
            PropContainer status200 =
                getPropContainer(DavServletResponse.SC_OK, false);

            // Collection of missing property names for 404 responses
            Set<DavPropertyName> missing =
                new HashSet<DavPropertyName>(propNameSet.getContent());

            // Add requested properties or all non-protected properties,
            // or non-protected properties plus requested properties
            // (allprop/include)
            if (propFindType == PROPFIND_BY_PROPERTY) {
                for (DavPropertyName propName : propNameSet) {
                    DavProperty<?> prop = resource.getProperty(propName);
                    if (prop != null) {
                        status200.addContent(prop);
                        missing.remove(propName);
                    }
                }
            } else {
                for (DavProperty<?> property : resource.getProperties()) {
                    boolean allDeadPlusRfc4918LiveProperties =
                        propFindType == PROPFIND_ALL_PROP
                        || propFindType == PROPFIND_ALL_PROP_INCLUDE;
                    boolean wasRequested = missing.remove(property.getName());

                    if ((allDeadPlusRfc4918LiveProperties
                            && !property.isInvisibleInAllprop())
                            || wasRequested) {
                        status200.addContent(property);
                    }
                }
            }

            if (!missing.isEmpty() && propFindType != PROPFIND_ALL_PROP) {
                PropContainer status404 =
                    getPropContainer(DavServletResponse.SC_NOT_FOUND, true);
                for (DavPropertyName propName : missing) {
                    status404.addContent(propName);
                }
            }
        }
    }
View Full Code Here


        response.appendChild(DomUtil.hrefToXml(getHref(), document));
        if (type == TYPE_PROPSTAT) {
            // add '<propstat>' elements
            for (Integer statusKey : statusMap.keySet()) {
                Status st = new Status(statusKey);
                PropContainer propCont = statusMap.get(statusKey);
                if (!propCont.isEmpty()) {
                    Element propstat = DomUtil.createElement(document, XML_PROPSTAT, NAMESPACE);
                    propstat.appendChild(propCont.toXml(document));
                    propstat.appendChild(st.toXml(document));
                    response.appendChild(propstat);
                }
            }
        } else {
View Full Code Here

     *
     * @param property the property to add
     */
    public void add(DavProperty<?> property) {
        checkType(TYPE_PROPSTAT);
        PropContainer status200 = getPropContainer(DavServletResponse.SC_OK, false);
        status200.addContent(property);
    }
View Full Code Here

     *
     * @param propertyName the property name to add
     */
    public void add(DavPropertyName propertyName) {
        checkType(TYPE_PROPSTAT);
        PropContainer status200 = getPropContainer(DavServletResponse.SC_OK, true);
        status200.addContent(propertyName);
    }
View Full Code Here

     * @param property the property to add
     * @param status the status of the response set to select
     */
    public void add(DavProperty<?> property, int status) {
        checkType(TYPE_PROPSTAT);
        PropContainer propCont = getPropContainer(status, false);
        propCont.addContent(property);
    }
View Full Code Here

     * @param propertyName the property name to add
     * @param status the status of the response set to select
     */
    public void add(DavPropertyName propertyName, int status) {
        checkType(TYPE_PROPSTAT);
        PropContainer propCont = getPropContainer(status, true);
        propCont.addContent(propertyName);
    }
View Full Code Here

    /**
     * @param status
     * @return
     */
    private PropContainer getPropContainer(int status, boolean forNames) {
        PropContainer propContainer = statusMap.get(status);
        if (propContainer == null) {
            if (forNames) {
                propContainer = new DavPropertyNameSet();
            } else {
                propContainer = new DavPropertySet();
View Full Code Here

     * @param status
     * @return property set
     */
    public DavPropertySet getProperties(int status) {
        if (statusMap.containsKey(status)) {
            PropContainer mapEntry = statusMap.get(status);
            if (mapEntry != null && mapEntry instanceof DavPropertySet) {
                return (DavPropertySet) mapEntry;
            }
        }
        return new DavPropertySet();
View Full Code Here

     * @param status
     * @return property names
     */
    public DavPropertyNameSet getPropertyNames(int status) {
        if (statusMap.containsKey(status)) {
            PropContainer mapEntry = statusMap.get(status);
            if (mapEntry != null) {
                if (mapEntry instanceof DavPropertySet) {
                    DavPropertyNameSet set = new DavPropertyNameSet();
                    for (DavPropertyName name : ((DavPropertySet) mapEntry).getPropertyNames()) {
                        set.add(name);
View Full Code Here

                               int propFindType) {
        this(resource.getHref(), null, TYPE_PROPSTAT);

        // only property names requested
        if (propFindType == PROPFIND_PROPERTY_NAMES) {
            PropContainer status200 = getPropContainer(DavServletResponse.SC_OK, true);
            DavPropertyName[] propNames = resource.getPropertyNames();
            for (int i = 0; i < propNames.length; i++) {
                status200.addContent(propNames[i]);
            }
            // all or a specified set of property and their values requested.
        } else {
            PropContainer status200 = getPropContainer(DavServletResponse.SC_OK, false);
            // clone set of property, since several resources could use this again
            propNameSet = new DavPropertyNameSet(propNameSet);
            // Add requested properties or all non-protected properties
            DavPropertyIterator iter = resource.getProperties().iterator();
            while (iter.hasNext()) {
                DavProperty property = iter.nextProperty();
                if ((propFindType == PROPFIND_ALL_PROP && !property.isProtected()) || propNameSet.remove(property.getName())) {
                    status200.addContent(property);
                }
            }

            if (!propNameSet.isEmpty() && propFindType != PROPFIND_ALL_PROP) {
                PropContainer status404 = getPropContainer(DavServletResponse.SC_NOT_FOUND, true);
                DavPropertyNameIterator iter1 = propNameSet.iterator();
                while (iter1.hasNext()) {
                    DavPropertyName propName = iter1.nextPropertyName();
                    status404.addContent(propName);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.webdav.property.PropContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.