Class SetContentAttributeClientSideElement

All Implemented Interfaces:
ClientSideElement, ClientSideRelation, LogEnabled, PluginAware, Component, Configurable, Serviceable
Direct Known Subclasses:
SetContentAttributeClientSideElement, SetParentContentClientSideElement

Set the attribute of type 'content' of a content, with another content
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Overrides:
      service in class StaticFileImportsClientSideElement
      Throws:
      ServiceException
    • getCompatibleAttributes

      public List<Map<String,Object>> getCompatibleAttributes(List<String> contentIdsToReference, List<String> contentIdsToEdit)
      Find an attribute of type content in definition of 'contentIdsToReference' and set the attribute of contents 'contentIdsToEdit' with value 'contentIdsToReference'
      Parameters:
      contentIdsToReference - The list of content identifiers that will be added as values in the content field
      contentIdsToEdit - The list of content identifiers to edit and that will have an attribute of type content modified
      Returns:
      the list of all compatible attribute definitions
    • _convert

      protected List<Map<String,Object>> _convert(Set<ModelItem> attributeDefinitions)
      Convert attribute definitions to JSON object
      Parameters:
      attributeDefinitions - The attribute definitions
      Returns:
      the JSON object
    • _convert

      protected Map<String,Object> _convert(ModelItem attributeDefinition)
      Convert an attribute definition to JSON
      Parameters:
      attributeDefinition - the attribute definition
      Returns:
      the JSON object
    • _findCompatibleAttributes

      protected Set<ModelItem> _findCompatibleAttributes(List<? extends Content> contentsToReference, List<? extends Content> contentsToEdit)
      Find the list of compatible attribute definitions
      Parameters:
      contentsToReference - the contents to reference
      contentsToEdit - the contents to edit
      Returns:
      the list of compatible attribute definitions
    • setContentAttribute

      public Map<String,Object> setContentAttribute(List<String> contentIdsToReference, Map<String,Integer> contentIdsToEdit, List<Map<String,String>> contentsToEditToRemove, String attributePath, List<String> workflowActionIds)
      Set the attribute at path 'attributePath' of contents 'contentIdsToEdit' with value 'contentIdsToReference'
      Parameters:
      contentIdsToReference - The list of content identifiers that will be added as values in the content field
      contentIdsToEdit - The map {key: content identifiers to edit and that will have an attribute of type content modified; value: the new position if attribute is multiple and it is a reorder of values. May be null or equals to -1 if it is not a reorder}
      contentsToEditToRemove - The list of content to edit to remove currently referenced content. Keys are "contentId" and "valueToRemove"
      attributePath - The attribute path selected to do modification in the contents to edit
      workflowActionIds - The identifiers of workflow actions to use to edit the attribute. Actions will be tested in this order and first available action will be used
      Returns:
      A map with key success: true or false. if false, it can be due to errors (list of error messages)
    • setContentAttribute

      public Map<String,Object> setContentAttribute(List<String> contentIdsToReference, Map<String,Integer> contentIdsToEdit, List<Map<String,String>> contentsToEditToRemove, String attributePath, List<String> workflowActionIds, Map<String,Object> additionalParams)
      Set the attribute at path 'attributePath' of contents 'contentIdsToEdit' with value 'contentIdsToReference'
      Parameters:
      contentIdsToReference - The list of content identifiers that will be added as values in the content field
      contentIdsToEdit - The map {key: content identifiers to edit and that will have an attribute of type content modified; value: the new position if attribute is multiple and it is a reorder of values. May be null or equals to -1 if it is not a reorder}
      contentsToEditToRemove - The list of content to edit to remove currently referenced content. Keys are "contentId" and "valueToRemove"
      attributePath - The attribute path selected to do modification in the contents to edit
      workflowActionIds - The identifiers of workflow actions to use to edit the attribute. Actions will be tested in this order and first available action will be used
      additionalParams - the map of additional parameters
      Returns:
      A map with key success: true or false. if false, it can be due to errors (list of error messages)
    • _filterContentsToEdit

      protected Map<WorkflowAwareContent,Integer> _filterContentsToEdit(Map<WorkflowAwareContent,Integer> contentsToEdit, List<String> contentIdsToReference, List<I18nizableText> errorMessages, List<String> errorIds, Map<String,Object> additionalParams)
      Filter the list of contents to edit
      Parameters:
      contentsToEdit - the map of contents to edit
      contentIdsToReference - The list of content ids that will be added as values in the content field
      errorMessages - the error messages
      errorIds - the error content ids
      additionalParams - the map of additional parameters
      Returns:
      the list of filtered contents
    • _setContentAttribute

      protected void _setContentAttribute(List<String> contentIdsToReference, Map<WorkflowAwareContent,Integer> contentsToEdit, ContentType contentType, String attributePath, List<String> workflowActionIds, List<I18nizableText> errorMessages, List<String> errorIds, Map<String,Object> additionalParams)
      Set the attribute at path 'attributePath' of contents 'contentsToEdit' with value 'contentIdsToReference'
      Parameters:
      contentIdsToReference - The list of content identifiers that will be added as values in the content field
      contentsToEdit - The map {key: contents to edit and that will have an attribute of type content modified; value: the new position if attribute is multiple and it is a reorder of values. May be null or equals to -1 if it is not a reorder}
      contentType - The content type
      attributePath - The attribute path selected to do modification in the contents to edit
      workflowActionIds - The identifiers of workflow actions to use to edit the attribute. Actions will be tested in this order and first available action will be used
      errorMessages - The list that will be felt with error messages of content that had an issue during the operation
      errorIds - The list that will be felt with ids of content that had an issue during the operation
      additionalParams - the map of additional parameters
    • _resolve

      protected List<? extends Content> _resolve(List<String> contentIds)
      Resolve content by their identifiers
      Parameters:
      contentIds - The id of contents to resolve
      Returns:
      the contents
    • _resolve

      protected Map<? extends Content,Integer> _resolve(Map<String,Integer> contentIds)
      Resolve content by their identifiers
      Parameters:
      contentIds - The id of contents to resolve
      Returns:
      the contents