Java Code Examples for org.apache.jackrabbit.webdav.property.DavProperty#getValue()
The following examples show how to use
org.apache.jackrabbit.webdav.property.DavProperty#getValue() .
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: AppointmentManager.java From openmeetings with Apache License 2.0 | 6 votes |
/** * Returns true if the resourcetype Property has a Calendar Element under it. * * @param resourcetype ResourceType Property * @return True if, resource is Calendar, else false. */ private static boolean checkCalendarResourceType(DavProperty<?> resourcetype) { boolean isCalendar = false; if (resourcetype != null) { DavPropertyName calProp = DavPropertyName.create("calendar", CalDAVConstants.NAMESPACE_CALDAV); for (Object o : (Collection<?>) resourcetype.getValue()) { if (o instanceof Element) { Element e = (Element) o; if (e.getLocalName().equals(calProp.getName())) { isCalendar = true; } } } } return isCalendar; }
Example 2
Source File: WebdavFileContentInfoFactory.java From commons-vfs with Apache License 2.0 | 6 votes |
@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 3
Source File: Webdav4FileContentInfoFactory.java From commons-vfs with Apache License 2.0 | 6 votes |
@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 4
Source File: HC4DavExchangeSession.java From davmail with GNU General Public License v2.0 | 5 votes |
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: DavExchangeSession.java From davmail with GNU General Public License v2.0 | 5 votes |
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 6
Source File: AppointmentManager.java From openmeetings with Apache License 2.0 | 5 votes |
private static String getTextValuefromProperty(DavProperty<?> property) { String value = null; if (property != null) { for (Object o : (Collection<?>) property.getValue()) { if (o instanceof Element) { Element e = (Element) o; value = DomUtil.getTextTrim(e); break; } } } return value; }
Example 7
Source File: WebdavFileObject.java From commons-vfs with Apache License 2.0 | 5 votes |
/** * Returns the size of the file content (in bytes). */ @Override protected long doGetContentSize() throws Exception { final DavProperty property = getProperty((URLFileName) getName(), DavConstants.PROPERTY_GETCONTENTLENGTH); if (property != null) { final String value = (String) property.getValue(); return Long.parseLong(value); } return 0; }
Example 8
Source File: WebdavFileObject.java From commons-vfs with Apache License 2.0 | 5 votes |
/** * Returns the last modified time of this file. Is only called if {@link #doGetType} does not return * {@link FileType#IMAGINARY}. */ @Override protected long doGetLastModifiedTime() throws Exception { final DavProperty property = getProperty((URLFileName) getName(), DavConstants.PROPERTY_GETLASTMODIFIED); if (property != null) { final String value = (String) property.getValue(); return DateUtil.parseDate(value).getTime(); } return 0; }
Example 9
Source File: WebdavFileObject.java From commons-vfs with Apache License 2.0 | 5 votes |
private boolean isDirectory(final URLFileName name) throws IOException { try { final DavProperty property = getProperty(name, DavConstants.PROPERTY_RESOURCETYPE); Node node; if (property != null && (node = (Node) property.getValue()) != null) { return node.getLocalName().equals(DavConstants.XML_COLLECTION); } return false; } catch (final FileNotFoundException fse) { throw new FileNotFolderException(name); } }
Example 10
Source File: Webdav4FileObject.java From commons-vfs with Apache License 2.0 | 5 votes |
/** * Returns the size of the file content (in bytes). */ @Override protected long doGetContentSize() throws Exception { final DavProperty property = getProperty((GenericURLFileName) getName(), DavConstants.PROPERTY_GETCONTENTLENGTH); if (property != null) { final String value = (String) property.getValue(); return Long.parseLong(value); } return 0; }
Example 11
Source File: Webdav4FileObject.java From commons-vfs with Apache License 2.0 | 5 votes |
/** * Returns the last modified time of this file. Is only called if {@link #doGetType} does not return * {@link FileType#IMAGINARY}. */ @Override protected long doGetLastModifiedTime() throws Exception { final DavProperty property = getProperty((GenericURLFileName) getName(), DavConstants.PROPERTY_GETLASTMODIFIED); if (property != null) { final String value = (String) property.getValue(); return DateUtils.parseDate(value).getTime(); } return 0; }
Example 12
Source File: Webdav4FileObject.java From commons-vfs with Apache License 2.0 | 5 votes |
private boolean isDirectory(final GenericURLFileName name) throws IOException { try { final DavProperty property = getProperty(name, DavConstants.PROPERTY_RESOURCETYPE); Node node; if (property != null && (node = (Node) property.getValue()) != null) { return node.getLocalName().equals(DavConstants.XML_COLLECTION); } return false; } catch (final FileNotFoundException fse) { throw new FileNotFolderException(name); } }