Search in sources :

Example 1 with SlingPropertyValueHandler

use of org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler in project sling by apache.

the class ModifyOperation method writeContent.

/**
     * Writes back the content
     *
     * @throws PersistenceException if a persistence error occurs
     */
private void writeContent(final ResourceResolver resolver, final Map<String, RequestProperty> reqProperties, final List<Modification> changes, final VersioningConfiguration versioningConfiguration) throws PersistenceException {
    final SlingPropertyValueHandler propHandler = new SlingPropertyValueHandler(dateParser, this.jcrSsupport, changes);
    for (final RequestProperty prop : reqProperties.values()) {
        if (prop.hasValues()) {
            final Resource parent = deepGetOrCreateResource(resolver, prop.getParentPath(), reqProperties, changes, versioningConfiguration);
            this.jcrSsupport.checkoutIfNecessary(parent, changes, versioningConfiguration);
            // skip jcr special properties
            if (prop.getName().equals(JcrConstants.JCR_PRIMARYTYPE) || prop.getName().equals(JcrConstants.JCR_MIXINTYPES)) {
                continue;
            }
            if (prop.isFileUpload()) {
                uploadHandler.setFile(parent, prop, changes);
            } else {
                propHandler.setProperty(parent, prop);
            }
        }
    }
}
Also used : RequestProperty(org.apache.sling.servlets.post.impl.helper.RequestProperty) SlingPropertyValueHandler(org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler) Resource(org.apache.sling.api.resource.Resource)

Aggregations

Resource (org.apache.sling.api.resource.Resource)1 RequestProperty (org.apache.sling.servlets.post.impl.helper.RequestProperty)1 SlingPropertyValueHandler (org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler)1