Package org.ametys.web.parameters.view
Class ViewParametersManager
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.web.parameters.view.ViewParametersManager
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
Manager for view parameters
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Object representing the data holder of the parameter with the path of the parameter in this holder -
Field Summary
Modifier and TypeFieldDescriptionprotected ContentTypeExtensionPoint
The content type extension pointprotected ContentTypesHelper
The content types helperprotected ContentViewParametersManager
The content view parameters managerprotected GlobalViewParametersManager
The global view parameters managerprotected AmetysObjectResolver
The Ametys object resolverprotected ServiceExtensionPoint
The service extension pointprotected ServiceViewParametersManager
The service view parameters managerprotected SkinsManager
The skins managerprotected ModelItemTypeExtensionPoint
The view parameters type extension pointstatic final String
The name of the model item containing the content view parameters This model item is created from scratch, the name doesn't matterstatic final String
The composite name for content view parametersstatic final String
Avalon Rolestatic final String
The name of default attribute in the service parameters to set the service view Warning : it's a convention to call this parameter 'xslt', but a service can't have several view xsl with different namesstatic final String
The composite name for service view parametersstatic final String
The name of the model item to disable inheritance for template This model item is created from scratch, the name doesn't matterstatic final String
The composite name for view parametersstatic final String
The name of the tag containing the content view parametersstatic final String
The node type for view parametersstatic final String
The name of the tag containing the service view parametersstatic final String
The name of the tag containing the template view parametersstatic final String
The name of the tag containing the zone view parametersstatic final String
The name of the tag containing the zone item view parametersstatic final String
The name of the parent tag containing the zone item view parametersstatic final String
The name of the model item to disable inheritance for zone This model item is created from scratch, the name doesn't matter -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_getTemplateViewParameterHolderWithInheritance
(Page page, ViewParameter viewParameter, String parameterPath) Get the parameter holder with the effective parameter path for a view parameter of a template, taking into account the inheritance._getZoneViewParameterHolderWithInheritance
(Page page, Zone zone, ViewParameter viewParameter, String parameterPath) Get the parameter holder with the effective parameter path for a view parameter of a zone, taking into account the inheritance.addGlobalViewParameters
(String skinId, GlobalViewParametersManager.ViewParametersType type, Optional<ViewParametersModel> viewParameters) Get the global view parameters for the given type and add the view parameters to itvoid
copyContentViewParameters
(ModifiableZoneItem zoneItemSource, ModifiableZoneItem zoneItemDestination) Copy content view parameters of the source zone item to the destination zone itemvoid
copyServiceViewParameters
(ModifiableZoneItem zoneItemSource, ModifiableZoneItem zoneItemDestination) Copy service view parameters of the source zone item to the destination zone item<T> T
getContentParameterValue
(ZoneItem zoneItem, String viewName, String parameterPath) Get the content parameter valuegetContentViewEnumerator
(Content content) Get a static enumerator with all content viewgetContentViewParametersHolder
(JCRRepositoryData parentJCRData, String viewName, ViewParametersModel viewParametersModel) Get the content view parameters holdergetContentViewParametersHolder
(ZoneItem zoneItem) Get content view parameters holder from the zone itemgetContentViewParametersModel
(String skinId, Content content, String viewName) Get the content view parameters modelgetContentViewParametersModel
(ZoneItem zoneItem) Get the content view parameters modelgetContentViewParametersModels
(String skinId, Content content) Get all view parameters model for one contentgetInheritCheckboxElement
(Model model, String name) Get a check box to override inherit parametersgetParametersHolder
(JCRRepositoryData parentJCRData, ViewParametersModel viewParametersModel) Get the view parameters holder<T> T
getServiceParameterValue
(ZoneItem zoneItem, String viewName, String parameterPath) Get the service parameter valuegetServiceViewEnumerator
(String serviceId) Get a service enumerator with all content viewgetServiceViewParametersHolder
(JCRRepositoryData parentJCRData, String viewName, ViewParametersModel viewParametersModel) Get the service view parameters holdergetServiceViewParametersHolder
(ZoneItem zoneItem) Get service view parameters holder from the zone itemgetServiceViewParametersModel
(String skinId, String serviceId, String viewName) Get the service view parameters modelgetServiceViewParametersModel
(ZoneItem zoneItem) Get the service view parameters modelgetServiceViewParametersModels
(String skinId, String serviceId) Get all view parameters model for one service<T> T
getTemplateParameterValue
(Page page, String parameterPath) Get the template parameter valuegetTemplateViewParameterHolderWithInheritance
(Page page, String parameterPath) Get the parameter holder with the effective parameter path for a view parameter of a template, taking into account the inheritance.getTemplateViewParameterHolderWithInheritance
(Page page, ModelItem modelItem) Get the parameter holder with the effective parameter path for a view parameter of a template, taking into account the inheritance.getTemplateViewParametersModel
(String skinId, String templateId) Get the template view parameters modelgetTemplateViewParametersModel
(SkinTemplate skinTemplate) Get the template view parameters model<T> T
getZoneItemParameterValue
(ZoneItem zoneItem, String parameterPath) Get the zone item parameter valuegetZoneItemViewParametersModel
(String skinId, String templateId, String zoneName) Get the zone item view parameters modelgetZoneItemViewParametersModel
(ZoneItem zoneItem) Get the zone item view parameters model<T> T
getZoneParameterValue
(Page page, Zone zone, String parameterPath) Get the zone parameter valuegetZoneViewParameterHolderWithInheritance
(Page page, Zone zone, String parameterPath) Get the parameter holder with the effective parameter path for a view parameter of a zone, taking into account the inheritance.getZoneViewParameterHolderWithInheritance
(Page page, Zone zone, ModelItem modelItem) Get the parameter holder with the effective parameter path for a view parameter of a zone, taking into account the inheritance.getZoneViewParametersModel
(String skinId, String templateId, String zoneId) Get the zone view parameters modelgetZoneViewParametersModel
(SkinTemplateZone skinTemplateZone) Get the zone view parameters modelincludeModelItems
(Collection<? extends ModelItem> modelItems, String prefix, ViewItemContainer viewItemContainer) Add model items to the view item container and add prefix to items nameincludeModelItems
(Collection<? extends ModelItem> modelItems, String prefix, ViewItemContainer viewItemContainer, Optional<Integer> index) Add model items to the view item container and add prefix to items namenormalizeViewName
(String viewName) Normalize the view name (for service view value with /)void
service
(ServiceManager manager) void
setDisableConditions
(String elementName, String conditionValue, Collection<? extends ModelItem> modelItems) Set the a disable condition to all model items.Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role -
TEMPLATE_INHERIT_MODEL_ITEM_NAME
The name of the model item to disable inheritance for template This model item is created from scratch, the name doesn't matter- See Also:
-
ZONE_INHERIT_MODEL_ITEM_NAME
The name of the model item to disable inheritance for zone This model item is created from scratch, the name doesn't matter- See Also:
-
CONTENT_VIEW_MODEL_ITEM_NAME
The name of the model item containing the content view parameters This model item is created from scratch, the name doesn't matter- See Also:
-
SERVICE_VIEW_DEFAULT_MODEL_ITEM_NAME
The name of default attribute in the service parameters to set the service view Warning : it's a convention to call this parameter 'xslt', but a service can't have several view xsl with different names- See Also:
-
VIEW_PARAMETERS_TEMPLATE_CONF_NAME
The name of the tag containing the template view parameters- See Also:
-
VIEW_PARAMETERS_ZONE_CONF_NAME
The name of the tag containing the zone view parameters- See Also:
-
VIEW_PARAMETERS_ZONE_ITEM_PARENT_CONF_NAME
The name of the parent tag containing the zone item view parameters- See Also:
-
VIEW_PARAMETERS_ZONE_ITEM_CONF_NAME
The name of the tag containing the zone item view parameters- See Also:
-
VIEW_PARAMETERS_SERVICE_CONF_NAME
The name of the tag containing the service view parameters- See Also:
-
VIEW_PARAMETERS_CONTENT_CONF_NAME
The name of the tag containing the content view parameters- See Also:
-
VIEW_PARAMETERS_COMPOSITE_NAME
The composite name for view parameters- See Also:
-
CONTENT_VIEW_PARAMETERS_COMPOSITE_NAME
The composite name for content view parameters- See Also:
-
SERVICE_VIEW_PARAMETERS_COMPOSITE_NAME
The composite name for service view parameters- See Also:
-
VIEW_PARAMETERS_NODETYPE
The node type for view parameters- See Also:
-
_resolver
The Ametys object resolver -
_skinsManager
The skins manager -
_serviceViewParametersManager
The service view parameters manager -
_contentViewParametersManager
The content view parameters manager -
_globalViewParametersManager
The global view parameters manager -
_contentTypesHelper
The content types helper -
_contentTypeEP
The content type extension point -
_viewParametersTypeEP
The view parameters type extension point -
_serviceEP
The service extension point
-
-
Constructor Details
-
ViewParametersManager
public ViewParametersManager()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getParametersHolder
public ModifiableModelAwareDataHolder getParametersHolder(JCRRepositoryData parentJCRData, ViewParametersModel viewParametersModel) Get the view parameters holder- Parameters:
parentJCRData
- the parent JCR dataviewParametersModel
- the view parameters model- Returns:
- the view parameters holder
-
getContentViewParametersHolder
public ModifiableModelAwareDataHolder getContentViewParametersHolder(JCRRepositoryData parentJCRData, String viewName, ViewParametersModel viewParametersModel) Get the content view parameters holder- Parameters:
parentJCRData
- the parent JCR dataviewName
- the view nameviewParametersModel
- the view parameters model- Returns:
- the view parameters holder
-
getServiceViewParametersHolder
public ModifiableModelAwareDataHolder getServiceViewParametersHolder(JCRRepositoryData parentJCRData, String viewName, ViewParametersModel viewParametersModel) Get the service view parameters holder- Parameters:
parentJCRData
- the parent JCR dataviewName
- the view nameviewParametersModel
- the view parameters model- Returns:
- the view parameters holder
-
getTemplateViewParametersModel
public Optional<ViewParametersModel> getTemplateViewParametersModel(String skinId, String templateId) Get the template view parameters model- Parameters:
skinId
- the skin idtemplateId
- the template id- Returns:
- the view parameters
-
getTemplateViewParametersModel
Get the template view parameters model- Parameters:
skinTemplate
- the skin template- Returns:
- the view parameters
-
getZoneViewParametersModel
public Optional<ViewParametersModel> getZoneViewParametersModel(String skinId, String templateId, String zoneId) Get the zone view parameters model- Parameters:
skinId
- the skin idtemplateId
- the template idzoneId
- the zone id- Returns:
- the view parameters
-
getZoneViewParametersModel
Get the zone view parameters model- Parameters:
skinTemplateZone
- the skin template zone- Returns:
- the view parameters
-
getZoneItemViewParametersModel
Get the zone item view parameters model- Parameters:
zoneItem
- the zone item- Returns:
- the view parameters
-
getZoneItemViewParametersModel
public Optional<ViewParametersModel> getZoneItemViewParametersModel(String skinId, String templateId, String zoneName) Get the zone item view parameters model- Parameters:
skinId
- the skin idtemplateId
- the template idzoneName
- the zone name- Returns:
- the view parameters
-
getContentViewParametersModel
Get the content view parameters model- Parameters:
zoneItem
- the zone item- Returns:
- the view parameters
-
getContentViewParametersModel
public Optional<ViewParametersModel> getContentViewParametersModel(String skinId, Content content, String viewName) Get the content view parameters model- Parameters:
skinId
- the skin idcontent
- the contentviewName
- the view name- Returns:
- the view parameters
-
getContentViewParametersModels
public Map<String,ViewParametersModel> getContentViewParametersModels(String skinId, Content content) Get all view parameters model for one content- Parameters:
skinId
- the skin idcontent
- the content- Returns:
- the map of view parameters model (with the view name)
-
getContentViewEnumerator
Get a static enumerator with all content view- Parameters:
content
- the content- Returns:
- the element definition of the enumerator
-
copyContentViewParameters
public void copyContentViewParameters(ModifiableZoneItem zoneItemSource, ModifiableZoneItem zoneItemDestination) Copy content view parameters of the source zone item to the destination zone item- Parameters:
zoneItemSource
- the source zone itemzoneItemDestination
- the destination zone item
-
getServiceViewParametersModel
Get the service view parameters model- Parameters:
zoneItem
- the zone item- Returns:
- the view parameters
-
getServiceViewParametersModel
public Optional<ViewParametersModel> getServiceViewParametersModel(String skinId, String serviceId, String viewName) Get the service view parameters model- Parameters:
skinId
- the skin idserviceId
- the service idviewName
- the view name- Returns:
- the view parameters
-
getServiceViewParametersModels
public Map<String,ViewParametersModel> getServiceViewParametersModels(String skinId, String serviceId) Get all view parameters model for one service- Parameters:
skinId
- the skin idserviceId
- the service id- Returns:
- the map of view parameters model (with the view name)
-
getServiceViewEnumerator
Get a service enumerator with all content view- Parameters:
serviceId
- the service id- Returns:
- the element definition of the enumerator
-
copyServiceViewParameters
public void copyServiceViewParameters(ModifiableZoneItem zoneItemSource, ModifiableZoneItem zoneItemDestination) Copy service view parameters of the source zone item to the destination zone item- Parameters:
zoneItemSource
- the source zone itemzoneItemDestination
- the destination zone item
-
normalizeViewName
Normalize the view name (for service view value with /)- Parameters:
viewName
- the view name- Returns:
- the normalized view name
-
includeModelItems
public List<ModelItem> includeModelItems(Collection<? extends ModelItem> modelItems, String prefix, ViewItemContainer viewItemContainer) Add model items to the view item container and add prefix to items name- Parameters:
modelItems
- the model itemsprefix
- the prefixviewItemContainer
- the view item container- Returns:
- the list of included model items
-
includeModelItems
public List<ModelItem> includeModelItems(Collection<? extends ModelItem> modelItems, String prefix, ViewItemContainer viewItemContainer, Optional<Integer> index) Add model items to the view item container and add prefix to items name- Parameters:
modelItems
- the model itemsprefix
- the prefixviewItemContainer
- the view item containerindex
- index at which the model items have to be included- Returns:
- the list of included model items
-
setDisableConditions
public void setDisableConditions(String elementName, String conditionValue, Collection<? extends ModelItem> modelItems) Set the a disable condition to all model items. These model items will show if the value of the element (elementName) equal the condition value (conditionValue)- Parameters:
elementName
- the element nameconditionValue
- the condition valuemodelItems
- the list of model items
-
getInheritCheckboxElement
Get a check box to override inherit parameters- Parameters:
model
- the model of the elementname
- the name of the check box- Returns:
- the element definition of the enumerator
-
addGlobalViewParameters
public Optional<ViewParametersModel> addGlobalViewParameters(String skinId, GlobalViewParametersManager.ViewParametersType type, Optional<ViewParametersModel> viewParameters) Get the global view parameters for the given type and add the view parameters to it- Parameters:
skinId
- the skin idtype
- the typeviewParameters
- the view parameters- Returns:
- the new view parameters (with global view parameters)
-
getTemplateViewParameterHolderWithInheritance
public Optional<ViewParametersManager.ViewParameterHolder> getTemplateViewParameterHolderWithInheritance(Page page, String parameterPath) Get the parameter holder with the effective parameter path for a view parameter of a template, taking into account the inheritance. The parameter path can be different in case of inheritance.- Parameters:
page
- the pageparameterPath
- the initial parameter path.- Returns:
- the
ViewParametersManager.ViewParameterHolder
for this page and parameter
-
getTemplateViewParameterHolderWithInheritance
public Optional<ViewParametersManager.ViewParameterHolder> getTemplateViewParameterHolderWithInheritance(Page page, ModelItem modelItem) Get the parameter holder with the effective parameter path for a view parameter of a template, taking into account the inheritance. The parameter path can be different in case of inheritance.- Parameters:
page
- the pagemodelItem
- the model item of parameter- Returns:
- the
ViewParametersManager.ViewParameterHolder
for this page and parameter
-
_getTemplateViewParameterHolderWithInheritance
protected Optional<ViewParametersManager.ViewParameterHolder> _getTemplateViewParameterHolderWithInheritance(Page page, ViewParameter viewParameter, String parameterPath) Get the parameter holder with the effective parameter path for a view parameter of a template, taking into account the inheritance. The parameter path can be different in case of inheritance.- Parameters:
page
- the pageviewParameter
- the view parameterparameterPath
- the parameter path.- Returns:
- the
ViewParametersManager.ViewParameterHolder
for this page and parameter
-
getZoneViewParameterHolderWithInheritance
public Optional<ViewParametersManager.ViewParameterHolder> getZoneViewParameterHolderWithInheritance(Page page, Zone zone, String parameterPath) Get the parameter holder with the effective parameter path for a view parameter of a zone, taking into account the inheritance. The parameter path can be different in case of inheritance.- Parameters:
page
- the pagezone
- the zoneparameterPath
- the initial parameter path.- Returns:
- the
ViewParametersManager.ViewParameterHolder
for this page, zone and parameter
-
getZoneViewParameterHolderWithInheritance
public Optional<ViewParametersManager.ViewParameterHolder> getZoneViewParameterHolderWithInheritance(Page page, Zone zone, ModelItem modelItem) Get the parameter holder with the effective parameter path for a view parameter of a zone, taking into account the inheritance. The parameter path can be different in case of inheritance.- Parameters:
page
- the pagezone
- the zonemodelItem
- the model item of the parameter- Returns:
- the
ViewParametersManager.ViewParameterHolder
for this page, zone and parameter
-
_getZoneViewParameterHolderWithInheritance
protected Optional<ViewParametersManager.ViewParameterHolder> _getZoneViewParameterHolderWithInheritance(Page page, Zone zone, ViewParameter viewParameter, String parameterPath) Get the parameter holder with the effective parameter path for a view parameter of a zone, taking into account the inheritance. The parameter path can be different in case of inheritance.- Parameters:
page
- the pagezone
- the zoneviewParameter
- the view parameterparameterPath
- the parameter path.- Returns:
- the
ViewParametersManager.ViewParameterHolder
for this page, zone and parameter
-
getContentViewParametersHolder
Get content view parameters holder from the zone item- Parameters:
zoneItem
- the zone item- Returns:
- the data holder
-
getServiceViewParametersHolder
Get service view parameters holder from the zone item- Parameters:
zoneItem
- the zone item- Returns:
- the data holder
-
getTemplateParameterValue
Get the template parameter value- Type Parameters:
T
- type of the value to retrieve- Parameters:
page
- the pageparameterPath
- the parameter path- Returns:
- the template parameter value. Can be null.
-
getZoneParameterValue
Get the zone parameter value- Type Parameters:
T
- type of the value to retrieve- Parameters:
page
- the pagezone
- the zoneparameterPath
- the parameter path- Returns:
- the zone parameter value. Can be null.
-
getZoneItemParameterValue
Get the zone item parameter value- Type Parameters:
T
- type of the value to retrieve- Parameters:
zoneItem
- the zone itemparameterPath
- the parameter path- Returns:
- the zone item parameter value. Can be null.
-
getContentParameterValue
Get the content parameter value- Type Parameters:
T
- type of the value to retrieve- Parameters:
zoneItem
- the zone itemviewName
- the content view nameparameterPath
- the parameter path- Returns:
- the content parameter value. Can be null.
-
getServiceParameterValue
Get the service parameter value- Type Parameters:
T
- type of the value to retrieve- Parameters:
zoneItem
- the zone itemviewName
- the service view nameparameterPath
- the parameter path- Returns:
- the service parameter value. Can be null.
-