public abstract class FormResourceEdit
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
FormResourceEdit.CommonAndPartial
Helper struct for the result of
getCommonAndPartialMultiValues(List, String) . |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REOPEN_PARAM |
static java.lang.String |
RESOURCES_ATTRIBUTE |
static java.lang.String |
RESOURCES_PARAM |
static java.lang.String |
WRITE_SUFFIX |
Constructor and Description |
---|
FormResourceEdit() |
Modifier and Type | Method and Description |
---|---|
static FormResourceEdit.CommonAndPartial |
getCommonAndPartialMultiValues(java.util.List<Resource> resources,
java.lang.String name)
Calculates the set of common values and the set of partially present
values for a multi-value property on a list of resources.
|
static Resource |
getMergedResource(java.util.List<Resource> resources)
Retrieves a resource that presents a synthetic resource with merged
values for all the given resources.
|
static java.lang.String |
getPostResourcePath(SlingHttpServletRequest request)
Returns the (unvalidated) path of the single resource that is target of
the form POST request.
|
static java.util.List<Resource> |
getPostResources(SlingHttpServletRequest request)
Returns a list of all resources that are the target of the form POST
request based on the "edit" resource action, and which can actually
be written to using the request session.
|
static java.util.List<Resource> |
getResources(ServletRequest req)
Get the list of resources to be handled by the "edit" resources form action.
|
static boolean |
isMultiResource(ServletRequest req)
Returns if multiple resources are handled by the "edit" resource form
action.
|
static boolean |
isMultiResourcePost(SlingHttpServletRequest request)
Returns whether the given form POST based on the "edit" resource action
targets multiple resources.
|
static boolean |
isSingleResource(ServletRequest req)
Returns if exactly a single resource is handled by the "edit" resource
form action.
|
static boolean |
isSingleResourcePost(SlingHttpServletRequest request)
Returns whether the given form POST based on the "edit" resource action
targets a single resource.
|
static void |
multiPost(java.util.List<Resource> resources,
SlingHttpServletRequest request,
SlingHttpServletResponse response)
Performs a Sling POST servlet modify operation, but on multiple
resources.
|
static void |
setResources(ServletRequest req,
java.util.List<Resource> resources)
Sets the list of resources to be handled by the "edit" resources form action.
|
public static final java.lang.String RESOURCES_ATTRIBUTE
public static final java.lang.String RESOURCES_PARAM
public static final java.lang.String REOPEN_PARAM
public static final java.lang.String WRITE_SUFFIX
public static void setResources(ServletRequest req, java.util.List<Resource> resources)
req
- current requestresources
- the list of resourcespublic static java.util.List<Resource> getResources(ServletRequest req)
req
- current requestnull
if not set)public static Resource getMergedResource(java.util.List<Resource> resources)
MergedValueMap
.resources
- list of resources to mergepublic static FormResourceEdit.CommonAndPartial getCommonAndPartialMultiValues(java.util.List<Resource> resources, java.lang.String name)
FormResourceEdit.CommonAndPartial.common
values will be the ones that are present in the property
in all resources, whereas the FormResourceEdit.CommonAndPartial.partial
values will be the set of
all values that are present at least in one resource, but not all of
them. The multi-value property is seen as set, so the order and multiple
occurrences of the same value in a single property do not make any
difference.resources
- a list of resourcesname
- the name of the multi-value property to inspectFormResourceEdit.CommonAndPartial.common
and FormResourceEdit.CommonAndPartial.partial
sets of valuespublic static boolean isSingleResource(ServletRequest req)
req
- current requestpublic static boolean isMultiResource(ServletRequest req)
req
- current requestpublic static boolean isSingleResourcePost(SlingHttpServletRequest request)
request
- current requestpublic static boolean isMultiResourcePost(SlingHttpServletRequest request)
request
- current requestpublic static java.lang.String getPostResourcePath(SlingHttpServletRequest request)
null
.request
- current requestnull
public static java.util.List<Resource> getPostResources(SlingHttpServletRequest request)
request
- current requestpublic static void multiPost(java.util.List<Resource> resources, SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, java.io.IOException
The Sling POST servlet (more specifically, its modify operation) itself can only handle a single resource (using the request resource) or by using absolute paths to properties. This method will automatically rewrite the parameters for the multiple resources and then call the Sling POST servlet. All resources will be changed in a single transaction. The response will look like the standard Sling POST response.
resources
- list of resources to bulk-editrequest
- current POST request, including the parameters for the Sling
POST servletresponse
- current responseServletException
- if post failsjava.io.IOException
- if post fails"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"