Class AbstractJCRTagsDAO

All Implemented Interfaces:
Component, LogEnabled, Serviceable
Direct Known Subclasses:
CategoryJCRDAO, JCRTagsDAO, JCRThemesDAO, KeywordJCRDAO, ProjectJCRTagsDAO

public abstract class AbstractJCRTagsDAO extends AbstractLogEnabled implements Serviceable, Component
Component for operations on JCR tags
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • createTag

      public Map<String,Object> createTag(String parentId, String originalName, String title, String description, Map<String,Object> otherParameters, Map<String,Object> contextualParameters)
      Create a new tag from client-side. User rights are checked.
      Parameters:
      parentId - The id of parent tag
      originalName - The original name
      title - The tag's title
      description - The tag's description
      otherParameters - the other parameters
      contextualParameters - Contextual parameters transmitted by the environment.
      Returns:
      The result map
    • addTag

      public JCRTag addTag(String parentId, String originalName, String title, String description, Map<String,Object> otherParameters, Map<String,Object> contextualParameters) throws UnknownAmetysObjectException, javax.jcr.RepositoryException
      Create a new tag regardless of user rights.
      Parameters:
      parentId - The id of parent tag
      originalName - The original name
      title - The tag's title
      description - The tag's description
      otherParameters - the other parameters
      contextualParameters - Contextual parameters transmitted by the environment.
      Returns:
      The created JCR tag
      Throws:
      UnknownAmetysObjectException - if the parent does not exist
      javax.jcr.RepositoryException - if failed to create tag
    • deleteTag

      public Map<String,Object> deleteTag(String tagId, Map<String,Object> contextualParameters)
      Deletes a JCR tag
      Parameters:
      tagId - The tag's id
      contextualParameters - Contextual parameters transmitted by the environment.
      Returns:
      the result map
    • updateTag

      public Map<String,Object> updateTag(String tagId, String title, String description, Map<String,Object> otherParameters)
      Updates a JCR tag
      Parameters:
      tagId - The tag's id
      title - The tag's title
      description - The tag's description
      otherParameters - the other parameters
      Returns:
      The result map
    • moveTags

      public Map<String,Object> moveTags(String targetId, List<String> ids) throws ProcessingException
      Move a JCR tag
      Parameters:
      targetId - The tag where to move to
      ids - The ids of tag to move
      Returns:
      the result map
      Throws:
      ProcessingException - If an error occurred
    • getTagRootNode

      public Map<String,Object> getTagRootNode(String tagProviderId, Map<String,Object> contextualParameters) throws ProcessingException
      Get the root node for tags
      Parameters:
      tagProviderId - The tag provider id
      contextualParameters - Contextual parameters transmitted by the environment.
      Returns:
      The root node in key "id"
      Throws:
      ProcessingException - If an error occurred in the repository
    • getTag

      public Map<String,Object> getTag(String tagId)
      Find a JCR tag and return its data
      Parameters:
      tagId - The tag's id
      Returns:
      The result map
    • _getTagRootObject

      public abstract ModifiableTraversableAmetysObject _getTagRootObject(String tagProviderId, Map<String,Object> contextualParameters) throws javax.jcr.RepositoryException
      Get the tag root node object
      Parameters:
      tagProviderId - The tag provider id
      contextualParameters - Contextual parameters transmitted by the environment.
      Returns:
      The tag root node object
      Throws:
      javax.jcr.RepositoryException - If an error occurred in the repository
    • _checkUserRight

      protected abstract void _checkUserRight() throws IllegalStateException
      Check if the user right to access the feature
      Throws:
      IllegalStateException - if the user has no right
    • _getTagFromName

      protected abstract Tag _getTagFromName(String name, Map<String,Object> contextualParameters)
      Get the tag from the name
      Parameters:
      name - the name
      contextualParameters - the contextual parameters
      Returns:
      the tag
    • _getTagProviders

      protected abstract Set<TagProvider<? extends Tag>> _getTagProviders()
      Get all tag's providers
      Returns:
      the providers
    • _createJCRTag

      protected abstract JCRTag _createJCRTag(String parentId, String name, String title, String description, Map<String,Object> otherParameters, Map<String,Object> contextualParameters) throws javax.jcr.RepositoryException
      Create a JCR tag under his parent
      Parameters:
      parentId - the parent id
      name - the name
      title - the title
      description - the description
      otherParameters - the other parameters
      contextualParameters - Contextual parameters transmitted by the environment.
      Returns:
      the created JCR tag
      Throws:
      javax.jcr.RepositoryException - if an error occurred
    • _updateJCRTag

      protected abstract JCRTag _updateJCRTag(String tagId, String title, String description, Map<String,Object> otherParameters) throws UnknownAmetysObjectException
      Update a JCR tag
      Parameters:
      tagId - the tag id to update
      title - the title
      description - the description
      otherParameters - the other parameters
      Returns:
      return the updated JCR tag
      Throws:
      UnknownAmetysObjectException - if an error occurred
    • _findUniqueName

      protected String _findUniqueName(String originalName, Map<String,Object> contextualParameters)
      Find a unique name for the tag
      Parameters:
      originalName - The requested name
      contextualParameters - Contextual parameters transmitted by the environment.
      Returns:
      A unique name
    • _hasTag

      protected boolean _hasTag(Set<TagProvider<? extends Tag>> providers, String name, Map<String,Object> contextualParameters)
      Determines if a tag with given name already exists
      Parameters:
      providers - The tag providers
      name - The name of the tag
      contextualParameters - Contextual parameters transmitted by the environment.
      Returns:
      true if the tag exists