Class RenderingContextImpl
java.lang.Object
org.nuxeo.ecm.core.io.registry.context.RenderingContextImpl
- All Implemented Interfaces:
RenderingContext
A thread-safe
RenderingContext implementation. Please use RenderingContext.CtxBuilder to create
instance of RenderingContext.- Since:
- 7.2
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.nuxeo.ecm.core.io.registry.context.RenderingContext
RenderingContext.CtxBuilder, RenderingContext.SessionWrapper -
Field Summary
Fields inherited from interface org.nuxeo.ecm.core.io.registry.context.RenderingContext
DEFAULT_LOCALE, DEFAULT_URL, REPOSITORY_NAME_REQUEST_HEADER, REPOSITORY_NAME_REQUEST_PARAMETER, RESPONSE_HEADER_ENTITY_TYPE_KEY -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameterListValues(String name, List<?> values) Add values in the context with a given name.voidaddParameterValues(String name, Object... values) Get all parameter in this context except wrapped parameters.Gets the current base url.booleangetBooleanParameter(String name) getEnrichers(String entity) Get all enrichers to activate on the given entity type.getFetched(String entity) Get all properties to fetch for a given entity type.Gets the requestedLocale.<T> TgetParameter(String name) Get the casted parameter value for a given name.<T> List<T>getParameters(String name) Get the casted parameter values for a given name.Get all document properties.getSession(DocumentModel document) Gets the currentCoreSessionor try to create one.getTranslated(String entity) Get all properties to translate for a given entity type.voidsetExistingSession(CoreSession session) Provides aCoreSessionto marshallers.voidsetParameterListValues(String name, List<Object> values) Push values in the context with a given name.voidsetParameterValues(String name, Object... values) wrap()seeWrappedContext
-
Method Details
-
getLocale
Description copied from interface:RenderingContextGets the requestedLocale.- Specified by:
getLocalein interfaceRenderingContext
-
getBaseUrl
Description copied from interface:RenderingContextGets the current base url.- Specified by:
getBaseUrlin interfaceRenderingContext
-
getSession
Description copied from interface:RenderingContextGets the currentCoreSessionor try to create one.- Specified by:
getSessionin interfaceRenderingContext- Parameters:
document- may be null, if present, this method search for a session in the document.- Returns:
- The current
CoreSessionif it exists. null otherwise.
-
setExistingSession
Description copied from interface:RenderingContextProvides aCoreSessionto marshallers.For example: a
CoreSessionfrom the request context.- Specified by:
setExistingSessionin interfaceRenderingContext- Parameters:
session- The existingCoreSessionwhich lifecycle is managed outside the marshalling context.
-
getProperties
Description copied from interface:RenderingContextGet all document properties. This will aggregate all values from parameters "properties", "X-NXproperties" and "X-NXDocumentProperties". This supports value separated by comma.- Specified by:
getPropertiesin interfaceRenderingContext- Returns:
- All document properties.
-
getFetched
Description copied from interface:RenderingContextGet all properties to fetch for a given entity type. This will aggregate all values from parameters "fetch.entity" and "X-NXfetch.entity". This supports value separated by comma.- Specified by:
getFetchedin interfaceRenderingContext- Parameters:
entity- The type of the entity on which you want to fetch properties.- Returns:
- All properties to fetch.
-
getTranslated
Description copied from interface:RenderingContextGet all properties to translate for a given entity type. This will aggregate all values from parameters "translate.entity" and "X-NXtranslate.entity". This supports value separated by comma.- Specified by:
getTranslatedin interfaceRenderingContext- Parameters:
entity- The type of the entity on which you want to fetch properties.- Returns:
- All properties to fetch.
-
getEnrichers
Description copied from interface:RenderingContextGet all enrichers to activate on the given entity type. This will aggregate all values from parameters "enrichers.entity", "X-NXenrichers.entity" and "X-NXContext-Category". This supports value separated by comma.- Specified by:
getEnrichersin interfaceRenderingContext- Parameters:
entity- The type of the entity on which you want to activate enrichers.- Returns:
- All enrichers to activate.
-
wrap
Description copied from interface:RenderingContextseeWrappedContext- Specified by:
wrapin interfaceRenderingContext- Returns:
- A new
WrappedContext
-
getParameter
Description copied from interface:RenderingContextGet the casted parameter value for a given name. If multiple are available, the first found is returned.- Specified by:
getParameterin interfaceRenderingContext- Parameters:
name- The parameter name.- Returns:
- The first parameter value, null if no parameter are availble.
-
getBooleanParameter
Description copied from interface:RenderingContext- Specified by:
getBooleanParameterin interfaceRenderingContext- Returns:
- true is the parameter exists and if it's Boolean.TRUE or "true", false otherwise.
-
getParameters
Description copied from interface:RenderingContextGet the casted parameter values for a given name.- Specified by:
getParametersin interfaceRenderingContext- Parameters:
name- The parameter name.- Returns:
- The parameter values.
-
getAllParameters
Description copied from interface:RenderingContextGet all parameter in this context except wrapped parameters.- Specified by:
getAllParametersin interfaceRenderingContext- Returns:
- All parameter's names and their values.
-
setParameterValues
- Specified by:
setParameterValuesin interfaceRenderingContext- See Also:
-
setParameterListValues
Description copied from interface:RenderingContextPush values in the context with a given name. Please note that this method remove any value for the given name.- Specified by:
setParameterListValuesin interfaceRenderingContext- Parameters:
name- The parameter name.values- The parameter values.
-
addParameterValues
- Specified by:
addParameterValuesin interfaceRenderingContext- See Also:
-
addParameterListValues
Description copied from interface:RenderingContextAdd values in the context with a given name. Please note that this method keep current values for the given name.- Specified by:
addParameterListValuesin interfaceRenderingContext- Parameters:
name- The parameter name.values- The parameter values.
-