Class WikiItemService

java.lang.Object
fr.paris.lutece.plugins.wiki.service.WikiItemService

public final class WikiItemService extends Object
  • Method Details

    • findById

      public static AbstractWikiItem findById(int itemId)
      Finds a wiki item by its identifier
      Parameters:
      itemId - the item identifier
      Returns:
      the wiki item or null if not found
    • findByCode

      public static AbstractWikiItem findByCode(String strCode)
      Finds a wiki item by its code
      Parameters:
      strCode - the item code
      Returns:
      the wiki item or null if not found
    • findAncestors

      public static List<AbstractWikiItem> findAncestors(AbstractWikiItem item)
      Gets the ancestors of an item, from the root to its direct parent, with their current revision.
      Parameters:
      item - the wiki item
      Returns:
      the ancestors, empty for a root item
    • getItemsByType

      public static List<AbstractWikiItem> getItemsByType(WikiItemType type)
      Gets all items by type
      Parameters:
      type - the wiki item type
      Returns:
      the list of wiki items
    • getItemsByTypes

      public static List<AbstractWikiItem> getItemsByTypes(Set<WikiItemType> types)
      Gets all items by multiple types
      Parameters:
      types - the set of wiki item types
      Returns:
      the list of wiki items matching any of the types
    • getPublishedItemsByType

      public static List<AbstractWikiItem> getPublishedItemsByType(WikiItemType type)
      Gets all published items by type
      Parameters:
      type - the wiki item type
      Returns:
      the list of published wiki items
    • getItemsByParent

      public static List<AbstractWikiItem> getItemsByParent(int parentId)
      Gets all items by parent identifier
      Parameters:
      parentId - the parent identifier
      Returns:
      the list of wiki items
    • getPublishedItemsByParent

      public static List<AbstractWikiItem> getPublishedItemsByParent(int parentId)
      Gets all published items by parent identifier
      Parameters:
      parentId - the parent identifier
      Returns:
      the list of published wiki items
    • create

      public static AbstractWikiItem create(AbstractWikiItem item, fr.paris.lutece.portal.service.security.LuteceUser user, Locale locale) throws WikiValidationException
      Creates a new wiki item
      Parameters:
      item - the wiki item to create
      user - the user creating the item (for private role handling)
      locale - the locale for error messages
      Returns:
      the created wiki item
      Throws:
      WikiValidationException - if validation fails
    • update

      public static void update(AbstractWikiItem item, Locale locale) throws WikiValidationException
      Updates a wiki item
      Parameters:
      item - the wiki item to update
      locale - the locale for error messages
      Throws:
      WikiValidationException - if validation fails
    • delete

      public static void delete(int itemId)
      Deletes a wiki item by its identifier. The database cascade removes its descendants along with it, so one deletion event is fired per removed item, letting every listener drop the whole subtree from its index.
      Parameters:
      itemId - the item identifier
    • move

      public static void move(AbstractWikiItem item, int newParentId, Locale locale) throws WikiValidationException
      Moves an item to a new parent
      Parameters:
      item - the item to move
      newParentId - the new parent id
      locale - the locale for error messages
      Throws:
      WikiValidationException - if validation fails