/** * Add collection of Children to property * @param properties PropertySet to add. */ public void addChildren(DavPropertySet properties){ if(properties == null || properties.isEmpty()) return; for(DavProperty property: properties){ children.add(property); } }
public ProppatchInfo(DavPropertySet setProperties, DavPropertyNameSet removeProperties) { if (setProperties == null || removeProperties == null) { throw new IllegalArgumentException("Neither setProperties nor removeProperties must be null."); } if (setProperties.isEmpty() && removeProperties.isEmpty()) { throw new IllegalArgumentException("Either setProperties or removeProperties can be empty; not both of them."); } this.changeList = null; this.setProperties = setProperties; this.removeProperties = removeProperties; this.propertyNames.addAll(removeProperties); for (DavPropertyName setName : setProperties.getPropertyNames()) { this.propertyNames.add(setName); } }
public ProppatchInfo(DavPropertySet setProperties, DavPropertyNameSet removeProperties) { if (setProperties == null || removeProperties == null) { throw new IllegalArgumentException("Neither setProperties nor removeProperties must be null."); } if (setProperties.isEmpty() && removeProperties.isEmpty()) { throw new IllegalArgumentException("Either setProperties or removeProperties can be empty; not both of them."); } this.changeList = null; this.setProperties = setProperties; this.removeProperties = removeProperties; this.propertyNames.addAll(removeProperties); for (DavPropertyName setName : setProperties.getPropertyNames()) { this.propertyNames.add(setName); } }
/** * Returns all the set of properties and their value, for all the hrefs * @param property DavPropertyName of the property whose value is to be returned. * @param httpResponse Response Object for the request. * @return Returns the Collection of properties associated with PropertyName, for all the hrefs */ public Collection<DavProperty> getDavProperties(HttpResponse httpResponse, DavPropertyName property) { Collection<DavProperty> set = new ArrayList<>(); try { MultiStatusResponse[] responses = getResponseBodyAsMultiStatus(httpResponse).getResponses(); if (responses != null && succeeded(httpResponse)) { for (MultiStatusResponse r : responses) { DavPropertySet props = r.getProperties(CalDAVStatus.SC_OK); if (!props.isEmpty()) set.add(props.get(property)); } } } catch (Exception e) { log.warn("Unable to get MultiStatusResponse. Status: " + httpResponse.getStatusLine().getStatusCode()); } return set; }
/** * Returns all the set of properties and their value, for all the hrefs * @param response Response object to glean the response from. * @param property Property Name to return. * @return Collection of Properties. * @throws DavException on error building Multistatus response. */ public Collection<DavProperty> getDavProperties(HttpResponse response, DavPropertyName property) throws DavException { Collection<DavProperty> set = new ArrayList<>(); MultiStatusResponse[] responses = getResponseBodyAsMultiStatus(response).getResponses(); if (responses != null && succeeded(response)) { for (MultiStatusResponse r : responses) { DavPropertySet props = r.getProperties(CalDAVStatus.SC_OK); if (!props.isEmpty()) set.add(props.get(property)); } } return set; }
if (!setProperties.isEmpty()) { Element set = DomUtil.addChildElement(proppatch, DavConstants.XML_SET, DavConstants.NAMESPACE); set.appendChild(setProperties.toXml(document));
if (!setProperties.isEmpty()) { Element set = DomUtil.addChildElement(proppatch, DavConstants.XML_SET, DavConstants.NAMESPACE); set.appendChild(setProperties.toXml(document));
@Override public void mkcalendar(DavRequest request, DavResponse response, DavCollection collection) throws CosmoDavException, IOException { if (collection.exists()) { throw new ExistsException(); } DavItemCollection parent = (DavItemCollection) collection.getParent(); if (!parent.exists()) { throw new MissingParentException("One or more intermediate collections must be created"); } if (parent.isCalendarCollection()) { throw new InvalidCalendarLocationException( "A calendar collection may not be created within a calendar collection"); } // XXX DAV:needs-privilege DAV:bind on parent collection if (LOG.isDebugEnabled()) { LOG.debug("MKCALENDAR at " + collection.getResourcePath()); } DavPropertySet properties = request.getMkCalendarSetProperties(); MultiStatusResponse msr = collection.getParent().addCollection(collection, properties); if (properties.isEmpty() || !hasNonOK(msr)) { response.setStatus(201); response.setHeader("Cache-control", "no-cache"); response.setHeader("Pragma", "no-cache"); return; } MultiStatus ms = new MultiStatus(); ms.addResponse(msr); response.sendMultiStatus(ms); }
@Override public void mkcalendar(DavRequest request, DavResponse response, DavCollection collection) throws CosmoDavException, IOException { if (collection.exists()) { throw new ExistsException(); } DavItemCollection parent = (DavItemCollection) collection.getParent(); if (!parent.exists()) { throw new MissingParentException("One or more intermediate collections must be created"); } if (parent.isCalendarCollection()) { throw new InvalidCalendarLocationException( "A calendar collection may not be created within a calendar collection"); } // XXX DAV:needs-privilege DAV:bind on parent collection if (LOG.isDebugEnabled()) { LOG.debug("MKCALENDAR at " + collection.getResourcePath()); } DavPropertySet properties = request.getMkCalendarSetProperties(); MultiStatusResponse msr = collection.getParent().addCollection(collection, properties); if (properties.isEmpty() || !hasNonOK(msr)) { response.setStatus(201); response.setHeader("Cache-control", "no-cache"); response.setHeader("Pragma", "no-cache"); return; } MultiStatus ms = new MultiStatus(); ms.addResponse(msr); response.sendMultiStatus(ms); }