Search in sources :

Example 1 with LengthsProperty

use of org.apache.jackrabbit.webdav.jcr.property.LengthsProperty in project jackrabbit by apache.

the class DefaultItemResource method getProperty.

@Override
public DavProperty<?> getProperty(DavPropertyName name) {
    DavProperty prop = super.getProperty(name);
    if (prop == null && exists()) {
        try {
            Property p = (Property) item;
            if (isMultiple()) {
                if (JCR_LENGTHS.equals(name)) {
                    prop = new LengthsProperty(p.getLengths());
                }
            } else {
                if (JCR_LENGTH.equals(name)) {
                    long length = p.getLength();
                    prop = new DefaultDavProperty<String>(JCR_LENGTH, String.valueOf(length), true);
                } else if (JCR_GET_STRING.equals(name) && p.getType() != PropertyType.BINARY) {
                    // getstring property is only created for single value
                    // non-binary jcr properties
                    prop = new DefaultDavProperty<String>(JCR_GET_STRING, p.getString(), true);
                }
            }
        } catch (RepositoryException e) {
            log.error("Failed to retrieve resource properties: " + e.getMessage());
        }
    }
    return prop;
}
Also used : DefaultDavProperty(org.apache.jackrabbit.webdav.property.DefaultDavProperty) LengthsProperty(org.apache.jackrabbit.webdav.jcr.property.LengthsProperty) DefaultDavProperty(org.apache.jackrabbit.webdav.property.DefaultDavProperty) DavProperty(org.apache.jackrabbit.webdav.property.DavProperty) RepositoryException(javax.jcr.RepositoryException) LengthsProperty(org.apache.jackrabbit.webdav.jcr.property.LengthsProperty) Property(javax.jcr.Property) DefaultDavProperty(org.apache.jackrabbit.webdav.property.DefaultDavProperty) DavProperty(org.apache.jackrabbit.webdav.property.DavProperty) ValuesProperty(org.apache.jackrabbit.webdav.jcr.property.ValuesProperty)

Aggregations

Property (javax.jcr.Property)1 RepositoryException (javax.jcr.RepositoryException)1 LengthsProperty (org.apache.jackrabbit.webdav.jcr.property.LengthsProperty)1 ValuesProperty (org.apache.jackrabbit.webdav.jcr.property.ValuesProperty)1 DavProperty (org.apache.jackrabbit.webdav.property.DavProperty)1 DefaultDavProperty (org.apache.jackrabbit.webdav.property.DefaultDavProperty)1