Search in sources :

Example 1 with ItemDefinitionImpl

use of org.apache.jackrabbit.webdav.jcr.nodetype.ItemDefinitionImpl in project jackrabbit by apache.

the class AbstractItemResource method getProperty.

@Override
public DavProperty<?> getProperty(DavPropertyName name) {
    DavProperty prop = super.getProperty(name);
    if (prop == null) {
        if (JCR_DEFINITION.equals(name)) {
            if (exists()) {
                try {
                    // protected 'definition' property revealing the item definition
                    ItemDefinitionImpl val;
                    if (item.isNode()) {
                        val = NodeDefinitionImpl.create(((Node) item).getDefinition());
                    } else {
                        val = PropertyDefinitionImpl.create(((Property) item).getDefinition());
                    }
                    prop = new DefaultDavProperty<ItemDefinitionImpl>(JCR_DEFINITION, val, true);
                } catch (RepositoryException e) {
                    // should not get here
                    log.error("Error while accessing item definition: " + e.getMessage());
                }
            }
        } else if (JCR_ISNEW.equals(name)) {
            // transaction resource additional protected properties
            if (exists() && item.isNew()) {
                prop = new DefaultDavProperty<String>(JCR_ISNEW, null, true);
            }
        } else if (JCR_ISMODIFIED.equals(name)) {
            // transaction resource additional protected properties
            if (exists() && item.isModified()) {
                prop = new DefaultDavProperty<String>(JCR_ISMODIFIED, null, true);
            }
        } else if (ObservationConstants.SUBSCRIPTIONDISCOVERY.equals(name)) {
            // observation resource
            prop = subsMgr.getSubscriptionDiscovery(this);
        }
    }
    return prop;
}
Also used : DefaultDavProperty(org.apache.jackrabbit.webdav.property.DefaultDavProperty) Node(javax.jcr.Node) DefaultDavProperty(org.apache.jackrabbit.webdav.property.DefaultDavProperty) DavProperty(org.apache.jackrabbit.webdav.property.DavProperty) ItemDefinitionImpl(org.apache.jackrabbit.webdav.jcr.nodetype.ItemDefinitionImpl) RepositoryException(javax.jcr.RepositoryException) Property(javax.jcr.Property) DefaultDavProperty(org.apache.jackrabbit.webdav.property.DefaultDavProperty) HrefProperty(org.apache.jackrabbit.webdav.property.HrefProperty) DavProperty(org.apache.jackrabbit.webdav.property.DavProperty)

Aggregations

Node (javax.jcr.Node)1 Property (javax.jcr.Property)1 RepositoryException (javax.jcr.RepositoryException)1 ItemDefinitionImpl (org.apache.jackrabbit.webdav.jcr.nodetype.ItemDefinitionImpl)1 DavProperty (org.apache.jackrabbit.webdav.property.DavProperty)1 DefaultDavProperty (org.apache.jackrabbit.webdav.property.DefaultDavProperty)1 HrefProperty (org.apache.jackrabbit.webdav.property.HrefProperty)1