/** * Builds a DavPropertyNameSet with properties for versions * @return */ public static DavPropertyNameSet getFileVersionPropSet() { DavPropertyNameSet propSet = new DavPropertyNameSet(); propSet.add(DavPropertyName.GETCONTENTTYPE); propSet.add(DavPropertyName.RESOURCETYPE); propSet.add(DavPropertyName.GETCONTENTLENGTH); propSet.add(DavPropertyName.GETLASTMODIFIED); propSet.add(DavPropertyName.CREATIONDATE); propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_REMOTE_ID, Namespace.getNamespace(WebdavEntry.NAMESPACE_OC)); propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE, Namespace.getNamespace(WebdavEntry.NAMESPACE_OC)); return propSet; }
@Override protected void initPropertyNames() { super.initPropertyNames(); names.addAll(JcrDavPropertyNameSet.WORKSPACE_SET); if (SecurityUtils.supportsAccessControl(getRepositorySession())) { names.add(SecurityConstants.SUPPORTED_PRIVILEGE_SET); names.add(SecurityConstants.CURRENT_USER_PRIVILEGE_SET); } }
/** * @param contentEntry NOTE that an instance of <code>DavPropertyName</code> * in order to successfully add the given entry. * @return true if contentEntry is an instance of <code>DavPropertyName</code> * that could be added to this set. False otherwise. * @see PropContainer#addContent(Object) */ public boolean addContent(Object contentEntry) { if (contentEntry instanceof DavPropertyName) { return add((DavPropertyName)contentEntry); } log.debug("DavPropertyName object expected. Found: " + contentEntry.getClass().toString()); return false; }
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); } }
/** * @param contentEntry NOTE that an instance of <code>DavPropertyName</code> * in order to successfully add the given entry. * @return true if contentEntry is an instance of <code>DavPropertyName</code> * that could be added to this set. False otherwise. * @see PropContainer#addContent(Object) */ @Override public boolean addContent(PropEntry contentEntry) { if (contentEntry instanceof DavPropertyName) { return add((DavPropertyName) contentEntry); } log.debug("DavPropertyName object expected. Found: " + contentEntry.getClass().toString()); return false; }
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); } }
/** * @param contentEntry NOTE that an instance of <code>DavPropertyName</code> * in order to successfully add the given entry. * @return true if contentEntry is an instance of <code>DavPropertyName</code> * that could be added to this set. False otherwise. * @see PropContainer#addContent(Object) */ @Override public boolean addContent(PropEntry contentEntry) { if (contentEntry instanceof DavPropertyName) { return add((DavPropertyName) contentEntry); } log.debug("DavPropertyName object expected. Found: " + contentEntry.getClass().toString()); return false; }
/** * Builds a DavPropertyNameSet with properties for trashbin * @return */ public static DavPropertyNameSet getTrashbinPropSet() { DavPropertyNameSet propSet = new DavPropertyNameSet(); propSet.add(DavPropertyName.RESOURCETYPE); propSet.add(DavPropertyName.GETCONTENTTYPE); propSet.add(DavPropertyName.GETCONTENTLENGTH); propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE, Namespace.getNamespace(WebdavEntry.NAMESPACE_OC)); propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_REMOTE_ID, Namespace.getNamespace(WebdavEntry.NAMESPACE_OC)); propSet.add(WebdavEntry.TRASHBIN_FILENAME, Namespace.getNamespace(WebdavEntry.NAMESPACE_NC)); propSet.add(WebdavEntry.TRASHBIN_ORIGINAL_LOCATION, Namespace.getNamespace(WebdavEntry.NAMESPACE_NC)); propSet.add(WebdavEntry.TRASHBIN_DELETION_TIME, Namespace.getNamespace(WebdavEntry.NAMESPACE_NC)); return propSet; }
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); }
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); }
@Override protected void initPropertyNames() { super.initPropertyNames(); if (SecurityUtils.supportsAccessControl(getRepositorySession())) { names.add(SecurityConstants.SUPPORTED_PRIVILEGE_SET); } } }
/** * @return A {@link MultiStatusResponse} with all property statuses. */ private MultiStatusResponse createPropStat() { DavPropertyNameSet propertyNameSet = new DavPropertyNameSet(); for (DavPropertyName propertyName : getPropertyNames()) { propertyNameSet.add(propertyName); } return new MultiStatusResponse(this, propertyNameSet); }
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); }
/** * Create a new <code>DavPropertyNameSet</code> from the given DAV:prop * element. * * @param propElement * @throws IllegalArgumentException if the specified element is <code>null</code> * or is not a DAV:prop element. */ public DavPropertyNameSet(Element propElement) { if (!DomUtil.matches(propElement, XML_PROP, NAMESPACE)) { throw new IllegalArgumentException("'DAV:prop' element expected."); } // fill the set ElementIterator it = DomUtil.getChildren(propElement); while (it.hasNext()) { add(DavPropertyName.createFromXml(it.nextElement())); } }
/** * @see XmlSerializable#toXml(Document) */ public Element toXml(Document document) { Element psElem = DomUtil.createElement(document, XML_PRINCIPAL_SEARCH_PROPERTY, SecurityConstants.NAMESPACE); // create property set from the single property name DavPropertyNameSet pnSet = new DavPropertyNameSet(); pnSet.add(propName); psElem.appendChild(pnSet.toXml(document)); // append description if present if (description != null) { Element desc = DomUtil.addChildElement(psElem, XML_DESCRIPTION, SecurityConstants.NAMESPACE, description); if (language != null) { DomUtil.setAttribute(desc, ATTR_LANG, Namespace.XML_NAMESPACE, language); } } return psElem; }
/** * @see XmlSerializable#toXml(Document) */ public Element toXml(Document document) { Element psElem = DomUtil.createElement(document, XML_PRINCIPAL_SEARCH_PROPERTY, SecurityConstants.NAMESPACE); // create property set from the single property name DavPropertyNameSet pnSet = new DavPropertyNameSet(); pnSet.add(propName); psElem.appendChild(pnSet.toXml(document)); // append description if present if (description != null) { Element desc = DomUtil.addChildElement(psElem, XML_DESCRIPTION, SecurityConstants.NAMESPACE, description); if (language != null) { DomUtil.setAttribute(desc, ATTR_LANG, Namespace.XML_NAMESPACE, language); } } return psElem; }
/** * Create a new <code>DavPropertyNameSet</code> from the given DAV:prop * element. * * @param propElement * @throws IllegalArgumentException if the specified element is <code>null</code> * or is not a DAV:prop element. */ public DavPropertyNameSet(Element propElement) { if (!DomUtil.matches(propElement, XML_PROP, NAMESPACE)) { throw new IllegalArgumentException("'DAV:prop' element expected."); } // fill the set ElementIterator it = DomUtil.getChildren(propElement); while (it.hasNext()) { add(DavPropertyName.createFromXml(it.nextElement())); } }
@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); } }
@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); } }
@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); } }