/** * @param property Property containing the {@link CalDAVConstants#ELEM_GETETAG} * @return Returns the ETag from the specified Property, null otherwise. */ public static String getEtagfromProperty(DavProperty property){ if(property == null || property.getValue() == null || !property.getName().equals(DavPropertyName.GETETAG)) return null; return property.getValue().toString(); } }
private void spoolMultiValued(OutputStream out) { try { Document doc = DomUtil.createDocument(); doc.appendChild(getProperty(JCR_VALUES).toXml(doc)); ContentHandler handler = SerializingContentHandler.getSerializer(out); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform( new DOMSource(doc), new SAXResult(handler)); } catch (SAXException e) { log.error("Failed to set up XML serializer for " + item, e); } catch (TransformerConfigurationException e) { log.error("Failed to set up XML transformer for " + item, e); } catch (ParserConfigurationException e) { log.error("Failed to set up XML document for " + item, e); } catch (TransformerException e) { log.error("Failed to serialize the values of " + item, e); } }
/** * Create a new <code>NodeTypeProperty</code> from the specified general * DavProperty object. * * @param property */ public NodeTypeProperty(DavProperty<?> property) { super(property.getName(), property.isInvisibleInAllprop()); if (property instanceof NodeTypeProperty) { nodetypeNames.addAll(((NodeTypeProperty) property).nodetypeNames); } else { nodetypeNames.addAll(NodeTypeUtil.ntNamesFromXml(property.getValue())); } }
super(prop.getName(), prop.isProtected()); if (prop instanceof HrefProperty) { Object val = prop.getValue(); if (val instanceof List) { Iterator it = ((List)val).iterator();
int getIndex(DavPropertySet propSet) { int index = Path.INDEX_UNDEFINED; DavProperty<?> indexProp = propSet.get(JcrRemotingConstants.JCR_INDEX_LN, ItemResourceConstants.NAMESPACE); if (indexProp != null && indexProp.getValue() != null) { index = Integer.parseInt(indexProp.getValue().toString()); } return index; }
/** * Adds a new property to this set. * * @param property The property to add * * @return The previously assigned property or <code>null</code>. */ public DavProperty<?> add(DavProperty<?> property) { return map.put(property.getName(), property); }
propFindType == PROPFIND_ALL_PROP || propFindType == PROPFIND_ALL_PROP_INCLUDE; boolean wasRequested = missing.remove(property.getName()); && !property.isInvisibleInAllprop()) || wasRequested) { status200.addContent(property);
while (iter.hasNext()) { DavProperty property = iter.nextProperty(); if ((propFindType == PROPFIND_ALL_PROP && !property.isProtected()) || propNameSet.remove(property.getName())) { status200.addContent(property);
int getIndex(DavPropertySet propSet) { int index = Path.INDEX_UNDEFINED; DavProperty<?> indexProp = propSet.get(JcrRemotingConstants.JCR_INDEX_LN, ItemResourceConstants.NAMESPACE); if (indexProp != null && indexProp.getValue() != null) { index = Integer.parseInt(indexProp.getValue().toString()); } return index; }
/** * Adds a new property to this set. * * @param property The property to add * * @return The previously assigned property or <code>null</code>. */ public DavProperty<?> add(DavProperty<?> property) { return map.put(property.getName(), property); }
propFindType == PROPFIND_ALL_PROP || propFindType == PROPFIND_ALL_PROP_INCLUDE; boolean wasRequested = missing.remove(property.getName()); && !property.isInvisibleInAllprop()) || wasRequested) { status200.addContent(property);
/** * Checks if this property has the same {@link DavPropertyName name} * and value as the given one. * * @param obj the object to compare to * @return <code>true</code> if the 2 objects are equal; * <code>false</code> otherwise */ @Override public boolean equals(Object obj) { if (obj instanceof DavProperty) { DavProperty<?> prop = (DavProperty<?>) obj; boolean equalName = getName().equals(prop.getName()); boolean equalValue = (getValue() == null) ? prop.getValue() == null : getValue().equals(prop.getValue()); return equalName && equalValue; } return false; }
/** * Convenience method to return the Calendar Display Name. * @param urlPath Location of the CalendarResource * @param httpResponse Response Object for the request. * @return Display Name as string */ public String getDisplayName(HttpResponse httpResponse, String urlPath) { DavProperty p = getDavProperty(httpResponse, urlPath, DavPropertyName.DISPLAYNAME); if (p != null && p.getValue() != null) { return p.getValue().toString(); } return ""; }
/** * Adds a new property to this set. * * @param property The property to add * * @return The previously assigned property or <code>null</code>. */ public DavProperty add(DavProperty property) { return (DavProperty) map.put(property.getName(), property); }
super(prop.getName(), prop.isInvisibleInAllprop()); if (prop instanceof HrefProperty) { Object val = prop.getValue(); if (val instanceof List) { for (Object entry : ((List<?>) val)) {
/** * Return the AclProperty relative to a given url * * @param urlPath Location of the CalendarResource * @param httpResponse Response Object for the request. * @return AclProperty xml response or null if missing */ public AclProperty getAcl(HttpResponse httpResponse, String urlPath) { DavProperty p = getDavProperty(httpResponse, urlPath, CalDAVConstants.DNAME_ACL); if (p != null) { try { return AclProperty.createFromXml(p.toXml(DomUtil.createDocument())); } catch (DavException | ParserConfigurationException e) { log.warn("Unable to create AclProperty"); } } return null; }
/** * Checks if this property has the same {@link DavPropertyName name} * and value as the given one. * * @param obj the object to compare to * @return <code>true</code> if the 2 objects are equal; * <code>false</code> otherwise */ public boolean equals(Object obj) { if (obj instanceof DavProperty) { DavProperty prop = (DavProperty) obj; boolean equalName = getName().equals(prop.getName()); boolean equalValue = (getValue() == null) ? prop.getValue() == null : getValue().equals(prop.getValue()); return equalName && equalValue; } return false; }
/** * Convenience method to return the Calendar Description from the * @param httpResponse Response Object for the request. * @param urlPath Location of the CalendarResource * @return Calendar Description as String */ public String getCalendarDescription(HttpResponse httpResponse, String urlPath) { DavProperty p = getDavProperty(httpResponse, urlPath, CalDAVConstants.DNAME_CALENDAR_DESCRIPTION); if (p != null && p.getValue() != null) { return p.getValue().toString(); } else { return ""; } }
/** * Seeks for the next valid property */ private void seek() { while (iterator.hasNext()) { next = iterator.next(); if (namespace == null || namespace.equals(next.getName().getNamespace())) { return; } } next = null; } }
super(prop.getName(), prop.isInvisibleInAllprop()); if (prop instanceof HrefProperty) { Object val = prop.getValue(); if (val instanceof List) { for (Object entry : ((List<?>) val)) {