Class ContentMetadataExtracter

All Implemented Interfaces:
ActionExecuter, LoggingAwareExecuter, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware

public class ContentMetadataExtracter extends ActionExecuterAbstractBase
Extract metadata from any added content.

Currently, the default overwrite policy for each extracter is used. (TODO: Add overwrite policy as a parameter.)

Author:
Jesper Steen Møller
See Also:
  • Field Details

    • EXECUTOR_NAME

      public static final String EXECUTOR_NAME
      See Also:
    • DEFAULT_STRING_TAGGING_SEPARATORS

      public static final List<String> DEFAULT_STRING_TAGGING_SEPARATORS
    • stringTaggingSeparators

      protected List<String> stringTaggingSeparators
  • Constructor Details

    • ContentMetadataExtracter

      public ContentMetadataExtracter()
  • Method Details

    • setNodeService

      public void setNodeService(NodeService nodeService)
      Parameters:
      nodeService - the node service
    • setContentService

      public void setContentService(ContentService contentService)
      Parameters:
      contentService - The contentService to set.
    • setDictionaryService

      public void setDictionaryService(DictionaryService dictService)
      Description copied from class: ActionExecuterAbstractBase
      Set the dictionary service
      Overrides:
      setDictionaryService in class ActionExecuterAbstractBase
      Parameters:
      dictService - The DictionaryService to set.
    • setTaggingService

      public void setTaggingService(TaggingService taggingService)
      Parameters:
      taggingService - The TaggingService to set.
    • setMetadataExtracterRegistry

      public void setMetadataExtracterRegistry(MetadataExtracterRegistry metadataExtracterRegistry)
      Parameters:
      metadataExtracterRegistry - The metadataExtracterRegistry to set.
    • setCarryAspectProperties

      public void setCarryAspectProperties(boolean carryAspectProperties)
      Whether or not aspect-related properties must be carried to the new version of the node
      Parameters:
      carryAspectProperties - true (default) to carry all aspect-linked properties forward. false will clean the aspect of any unextracted values.
    • setEnableStringTagging

      public void setEnableStringTagging(boolean enableStringTagging)
      Whether or not to enable mapping of simple strings to cm:taggable tags
      Parameters:
      enableStringTagging - true find or create tags for each string mapped to cm:taggable. false (default) ignore mapping strings to tags.
    • setStringTaggingSeparators

      public void setStringTaggingSeparators(List<String> stringTaggingSeparators)
      List of string separators - note: all will be applied to a given string
      Parameters:
      stringTaggingSeparators -
    • addTags

      protected void addTags(NodeRef actionedUponNodeRef, PropertyDefinition propertyDef, Serializable rawValue)
      Iterates the values of the taggable property which the metadata extractor should have already attempted to convert values to NodeRefs.

      If conversion by the metadata extracter failed due to a MalformedNodeRefException the taggable property should still contain raw string values.

      Mixing of NodeRefs and string values is permitted so each raw value is checked for a valid NodeRef representation and if so, converts to a NodeRef, if not, adds as a tag via the TaggingService.

      Parameters:
      actionedUponNodeRef - The NodeRef being actioned upon
      propertyDef - the PropertyDefinition of the taggable property
      rawValue - the raw value from the metadata extracter
    • splitTag

      protected List<String> splitTag(String str)
    • isExecuteAsynchronously

      public boolean isExecuteAsynchronously(NodeRef actionedUponNodeRef)
      Used by the action service to work out if it should override the executeAsychronously value when it is know the extract will take place asynchronously anyway. Results in the action being processed post commit, which allows it to see node changes.
      Parameters:
      actionedUponNodeRef - the node to be processed.
      Returns:
      true if the AsynchronousExtractor will be used. false otherwise.
    • executeImpl

      public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef)
      Description copied from class: ActionExecuterAbstractBase
      Execute the action implementation
      Specified by:
      executeImpl in class ActionExecuterAbstractBase
      Parameters:
      ruleAction - the action
      actionedUponNodeRef - the actioned upon node
      See Also:
    • addExtractedMetadataToNode

      public static void addExtractedMetadataToNode(NodeRef actionedUponNodeRef, Map<QName,Serializable> nodeProperties, Map<QName,Serializable> modifiedProperties, NodeService nodeService, DictionaryService dictionaryService, TaggingService taggingService, boolean enableStringTagging, boolean carryAspectProperties, List<String> stringTaggingSeparators)
    • addParameterDefinitions

      protected void addParameterDefinitions(List<ParameterDefinition> arg0)
      Description copied from class: ParameterizedItemAbstractBase
      Adds the parameter definitions to the list
      Specified by:
      addParameterDefinitions in class ParameterizedItemAbstractBase
      Parameters:
      arg0 - the parameter definitions list