List of usage examples for com.liferay.portal.kernel.webdav WebDAVUtil DAV_URI
Namespace DAV_URI
To view the source code for com.liferay.portal.kernel.webdav WebDAVUtil DAV_URI.
Click Source Link
From source file:it.smc.calendar.sync.caldav.methods.ProppatchMethodImpl.java
License:Open Source License
protected Set<QName> processInstructions(WebDAVRequest webDAVRequest) throws InvalidRequestException, LockException { try {//from ww w. j a va 2 s .co m Set<QName> newProps = new HashSet<QName>(); WebDAVProps webDavProps = getStoredProperties(webDAVRequest); Document document = CalDAVRequestThreadLocal.getRequestDocument(); if (Validator.isNull(document)) { return newProps; } Element rootElement = document.getRootElement(); List<Element> instructionElements = rootElement.elements(); for (Element instructionElement : instructionElements) { List<Element> propElements = instructionElement.elements(); if (propElements.size() != 1) { throw new InvalidRequestException( "There should only be one <prop /> per set or remove " + "instruction."); } Element propElement = propElements.get(0); if (!propElement.getName().equals("prop") || !propElement.getNamespaceURI().equals(WebDAVUtil.DAV_URI.getURI())) { throw new InvalidRequestException("Invalid <prop /> element " + propElement); } List<Element> customPropElements = propElement.elements(); for (Element customPropElement : customPropElements) { String name = customPropElement.getName(); String prefix = customPropElement.getNamespacePrefix(); String uri = customPropElement.getNamespaceURI(); String text = customPropElement.getText(); Namespace namespace = WebDAVUtil.createNamespace(prefix, uri); if (instructionElement.getName().equals("set")) { if (Validator.isNull(text)) { webDavProps.addProp(name, prefix, uri); } else { webDavProps.addProp(name, prefix, uri, text); } newProps.add(SAXReaderUtil.createQName(customPropElement.getName(), namespace)); } else if (instructionElement.getName().equals("remove")) { webDavProps.removeProp(name, prefix, uri); } else { throw new InvalidRequestException( "Instead of set/remove instruction, received " + instructionElement); } } } WebDAVPropsLocalServiceUtil.storeWebDAVProps(webDavProps); return newProps; } catch (LockException le) { throw le; } catch (Exception e) { throw new InvalidRequestException(e); } }
From source file:it.smc.calendar.sync.caldav.util.CalDAVProps.java
License:Open Source License
public static QName createQName(String name) { return SAXReaderUtil.createQName(name, WebDAVUtil.DAV_URI); }