Package org.ametys.cms.contenttype
Class GetCommonAttributesAction
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.ServiceableAction
org.ametys.cms.contenttype.GetCommonAttributesAction
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
,Action
- Direct Known Subclasses:
GetCommonAttributesAction
Get the common attributes between given content types and/or among given contents
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
Allow enumerated attributesprotected static final String
Allow not enumerated attributesprotected static final String[]
Not sortable attribute typesprotected ContentTypeExtensionPoint
The content type EPprotected ContentTypesHelper
The content types Helperprotected I18nUtils
I18n utilsFields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_getAcceptedTypesWithProperties
(List<String> acceptedTypes) Get the map of accepted types with its propertiesprotected boolean
_isInARepeater
(ModelItem modelItem) Checks if the given model item has a parent that is a repeaterprotected boolean
_modelItemPassesConditions
(ModelItem modelItem, List<String> acceptedTypes, boolean onlySortable, boolean includeCompositeAndRepeaters, boolean includeSubRepeaters) Indicates if the attribute should be retrieved or filtered out given the optionsprotected boolean
_passesAcceptedTypesCondition
(List<String> acceptedTypes, ModelItem modelItem) Checks if the model item passes conditions from accepted typesact
(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) getAllAvailablesContentTypes
(Request request, boolean publicOnly, boolean withResources) Get all the available content typesgetCommonModelItemsInfo
(Collection<String> contentTypeIds, String viewName, List<String> acceptedTypes, boolean onlySortable, boolean includeCompositesAndRepeaters, boolean withFullLabel, boolean hasResources, boolean includeSubRepeaters) Retrieve model items information for a list of content typesgetContentTypes
(Request request, boolean withResources) Get the content types id to search forprotected String
getModelItemFullLabel
(ModelItem modelItem) Get the user friendly full label for the given model itemgetModelItemInfo
(ModelItem modelItem, boolean withFullLabel) Get the model item's informationprotected void
handleSpecificInfo
(List<Map<String, Object>> commonModelItemsInfo, boolean withLastModified, boolean withLastValidation, boolean withCreationDate, boolean hasResources, boolean withFullLabel) Handle specific information, such as adding system properties into the model listvoid
service
(ServiceManager smanager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
__NOT_SORTABLE_TYPE_IDS
Not sortable attribute types -
__ALLOW_ENUMERATED
Allow enumerated attributes- See Also:
-
__ALLOW_NOT_ENUMERATED
Allow not enumerated attributes- See Also:
-
_contentTypeExtensionPoint
The content type EP -
_contentTypesHelper
The content types Helper -
_i18nUtils
I18n utils
-
-
Constructor Details
-
GetCommonAttributesAction
public GetCommonAttributesAction()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableAction
- Throws:
ServiceException
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception - Throws:
Exception
-
getCommonModelItemsInfo
protected List<Map<String,Object>> getCommonModelItemsInfo(Collection<String> contentTypeIds, String viewName, List<String> acceptedTypes, boolean onlySortable, boolean includeCompositesAndRepeaters, boolean withFullLabel, boolean hasResources, boolean includeSubRepeaters) Retrieve model items information for a list of content types- Parameters:
contentTypeIds
- the identifiers of the content typesviewName
- The view name to list model itemsacceptedTypes
- The types to accept. All types accepted if null or empty.onlySortable
- true to only accept sortable model items.includeCompositesAndRepeaters
- true to include the composites and repeaters as wellwithFullLabel
- true to use the full label of the model items, false otherwisehasResources
- true if there is at least one content type that is a resource, false otherwise.includeSubRepeaters
- true to include the children of repeaters as well- Returns:
- The list of common model items properties (each set of properties is a map representing the model item)
-
_modelItemPassesConditions
protected boolean _modelItemPassesConditions(ModelItem modelItem, List<String> acceptedTypes, boolean onlySortable, boolean includeCompositeAndRepeaters, boolean includeSubRepeaters) Indicates if the attribute should be retrieved or filtered out given the options- Parameters:
modelItem
- the attribute definitionacceptedTypes
- The types to accept. All types accepted if null or empty.onlySortable
- true to only accept sortable attributes.includeCompositeAndRepeaters
- true to include the composites and repeaters as wellincludeSubRepeaters
- true to include the children of repeaters as well- Returns:
- true if the model item passes the conditions
-
_passesAcceptedTypesCondition
Checks if the model item passes conditions from accepted types- Parameters:
acceptedTypes
- the accepted typesmodelItem
- the model item to check- Returns:
- true if the model item passes conditions
-
_getAcceptedTypesWithProperties
Get the map of accepted types with its properties- Parameters:
acceptedTypes
- the accepted types configuration- Returns:
- the map of accepted type with its properties
-
_isInARepeater
Checks if the given model item has a parent that is a repeater- Parameters:
modelItem
- the model item to check- Returns:
true
if the given model item has a parent that is a repeater,false
otherwise
-
getModelItemInfo
Get the model item's information- Parameters:
modelItem
- the model itemwithFullLabel
- true to use the full label of the model item, false otherwise- Returns:
- Model item's information as a map of properties
-
getModelItemFullLabel
Get the user friendly full label for the given model item- Parameters:
modelItem
- the model items- Returns:
- The full label of the model item
-
handleSpecificInfo
protected void handleSpecificInfo(List<Map<String, Object>> commonModelItemsInfo, boolean withLastModified, boolean withLastValidation, boolean withCreationDate, boolean hasResources, boolean withFullLabel) Handle specific information, such as adding system properties into the model list- Parameters:
commonModelItemsInfo
- the mapping of model items' propertieswithLastModified
- true to add the last modification date to the model item's infowithLastValidation
- true to add the last validation date to the model item's infowithCreationDate
- true to add the creation date to the model item's infohasResources
- true if there is at least one content type that is a resource, false otherwise.withFullLabel
- true to use the full label of the model items, false otherwise
-
getContentTypes
Get the content types id to search for- Parameters:
request
- the requestwithResources
- is there at least one resource ?- Returns:
- the content types
-
getAllAvailablesContentTypes
protected Set<String> getAllAvailablesContentTypes(Request request, boolean publicOnly, boolean withResources) Get all the available content types- Parameters:
request
- the requestpublicOnly
- Only the non private content types will be returnedwithResources
- True to add the resources to the list (which is not a content type)- Returns:
- all the available content types
-