Java Code Examples for org.apache.jackrabbit.webdav.property.DavPropertySet#get()

The following examples show how to use org.apache.jackrabbit.webdav.property.DavPropertySet#get() . 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: WebdavFileContentInfoFactory.java    From commons-vfs with Apache License 2.0 6 votes vote down vote up
@Override
public FileContentInfo create(final FileContent fileContent) throws FileSystemException {
    final WebdavFileObject file = (WebdavFileObject) FileObjectUtils.getAbstractFileObject(fileContent.getFile());

    String contentType = null;
    String contentEncoding = null;

    final DavPropertyNameSet nameSet = new DavPropertyNameSet();
    nameSet.add(DavPropertyName.GETCONTENTTYPE);
    final DavPropertySet propertySet = file.getProperties((URLFileName) file.getName(), nameSet, true);

    DavProperty property = propertySet.get(DavPropertyName.GETCONTENTTYPE);
    if (property != null) {
        contentType = (String) property.getValue();
    }
    property = propertySet.get(WebdavFileObject.RESPONSE_CHARSET);
    if (property != null) {
        contentEncoding = (String) property.getValue();
    }

    return new DefaultFileContentInfo(contentType, contentEncoding);
}
 
Example 2
Source File: Webdav4FileContentInfoFactory.java    From commons-vfs with Apache License 2.0 6 votes vote down vote up
@Override
public FileContentInfo create(final FileContent fileContent) throws FileSystemException {
    final Webdav4FileObject file = (Webdav4FileObject) FileObjectUtils.getAbstractFileObject(fileContent.getFile());

    String contentType = null;
    String contentEncoding = null;

    final DavPropertyNameSet nameSet = new DavPropertyNameSet();
    nameSet.add(DavPropertyName.GETCONTENTTYPE);
    final DavPropertySet propertySet = file.getProperties((GenericURLFileName) file.getName(), nameSet, true);

    DavProperty property = propertySet.get(DavPropertyName.GETCONTENTTYPE);
    if (property != null) {
        contentType = (String) property.getValue();
    }
    property = propertySet.get(Webdav4FileObject.RESPONSE_CHARSET);
    if (property != null) {
        contentEncoding = (String) property.getValue();
    }

    return new DefaultFileContentInfo(contentType, contentEncoding);
}
 
Example 3
Source File: HC4DavExchangeSession.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
protected String getURIPropertyIfExists(DavPropertySet properties, String alias) throws IOException {
    DavProperty property = properties.get(Field.getPropertyName(alias));
    if (property == null) {
        return null;
    } else {
        return URIUtil.decode((String) property.getValue());
    }
}
 
Example 4
Source File: HC4DavExchangeSession.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
protected String getPropertyIfExists(DavPropertySet properties, String alias) {
    DavProperty property = properties.get(Field.getResponsePropertyName(alias));
    if (property == null) {
        return null;
    } else {
        Object value = property.getValue();
        if (value instanceof Node) {
            return ((Node) value).getTextContent();
        } else if (value instanceof List) {
            StringBuilder buffer = new StringBuilder();
            for (Object node : (List) value) {
                if (buffer.length() > 0) {
                    buffer.append(',');
                }
                if (node instanceof Node) {
                    // jackrabbit
                    buffer.append(((Node) node).getTextContent());
                } else {
                    // ExchangeDavMethod
                    buffer.append(node);
                }
            }
            return buffer.toString();
        } else {
            return (String) value;
        }
    }
}
 
Example 5
Source File: HC4DavExchangeSession.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
protected int getIntPropertyIfExists(DavPropertySet properties, String alias) {
    DavProperty property = properties.get(Field.getPropertyName(alias));
    if (property == null) {
        return 0;
    } else {
        return Integer.parseInt((String) property.getValue());
    }
}
 
Example 6
Source File: HC4DavExchangeSession.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
protected long getLongPropertyIfExists(DavPropertySet properties, @SuppressWarnings("SameParameterValue") String alias) {
    DavProperty property = properties.get(Field.getPropertyName(alias));
    if (property == null) {
        return 0;
    } else {
        return Long.parseLong((String) property.getValue());
    }
}
 
Example 7
Source File: HC4DavExchangeSession.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
protected double getDoublePropertyIfExists(DavPropertySet properties, @SuppressWarnings("SameParameterValue") String alias) {
    DavProperty property = properties.get(Field.getResponsePropertyName(alias));
    if (property == null) {
        return 0;
    } else {
        return Double.parseDouble((String) property.getValue());
    }
}
 
Example 8
Source File: DavExchangeSession.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
protected String getURIPropertyIfExists(DavPropertySet properties, String alias) throws IOException {
    DavProperty property = properties.get(Field.getPropertyName(alias));
    if (property == null) {
        return null;
    } else {
        return URIUtil.decode((String) property.getValue());
    }
}
 
Example 9
Source File: DavExchangeSession.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
protected String getPropertyIfExists(DavPropertySet properties, String alias) {
    DavProperty property = properties.get(Field.getResponsePropertyName(alias));
    if (property == null) {
        return null;
    } else {
        Object value = property.getValue();
        if (value instanceof Node) {
            return ((Node) value).getTextContent();
        } else if (value instanceof List) {
            StringBuilder buffer = new StringBuilder();
            for (Object node : (List) value) {
                if (buffer.length() > 0) {
                    buffer.append(',');
                }
                if (node instanceof Node) {
                    // jackrabbit
                    buffer.append(((Node) node).getTextContent());
                } else {
                    // ExchangeDavMethod
                    buffer.append(node);
                }
            }
            return buffer.toString();
        } else {
            return (String) value;
        }
    }
}
 
Example 10
Source File: DavExchangeSession.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
protected int getIntPropertyIfExists(DavPropertySet properties, String alias) {
    DavProperty property = properties.get(Field.getPropertyName(alias));
    if (property == null) {
        return 0;
    } else {
        return Integer.parseInt((String) property.getValue());
    }
}
 
Example 11
Source File: DavExchangeSession.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
protected long getLongPropertyIfExists(DavPropertySet properties, @SuppressWarnings("SameParameterValue") String alias) {
    DavProperty property = properties.get(Field.getPropertyName(alias));
    if (property == null) {
        return 0;
    } else {
        return Long.parseLong((String) property.getValue());
    }
}
 
Example 12
Source File: DavExchangeSession.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
protected double getDoublePropertyIfExists(DavPropertySet properties, @SuppressWarnings("SameParameterValue") String alias) {
    DavProperty property = properties.get(Field.getResponsePropertyName(alias));
    if (property == null) {
        return 0;
    } else {
        return Double.parseDouble((String) property.getValue());
    }
}
 
Example 13
Source File: WebdavFileObject.java    From commons-vfs with Apache License 2.0 4 votes vote down vote up
DavProperty getProperty(final URLFileName fileName, final DavPropertyName name) throws FileSystemException {
    final DavPropertyNameSet nameSet = new DavPropertyNameSet();
    nameSet.add(name);
    final DavPropertySet propertySet = getProperties(fileName, nameSet, false);
    return propertySet.get(name);
}
 
Example 14
Source File: Webdav4FileObject.java    From commons-vfs with Apache License 2.0 4 votes vote down vote up
DavProperty getProperty(final GenericURLFileName fileName, final DavPropertyName name) throws FileSystemException {
    final DavPropertyNameSet nameSet = new DavPropertyNameSet();
    nameSet.add(name);
    final DavPropertySet propertySet = getProperties(fileName, nameSet, false);
    return propertySet.get(name);
}