private void setPropertyAsIs()

in src/main/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandler.java [211:259]


    private void setPropertyAsIs(final Modifiable parent, final RequestProperty prop)
    throws PersistenceException {

        String[] values = prop.getStringValues();

        // RequestProperty#getStringValues already takes care of the configs ignoreBlanks, defaultValues etc.
        // and provides values as null, new String[0] etc. accordingly.
        if (values == null || (values.length == 1 && values[0].length() == 0)) {
            // if no value is present or a single empty string is given,
            // just remove the existing property (if any)
            removeProperty(parent, prop);

        } else if (values.length == 0) {
            // do not create new prop here, but clear existing
            clearProperty(parent, prop);

        } else {
            // when patching, simply update the value list using the patch operations
            if (prop.isPatch()) {
                values = patch(parent, prop.getName(), values);
                if (values == null) {
                    return;
                }
            }

            final boolean multiValue = isMultiValue(parent, prop, values);

            if (multiValue) {
                // converting single into multi value props requires deleting it first
                removeIfSingleValueProperty(parent, prop);
            }

            final int type = getType(parent, prop);
            if (jcrSupport.hasSession(parent.resource.getResourceResolver())) {

                if (type == PropertyType.DATE) {
                    if (storeAsDate(parent, prop.getName(), values, multiValue)) {
                        return;
                    }
                } else if (isReferencePropertyType(type)) {
                    if (storeAsReference(parent, prop.getName(), values, type, multiValue)) {
                        return;
                    }
                }
            }

            store(parent, prop.getName(), values, type, multiValue);
        }
    }