Class AdminBean

java.lang.Object
io.goobi.viewer.managedbeans.AdminBean
All Implemented Interfaces:
Serializable

@Named @SessionScoped public class AdminBean extends Object implements Serializable
Administration backend functions.
See Also:
  • Constructor Details

    • AdminBean

      public AdminBean()

      Constructor for AdminBean.

  • Method Details

    • init

      @PostConstruct public void init()

      init.

    • getAllUsers

      public List<User> getAllUsers() throws DAOException
      Returns all users in the DB. Needed for getting a list of users (e.g for adding user group members).
      Returns:
      a List object.
      Throws:
      DAOException - if any.
    • getAllUsersExcept

      public List<User> getAllUsersExcept(Set<User> usersToExclude) throws DAOException

      getAllUsersExcept.

      Parameters:
      usersToExclude - a Set object.
      Returns:
      a List object.
      Throws:
      DAOException - if any.
    • saveCurrentUserAction

      public String saveCurrentUserAction() throws DAOException
      Throws:
      DAOException
    • saveUserAction

      public String saveUserAction(User user, String returnPage) throws DAOException
      Throws:
      DAOException
    • resetUserAction

      public String resetUserAction(User user, String returnPage)
    • saveUserAction

      public boolean saveUserAction(User user) throws DAOException

      Saves the given use. Attention: Used by regular users editing their own profile as well.

      Parameters:
      user - User to save
      Returns:
      a String object.
      Throws:
      DAOException - if any.
    • deleteUserAction

      public String deleteUserAction(User user, boolean deleteContributions) throws DAOException

      Deletes the given User and optionally their contributions. This method is user for admin-induced deletion of other users as well as self-deletion by a user.

      Parameters:
      user - User to be deleted
      deleteContributions - If true, all content created by this user will also be deleted
      Returns:
      Navigation outcome
      Throws:
      DAOException - if any.
    • resetCurrentUserAction

      public void resetCurrentUserAction()

      resetCurrentUserAction.

    • getAllUserGroups

      public List<UserGroup> getAllUserGroups() throws DAOException
      Returns all user groups in the DB. Needed for getting a list of users (e.g for adding user group members).
      Returns:
      a List object.
      Throws:
      DAOException - if any.
    • saveUserGroupAction

      public String saveUserGroupAction() throws DAOException
      Persists changes in currentUserGroup.
      Returns:
      Navigation outcome
      Throws:
      DAOException - if any.
    • deleteUserGroupAction

      public void deleteUserGroupAction(UserGroup userGroup) throws DAOException

      deleteUserGroupAction.

      Parameters:
      userGroup - a UserGroup object.
      Throws:
      DAOException - if any.
    • resetCurrentUserGroupAction

      public void resetCurrentUserGroupAction()

      resetCurrentUserGroupAction.

    • getAllRoles

      public List<Role> getAllRoles() throws DAOException
      Returns a list of all existing roles. Required for admin tab components.
      Returns:
      a List object.
      Throws:
      DAOException - if any.
    • saveRoleAction

      public void saveRoleAction() throws DAOException

      saveRoleAction.

      Throws:
      DAOException - if any.
    • deleteRoleAction

      public void deleteRoleAction(Role role) throws DAOException

      deleteRoleAction.

      Parameters:
      role - a Role object.
      Throws:
      DAOException - if any.
    • resetCurrentRoleAction

      public void resetCurrentRoleAction()

      resetCurrentRoleAction.

    • resetCurrentUserRoleAction

      public void resetCurrentUserRoleAction()

      resetCurrentUserRoleAction.

    • resetDirtyUserRolesAction

      public void resetDirtyUserRolesAction()
    • addUserRoleAction

      public void addUserRoleAction() throws DAOException
      Adds currentUserRole to the map of UserRoles to be processed, marked as to save.
      Throws:
      DAOException
    • deleteUserRoleAction

      public void deleteUserRoleAction(UserRole userRole) throws DAOException

      Adds currentUserRole to the map of UserRoles to be processed, marked as to delete.

      Parameters:
      userRole - a UserRole object.
      Throws:
      DAOException - if any.
    • updateUserRoles

      public void updateUserRoles() throws DAOException

      saveUserRoleAction.

      Throws:
      DAOException - if any.
    • getAllIpRanges

      public List<IpRange> getAllIpRanges() throws DAOException
      Returns:
      all IpRanges from the database
      Throws:
      DAOException
    • saveIpRangeAction

      public String saveIpRangeAction() throws DAOException

      saveIpRangeAction.

      Returns:
      Navigation outcome
      Throws:
      DAOException - if any.
    • deleteIpRangeAction

      public void deleteIpRangeAction(IpRange ipRange) throws DAOException

      deleteIpRangeAction.

      Parameters:
      ipRange - a IpRange object.
      Throws:
      DAOException - if any.
    • resetCurrentIpRangeAction

      public void resetCurrentIpRangeAction()

      resetCurrentIpRangeAction.

    • getCurrentUser

      public User getCurrentUser()

      Getter for the field currentUser.

      Returns:
      the currentUser
    • setCurrentUser

      public void setCurrentUser(User currentUser)

      Setter for the field currentUser.

      Parameters:
      currentUser - the currentUser to set
    • getCurrentUserId

      public Long getCurrentUserId()
      Returns the user ID of currentUser/code>.
      Returns:
      currentUser.id if loaded and has ID; null if not
    • setCurrentUserId

      public void setCurrentUserId(Long id) throws DAOException
      Sets the current user by loading them from the DB via the given user ID.
      Parameters:
      id -
      Throws:
      DAOException
    • getCurrentUserGroup

      public UserGroup getCurrentUserGroup()

      Getter for the field currentUserGroup.

      Returns:
      a UserGroup object.
    • setCurrentUserGroup

      public void setCurrentUserGroup(UserGroup userGroup)

      Setter for the field currentUserGroup.

      Parameters:
      userGroup - a UserGroup object.
    • getCurrentUserGroupId

      public Long getCurrentUserGroupId()
      Returns the user ID of currentUserGroup/code>.
      Returns:
      currentUserGroup.id if loaded and has ID; null if not
    • setCurrentUserGroupId

      public void setCurrentUserGroupId(Long id) throws DAOException
      Sets currentUserGroup/code> by loading it from the DB via the given ID.
      Parameters:
      id -
      Throws:
      DAOException
    • getCurrentRole

      public Role getCurrentRole()

      Getter for the field currentRole.

      Returns:
      the currentRole
    • setCurrentRole

      public void setCurrentRole(Role currentRole)

      Setter for the field currentRole.

      Parameters:
      currentRole - the currentRole to set
    • getCurrentUserRole

      public UserRole getCurrentUserRole()

      Getter for the field currentUserRole.

      Returns:
      the currentUserRole
    • setCurrentUserRole

      public void setCurrentUserRole(UserRole currentUserRole)

      Setter for the field currentUserRole.

      Parameters:
      currentUserRole - the currentUserRole to set
    • getCurrentIpRange

      public IpRange getCurrentIpRange()

      Getter for the field currentIpRange.

      Returns:
      the currentIpRange
    • setCurrentIpRange

      public void setCurrentIpRange(IpRange currentIpRange)

      Setter for the field currentIpRange.

      Parameters:
      currentIpRange - the currentIpRange to set
    • getCurrentIpRangeId

      public Long getCurrentIpRangeId()
      Returns the user ID of currentIpRange/code>.
      Returns:
      currentIpRange.id if loaded and has ID; null if not
    • setCurrentIpRangeId

      public void setCurrentIpRangeId(Long id) throws DAOException
      Sets currentIpRange/code> by loading it from the DB via the given ID.
      Parameters:
      id -
      Throws:
      DAOException
    • getLazyModelUsers

      public TableDataProvider<User> getLazyModelUsers()

      Getter for the field lazyModelUsers.

      Returns:
      the lazyModelUsers
    • getPageUsers

      public List<User> getPageUsers()

      getPageUsers.

      Returns:
      a List object.
    • getCurrentPassword

      public String getCurrentPassword()
      Returns:
      the currentPassword
    • setCurrentPassword

      public void setCurrentPassword(String currentPassword)
      Parameters:
      currentPassword - the currentPassword to set
    • getPasswordOne

      public String getPasswordOne()

      Getter for the field passwordOne.

      Returns:
      the passwordOne
    • setPasswordOne

      public void setPasswordOne(String passwordOne)

      Setter for the field passwordOne.

      Parameters:
      passwordOne - the passwordOne to set
    • getPasswordTwo

      public String getPasswordTwo()

      Getter for the field passwordTwo.

      Returns:
      the passwordTwo
    • setPasswordTwo

      public void setPasswordTwo(String passwordTwo)

      Setter for the field passwordTwo.

      Parameters:
      passwordTwo - the passwordTwo to set
    • getEmailConfirmation

      public String getEmailConfirmation()
      Returns:
      the emailConfirmation
    • setEmailConfirmation

      public void setEmailConfirmation(String emailConfirmation)
      Parameters:
      emailConfirmation - the emailConfirmation to set
    • isDeleteUserContributions

      public boolean isDeleteUserContributions()
      Returns:
      the deleteUserContributions
    • setDeleteUserContributions

      public void setDeleteUserContributions(boolean deleteUserContributions)
      Parameters:
      deleteUserContributions - the deleteUserContributions to set
    • deleteFromCache

      public int deleteFromCache(List<String> identifiers, boolean fromContentCache, boolean fromThumbnailCache)

      deleteFromCache.

      Parameters:
      identifiers - a List object.
      fromContentCache - a boolean.
      fromThumbnailCache - a boolean.
      Returns:
      a int.
    • deleteFromCache

      public int deleteFromCache(List<String> identifiers, boolean fromContentCache, boolean fromThumbnailCache, boolean fromPdfCache) throws DAOException

      deleteFromCache.

      Parameters:
      identifiers - a List object.
      fromContentCache - a boolean.
      fromThumbnailCache - a boolean.
      fromPdfCache - a boolean.
      Returns:
      a int.
      Throws:
      DAOException
    • setRepresantativeImageAction

      public String setRepresantativeImageAction(String pi, String dataRepository, String fileIdRoot)

      setRepresantativeImageAction.

      Parameters:
      pi - a String object.
      dataRepository - a String object.
      fileIdRoot - a String object.
      Returns:
      a String object.
    • setRepresantativeImageStatic

      public static void setRepresantativeImageStatic(String pi, String dataRepository, String fileIdRoot)
      Opens the METS file for the given identifier and sets the attribute USE='banner' to all file elements that match the given file ID root. Any USE='banner' attributes that do not match the file ID root are removed. Solr schema version "intranda_viewer-20130117" or newer required.
      Parameters:
      pi - a String object.
      dataRepository - a String object.
      fileIdRoot - a String object.
    • toggleSuspendUserAction

      public String toggleSuspendUserAction(User user) throws DAOException

      toggleSuspendUserAction.

      Parameters:
      user - a User object.
      Returns:
      a String object.
      Throws:
      DAOException - if any.
    • triggerMessage

      public void triggerMessage(String message)
    • isDisplayTranslationsDashboardWidget

      public boolean isDisplayTranslationsDashboardWidget()
      Returns:
      true if at least one group is not fully translated; false otherwise
    • getConfiguredTranslationGroupsCount

      public long getConfiguredTranslationGroupsCount()
      Returns:
      Number of configured translation grouns
    • getConfiguredTranslationGroups

      public List<TranslationGroup> getConfiguredTranslationGroups()
      Returns:
      All configured TranslationGroups
    • getTranslationGroupsForSolrField

      public List<TranslationGroup> getTranslationGroupsForSolrField(String field)
      Parameters:
      field - Index field that the translation groups should have as a key
      Returns:
      List of TranslationGroups; null if not found
    • getTranslationGroupForFieldAndKey

      public TranslationGroup getTranslationGroupForFieldAndKey(String field, String key)
      Parameters:
      field - Solr field
      key - Message key
      Returns:
      First TranslationGroup that contains the requested field+key; null if none found
    • getTranslationGroupsForSolrFieldStatic

      public static List<TranslationGroup> getTranslationGroupsForSolrFieldStatic(String field)
      Parameters:
      field - Index field that the translation groups should have as a key
      Returns:
      List of TranslationGroups; null if not found
    • saveAndResetCurrentTranslationGroup

      public void saveAndResetCurrentTranslationGroup()
      Saves currentTranslationGroup if it has a selected entry. Resets group to null afterwards.
    • getCurrentTranslationGroup

      public TranslationGroup getCurrentTranslationGroup()
      Returns:
      the currentTranslationGroup
    • setCurrentTranslationGroup

      public void setCurrentTranslationGroup(TranslationGroup currentTranslationGroup)
      Parameters:
      currentTranslationGroup - the currentTranslationGroup to set
    • isNewMessageEntryModeAllowed

      public boolean isNewMessageEntryModeAllowed()
      Returns:
      true if at least one LOCAL_STRINGS type group is found in config; false otherwise
    • triggerNewMessageEntryMode

      public void triggerNewMessageEntryMode()
      Triggers a mode for adding new message keys to the first LOCAL_STRINGS type group found.
    • saveSelectedMessageEntryAction

      public String saveSelectedMessageEntryAction()
      Saves currently selected message entry in the current translation group and returns to the translations overview page.
      Returns:
      Target page
    • cancelSelectedMessageEntryAction

      public String cancelSelectedMessageEntryAction()
      Reset selected message entry and returns to the translations overview page.
      Returns:
      Target page
    • getCurrentTranslationGroupId

      public int getCurrentTranslationGroupId()
      Returns:
      Index of currentTranslationGroup in the list of configured groups
    • setCurrentTranslationGroupId

      public void setCurrentTranslationGroupId(int id)
      Parameters:
      id - Looks up and loads currentTranslationGroup that matches the given id
    • getCurrentTranslationMessageKey

      public String getCurrentTranslationMessageKey()
      Returns:
      Key of the currently selected entry; otherwise "-"
    • setCurrentTranslationMessageKey

      public void setCurrentTranslationMessageKey(String key)
      If currentTranslationGroup is set, looks up the message entry for the given key and pre-selects it.
      Parameters:
      key - Message key to select
    • isTranslationLocked

      public boolean isTranslationLocked()
      Returns:
      true if translations are locked by a different user; false otherwise
    • lockTranslation

      public void lockTranslation()
    • getTranslationGroupsEditorSession

      public static String getTranslationGroupsEditorSession()
      Returns:
      the translationGroupsEditorSession
    • setTranslationGroupsEditorSession

      public static void setTranslationGroupsEditorSession(String translationGroupsEditorSession)
      Parameters:
      translationGroupsEditorSession - the translationGroupsEditorSession to set
    • updateHotfolderFileCount

      public void updateHotfolderFileCount()
    • getHotfolderFileCount

      public int getHotfolderFileCount()
      Returns:
      Number of queued records in hotfolder
    • isHasAccessPermissingForTranslationFiles

      public boolean isHasAccessPermissingForTranslationFiles()
      Returns:
      TranslationGroup.isHasFileAccess()
    • setUploadedAvatarFile

      public void setUploadedAvatarFile(javax.servlet.http.Part uploadedAvatarFile)
      Parameters:
      uploadedAvatarFile - the uploadedAvatarFile to set
    • getUploadedAvatarFile

      public javax.servlet.http.Part getUploadedAvatarFile()
      Returns:
      the uploadedAvatarFile