Class WikiItemHome

java.lang.Object
fr.paris.lutece.plugins.wiki.business.item.WikiItemHome

public class WikiItemHome extends Object
  • Method Details

    • create

      public static AbstractWikiItem create(AbstractWikiItem wikiItem)
      Create a new wiki item
      Parameters:
      wikiItem - the wiki item to create
      Returns:
      the created wiki item
    • update

      public static AbstractWikiItem update(AbstractWikiItem wikiItem)
      Update an existing wiki item
      Parameters:
      wikiItem - the wiki item to update
      Returns:
      the updated wiki item
    • remove

      public static List<AbstractWikiItem> remove(int nKey)
      Remove a wiki item by its key. The database cascade removes its descendants along with it, so their caches are invalidated too and they are returned to the caller.
      Parameters:
      nKey - the wiki item key
      Returns:
      every item actually removed, the item itself first, empty when it did not exist
    • findByPrimaryKey

      public static Optional<AbstractWikiItem> findByPrimaryKey(int nKey)
      Find a wiki item by its primary key
      Parameters:
      nKey - the wiki item key
      Returns:
      an Optional containing the wiki item if found, empty otherwise
    • getWikiItemsByType

      public static List<AbstractWikiItem> getWikiItemsByType(WikiItemType type)
      Get all wiki items by type
      Parameters:
      type - the wiki item type
      Returns:
      the list of wiki items matching the type
    • getWikiItemsByParent

      public static List<AbstractWikiItem> getWikiItemsByParent(int nIdParent)
      Get all wiki items by parent id
      Parameters:
      nIdParent - the parent id
      Returns:
      the list of wiki items having the specified parent
    • getWikiItemsByParentAndType

      public static List<AbstractWikiItem> getWikiItemsByParentAndType(int nIdParent, WikiItemType type)
      Get all wiki items by parent id and type
      Parameters:
      nIdParent - the parent id
      type - the wiki item type
      Returns:
      the list of wiki items matching the parent and type
    • findByCode

      public static Optional<AbstractWikiItem> findByCode(String strCode)
      Find a wiki item by its code
      Parameters:
      strCode - the wiki item code
      Returns:
      an Optional containing the wiki item if found, empty otherwise
    • findByIds

      public static List<AbstractWikiItem> findByIds(List<Integer> listIds)
      Bulk-loads wiki items matching the provided primary keys, in a single query.
      Parameters:
      listIds - the wiki item ids
      Returns:
      the matching items (caches each result by id)
    • getDescendants

      public static List<AbstractWikiItem> getDescendants(int nRootId)
      Loads all descendants of the given root item using breadth-first bulk queries. Returns a flat list of all descendants (excluding the root itself).
      Parameters:
      nRootId - the root item id
      Returns:
      the flat list of all descendants
    • getDescendantsByParent

      public static Map<Integer,List<AbstractWikiItem>> getDescendantsByParent(int nRootId)
      Loads all descendants of the given root item and returns them grouped by parent id.
      Parameters:
      nRootId - the root item id
      Returns:
      a map of parent id to list of children