Class WikiItemService
java.lang.Object
fr.paris.lutece.plugins.wiki.service.WikiItemService
-
Method Summary
Modifier and TypeMethodDescriptionstatic AbstractWikiItemcreate(AbstractWikiItem item, fr.paris.lutece.portal.service.security.LuteceUser user, Locale locale) Creates a new wiki itemstatic voiddelete(int itemId) Deletes a wiki item by its identifier.static List<AbstractWikiItem>Gets the ancestors of an item, from the root to its direct parent, with their current revision.static AbstractWikiItemfindByCode(String strCode) Finds a wiki item by its codestatic AbstractWikiItemfindById(int itemId) Finds a wiki item by its identifierstatic List<AbstractWikiItem>getItemsByParent(int parentId) Gets all items by parent identifierstatic List<AbstractWikiItem>getItemsByType(WikiItemType type) Gets all items by typestatic List<AbstractWikiItem>getItemsByTypes(Set<WikiItemType> types) Gets all items by multiple typesstatic List<AbstractWikiItem>getPublishedItemsByParent(int parentId) Gets all published items by parent identifierstatic List<AbstractWikiItem>Gets all published items by typestatic voidmove(AbstractWikiItem item, int newParentId, Locale locale) Moves an item to a new parentstatic voidupdate(AbstractWikiItem item, Locale locale) Updates a wiki item
-
Method Details
-
findById
Finds a wiki item by its identifier- Parameters:
itemId- the item identifier- Returns:
- the wiki item or null if not found
-
findByCode
Finds a wiki item by its code- Parameters:
strCode- the item code- Returns:
- the wiki item or null if not found
-
findAncestors
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
Gets all items by type- Parameters:
type- the wiki item type- Returns:
- the list of wiki items
-
getItemsByTypes
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
Gets all published items by type- Parameters:
type- the wiki item type- Returns:
- the list of published wiki items
-
getItemsByParent
Gets all items by parent identifier- Parameters:
parentId- the parent identifier- Returns:
- the list of wiki items
-
getPublishedItemsByParent
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 createuser- 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
Updates a wiki item- Parameters:
item- the wiki item to updatelocale- 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 movenewParentId- the new parent idlocale- the locale for error messages- Throws:
WikiValidationException- if validation fails
-