Package io.goobi.viewer.managedbeans
Class BookmarkBean
java.lang.Object
io.goobi.viewer.managedbeans.BookmarkBean
- All Implemented Interfaces:
Serializable
JSF backing bean for bookmark list management, handling user bookmarks and public sharing.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidResets the current bookmark list and returns to the overview of own bookmark lists.intcountSessionBookmarkListItems.createNewBookmarkListAction.Deletes currentBookmarkList.voiddeleteCurrentItemAction(Bookmark bookmark) Removes the currently selected Bookmark from the currently selected BookmarkList.editBookmarkListAction(BookmarkList bookmarkList) editBookmarkListAction.Returns a list of all existing bookmark lists owned by current user.getBookmarkListsForUser(User user) getBookmarkListsForUser.static List<BookmarkList> getBookmarkListsSharedWithUser.Getter for the fieldcurrentBookmark.Getter for the fieldcurrentBookmarkList.getCurrentBookmarkListId.getCurrentBookmarkListNames.Getter for the fieldcurrentUserGroup.Returns a list of all existing bookmark list that are marked public.Returns the names all existing user groups (minus the ones currentBookmarkList is already shared with).Getter for the fieldsessionBookmarkListEmail.getShareKey.getShareLink(BookmarkList bookmarkList) getShareLink.voidinit()init.booleanisCurrentBookmarkListMine.booleanisCurrentBookmarkListShared.booleanisNewBookmarkList.voidprepareItemForBookmarkList.voidSets currentBookmarkList to a new object.voidresetShareLink(BookmarkList bookmarkList) Updates the currently selected Bookmark if it is already part of the current BookmarkList, otherwise adds a new Bookmark.Updates the currently selected bookmark list if it already in the user's list of bookmark lists, adds it to the list otherwise.voidselectBookmarkListAction.voidsendSessionBookmarkListAsMail.voidsetCurrentBookmark(Bookmark currentBookmark) Setter for the fieldcurrentBookmark.voidsetCurrentBookmarkList(BookmarkList currentBookmarkList) Setter for the fieldcurrentBookmarkList.voidsetCurrentBookmarkListId(String bookmarkListId) setCurrentBookmarkListId.voidvoidsetCurrentUserGroup(UserGroup currentUserGroup) Setter for the fieldcurrentUserGroup.voidsetNewBookmarkListName(String newBookmarkListName) voidsetPublic(BookmarkList bookmarkList, boolean isPublic) voidsetSessionBookmarkListEmail(String sessionBookmarkListEmail) Setter for the fieldsessionBookmarkListEmail.voidsetShareKey(String key) setShareKey.voidRemoves currentUserGroup from the shares list of currentBookmarkList.voiduserGroupSelectedAction.voidvalidateName(FacesContext context, UIComponent toValidate, Object value) validateName.viewBookmarkListAction(BookmarkList bookmarkList) viewBookmarkListAction.
-
Constructor Details
-
BookmarkBean
public BookmarkBean()Empty Constructor.
-
-
Method Details
-
init
init. -
cancelEditCurrentBookmarkListAction
Resets the current bookmark list and returns to the overview of own bookmark lists.- Returns:
- the pretty URL name for the bookmark lists overview page
-
saveCurrentBookmarkListAction
Updates the currently selected bookmark list if it already in the user's list of bookmark lists, adds it to the list otherwise. Saves DataManager in both cases.- Returns:
- the pretty URL name for the next view after saving (overview on success, edit page on failure)
-
deleteCurrentBookmarkListAction
Deletes currentBookmarkList.- Returns:
- the pretty URL name for the next view after deletion (overview on success, edit page on failure)
-
resetCurrentBookmarkListAction
public void resetCurrentBookmarkListAction()Sets currentBookmarkList to a new object. -
prepareItemForBookmarkList
prepareItemForBookmarkList.- Throws:
IndexUnreachableException- if any.
-
saveCurrentBookmarkAction
Updates the currently selected Bookmark if it is already part of the current BookmarkList, otherwise adds a new Bookmark. Saves DataManager in both cases.- Returns:
- an empty string or navigation outcome after attempting to save the current bookmark
-
deleteCurrentItemAction
Removes the currently selected Bookmark from the currently selected BookmarkList.- Parameters:
bookmark- bookmark to remove from the current list
-
getRemainingUserGroupNames
Returns the names all existing user groups (minus the ones currentBookmarkList is already shared with). TODO Filter some user groups, if required (e.g. admins)- Returns:
- a list of user group names not yet sharing the current bookmark list
- Throws:
DAOException- if any.
-
getPublicBookmarkLists
Returns a list of all existing bookmark list that are marked public.- Returns:
- a list of all publicly visible bookmark lists
- Throws:
DAOException- if any.
-
getBookmarkLists
Returns a list of all existing bookmark lists owned by current user.- Returns:
- a list of bookmark lists owned by the currently logged-in user
- Throws:
DAOException- if any.
-
getBookmarkListsForUser
getBookmarkListsForUser.- Parameters:
user- user whose owned bookmark lists to load- Returns:
- a list of bookmark lists owned by the given user
- Throws:
DAOException- if any.
-
selectBookmarkListAction
selectBookmarkListAction.- Parameters:
event- value change event carrying the selected bookmark list name- Throws:
DAOException- if any.
-
isNewBookmarkList
public boolean isNewBookmarkList()isNewBookmarkList.- Returns:
- true if the current bookmark list has not yet been persisted (has no database ID), false otherwise
-
createNewBookmarkListAction
createNewBookmarkListAction.- Returns:
- the pretty URL name for the bookmark list edit page after resetting to a new empty list
-
userGroupSelectedAction
userGroupSelectedAction.- Parameters:
event- value change event carrying the selected user group name- Throws:
DAOException- if any.
-
validateName
public void validateName(FacesContext context, UIComponent toValidate, Object value) throws ValidatorException, DAOException validateName.- Parameters:
context- current JSF faces contexttoValidate- UI component being validatedvalue- submitted bookmark list name value- Throws:
ValidatorException- if any.DAOException- if any.
-
isCurrentBookmarkListMine
public boolean isCurrentBookmarkListMine()isCurrentBookmarkListMine.- Returns:
- true if the current bookmark list belongs to the logged-in user (or is a new unsaved list), false otherwise
-
getCurrentBookmarkList
Getter for the fieldcurrentBookmarkList.- Returns:
- the
BookmarkListcurrently selected by the user, or null if none selected
-
getCurrentBookmarkListNames
getCurrentBookmarkListNames.- Returns:
- a list of bookmark list names owned by the current user
- Throws:
DAOException- if any.
-
setCurrentBookmarkList
Setter for the fieldcurrentBookmarkList.- Parameters:
currentBookmarkList- bookmark list to set as currently selected
-
getCurrentBookmarkListId
getCurrentBookmarkListId.- Returns:
- Identifier of currentBookmarkList; null if none loaded
-
setCurrentBookmarkListId
public void setCurrentBookmarkListId(String bookmarkListId) throws IllegalUrlParameterException, DAOException setCurrentBookmarkListId.- Parameters:
bookmarkListId- numeric ID string of the bookmark list to load- Throws:
PresentationException- if any.DAOException- if any.IllegalUrlParameterException
-
viewBookmarkListAction
viewBookmarkListAction.- Parameters:
bookmarkList- bookmark list to open in view mode- Returns:
- the pretty URL name for the bookmark list view page
-
editBookmarkListAction
editBookmarkListAction.- Parameters:
bookmarkList- bookmark list to open in edit mode- Returns:
- the pretty URL name for the bookmark list edit page
-
getCurrentBookmark
Getter for the fieldcurrentBookmark.- Returns:
- the
Bookmarkcurrently active for editing or display, or null if none selected
-
setCurrentBookmark
Setter for the fieldcurrentBookmark.- Parameters:
currentBookmark- bookmark to set as currently active
-
getCurrentUserGroup
Getter for the fieldcurrentUserGroup.- Returns:
- the
UserGroupcurrently selected for sharing a bookmark list, or null if none selected
-
setCurrentUserGroup
Setter for the fieldcurrentUserGroup.- Parameters:
currentUserGroup- user group to set as currently selected
-
setSessionBookmarkListEmail
Setter for the fieldsessionBookmarkListEmail.- Parameters:
sessionBookmarkListEmail- email address for sending the session bookmark list
-
getSessionBookmarkListEmail
Getter for the fieldsessionBookmarkListEmail.- Returns:
- the email address for sending the session bookmark list, or null if not set
-
getCurrentBookmarkListKey
-
setCurrentBookmarkListKey
- Throws:
PresentationExceptionDAOException
-
setPublic
-
sendSessionBookmarkListAsMail
public void sendSessionBookmarkListAsMail()sendSessionBookmarkListAsMail. -
countSessionBookmarkListItems
public int countSessionBookmarkListItems()countSessionBookmarkListItems.- Returns:
- Size of items in the session bookmark list
-
getNewBookmarkListName
-
setNewBookmarkListName
-
addBookmarkList
public void addBookmarkList()
-