Class GetCommonAttributesAction

    • Method Detail

      • 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 types
        viewName - The view name to list model items
        acceptedTypes - 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 well
        withFullLabel - true to use the full label of the model items, false otherwise
        hasResources - 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 definition
        acceptedTypes - 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 well
        includeSubRepeaters - true to include the children of repeaters as well
        Returns:
        true if the model item passes the conditions
      • _passesAcceptedTypesCondition

        protected boolean _passesAcceptedTypesCondition​(List<String> acceptedTypes,
                                                        ModelItem modelItem)
        Checks if the model item passes conditions from accepted types
        Parameters:
        acceptedTypes - the accepted types
        modelItem - the model item to check
        Returns:
        true if the model item passes conditions
      • _getAcceptedTypesWithProperties

        protected Map<String,​List<String>> _getAcceptedTypesWithProperties​(List<String> acceptedTypes)
        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

        protected boolean _isInARepeater​(ModelItem modelItem)
        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

        protected Map<String,​ObjectgetModelItemInfo​(ModelItem modelItem,
                                                            boolean withFullLabel)
        Get the model item's information
        Parameters:
        modelItem - the model item
        withFullLabel - true to use the full label of the model item, false otherwise
        Returns:
        Model item's information as a map of properties
      • getModelItemFullLabel

        protected String getModelItemFullLabel​(ModelItem modelItem)
        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' properties
        withLastModified - true to add the last modification date to the model item's info
        withLastValidation - true to add the last validation date to the model item's info
        withCreationDate - true to add the creation date to the model item's info
        hasResources - 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

        protected Set<StringgetContentTypes​(Request request,
                                              boolean withResources)
        Get the content types id to search for
        Parameters:
        request - the request
        withResources - is there at least one resource ?
        Returns:
        the content types
      • getAllAvailablesContentTypes

        protected Set<StringgetAllAvailablesContentTypes​(Request request,
                                                           boolean publicOnly,
                                                           boolean withResources)
        Get all the available content types
        Parameters:
        request - the request
        publicOnly - Only the non private content types will be returned
        withResources - True to add the resources to the list (which is not a content type)
        Returns:
        all the available content types