Class AdminLicenseBean

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

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

    • AdminLicenseBean

      public AdminLicenseBean()

      Constructor for AdminBean.

  • Method Details

    • init

      @PostConstruct public void init()

      init.

    • getAllLicenseTypes

      public List<LicenseType> getAllLicenseTypes() throws DAOException
      Returns all existing license types. Required for admin tabs.
      Returns:
      all license types in the database
      Throws:
      DAOException - if any.
    • getGroupedLicenseTypeSelectItems

      public List<javax.faces.model.SelectItem> getGroupedLicenseTypeSelectItems() throws DAOException
      Returns:
      Two SelectItemGroups for core and regular license types
      Throws:
      DAOException
    • getAllCoreLicenseTypes

      public List<LicenseType> getAllCoreLicenseTypes() throws DAOException

      getAllCoreLicenseTypes.

      Returns:
      all license types in the database where core=true
      Throws:
      DAOException - if any.
    • getAllRecordLicenseTypes

      public List<LicenseType> getAllRecordLicenseTypes() throws DAOException

      getAllRecordLicenseTypes.

      Returns:
      all license types in the database where core=false
      Throws:
      DAOException - if any.
    • getOtherLicenseTypes

      public List<LicenseType> getOtherLicenseTypes() throws DAOException
      Returns all existing non-core license types minus currentLicenseType. Used for overriding license type selection.
      Returns:
      a List object.
      Throws:
      DAOException - if any.
    • saveCurrentLicenseTypeAction

      public String saveCurrentLicenseTypeAction() throws DAOException

      saveLicenseTypeAction.

      Returns:
      a String object.
      Throws:
      DAOException - if any.
    • deleteLicenseTypeAction

      public String deleteLicenseTypeAction(LicenseType licenseType) throws DAOException

      deleteLicenseTypeAction.

      Parameters:
      licenseType - a LicenseType object.
      Returns:
      Navigation outcome
      Throws:
      DAOException - if any.
    • newCurrentLicenseTypeAction

      public void newCurrentLicenseTypeAction(String name)

      newCurrentLicenseTypeAction.

      Parameters:
      name -
    • resetCurrentRoleLicenseAction

      public void resetCurrentRoleLicenseAction()

      resetCurrentRoleLicenseAction.

    • getAllLicenses

      public List<License> getAllLicenses() throws DAOException
      Throws:
      DAOException
    • isLicenseTypeInUse

      public boolean isLicenseTypeInUse(LicenseType licenseType) throws DAOException
      Parameters:
      licenseType -
      Returns:
      true if at least one license uses the given license type; false otherwise
      Throws:
      DAOException
    • getConcurrentViewsLimitRecordCountForLicenseType

      public long getConcurrentViewsLimitRecordCountForLicenseType(String licenseTypeName) throws IndexUnreachableException, PresentationException
      Parameters:
      licenseTypeName -
      Returns:
      Number of records with the given licenseTypeName that have the ACCESSCONDITION_CONCURRENTUSE field
      Throws:
      IndexUnreachableException
      PresentationException
    • getPdfQuotaRecordCountForLicenseType

      public long getPdfQuotaRecordCountForLicenseType(String licenseTypeName) throws IndexUnreachableException, PresentationException
      Parameters:
      licenseTypeName -
      Returns:
      Number of records with the given licenseTypeName that have the ACCESSCONDITION_PDF_PERCENTAGE_QUOTA field
      Throws:
      IndexUnreachableException
      PresentationException
    • getLicenses

      public List<License> getLicenses(LicenseType licenseType) throws DAOException
      Parameters:
      licenseType -
      Returns:
      Number of licenses with of given LicenseType
      Throws:
      DAOException
    • newCurrentLicenseAction

      public void newCurrentLicenseAction()

      Creates currentLicense to a new instance.

    • saveCurrentLicenseAction

      public String saveCurrentLicenseAction() throws DAOException, IndexUnreachableException, PresentationException
      Adds the current License to the licensee (User, UserGroup or IpRange). It is imperative that the licensee object is refreshed after updating so that a new license object is an ID attached. Otherwise the list of licenses will throw an NPE!
      Returns:
      Navigation outcome
      Throws:
      DAOException - if any.
      DAOException
      IndexUnreachableException
      PresentationException
    • deleteLicenseAction

      public String deleteLicenseAction(License license) throws DAOException

      deleteLicenseAction.

      Parameters:
      license - a License object.
      Returns:
      a String object.
      Throws:
      DAOException - if any.
    • getLazyModelDownloadTickets

      public TableDataProvider<DownloadTicket> getLazyModelDownloadTickets()

      Getter for the field lazyModelDownloadTickets.

      Returns:
      the lazyModelDownloadTickets
    • getPageDownloadTickets

      public List<DownloadTicket> getPageDownloadTickets()

      getPageDownloadTickets.

      Returns:
      a List object.
    • getDownloadTicketRequests

      public List<DownloadTicket> getDownloadTicketRequests() throws DAOException
      Returns:
      List of existing download tickets that are in request status
      Throws:
      DAOException
    • activateDownloadTicketAction

      public String activateDownloadTicketAction(DownloadTicket ticket) throws DAOException
      Parameters:
      ticket -
      Returns:
      Navigation outcome
      Throws:
      DAOException
    • extendDownloadTicketAction

      public String extendDownloadTicketAction(DownloadTicket ticket) throws DAOException
      Parameters:
      ticket -
      Returns:
      Navigation outcome
      Throws:
      DAOException
    • renewDownloadTicketAction

      public String renewDownloadTicketAction(DownloadTicket ticket) throws DAOException
      Parameters:
      ticket -
      Returns:
      Navigation outcome
      Throws:
      DAOException
    • rejectDownloadTicketAction

      public String rejectDownloadTicketAction(DownloadTicket ticket) throws DAOException
      Parameters:
      ticket -
      Returns:
      Navigation outcome
      Throws:
      DAOException
    • deleteDownloadTicketAction

      public String deleteDownloadTicketAction(DownloadTicket ticket) throws DAOException
      Parameters:
      ticket -
      Returns:
      Navigation outcome
      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
    • getCurrentLicenseType

      public LicenseType getCurrentLicenseType()

      Getter for the field currentLicenseType.

      Returns:
      the currentLicenseType
    • setCurrentLicenseType

      public void setCurrentLicenseType(LicenseType currentLicenseType)

      Setter for the field currentLicenseType.

      Parameters:
      currentLicenseType - the currentLicenseType to set
    • getCurrentLicenseTypeId

      public Long getCurrentLicenseTypeId()
      Returns the user ID of currentLicenseType.
      Returns:
      currentLicenseType.id if loaded and has ID; null if not
    • setCurrentLicenseTypeId

      public void setCurrentLicenseTypeId(Long id) throws DAOException
      Sets currentUserGroup by loading it from the DB via the given ID.
      Parameters:
      id -
      Throws:
      DAOException
    • getCurrentLicense

      public License getCurrentLicense()

      Getter for the field currentLicense.

      Returns:
      the currentLicense
    • setCurrentLicense

      public void setCurrentLicense(License currentLicense)

      Setter for the field currentLicense.

      Parameters:
      currentLicense - the currentLicense to set
    • getCurrentLicenseId

      public Long getCurrentLicenseId()
      Returns the user ID of currentLicense.
      Returns:
      currentLicense.id if loaded and has ID; null if not
    • setCurrentLicenseId

      public void setCurrentLicenseId(Long id) throws DAOException
      Sets currentLicense by loading it from the DB via the given ID.
      Parameters:
      id -
      Throws:
      DAOException
    • getPossibleAccessConditions

      public List<String> getPossibleAccessConditions() throws IndexUnreachableException, PresentationException
      Queries Solr for a list of all values of the set ACCESSCONDITION
      Returns:
      A list of all indexed ACCESSCONDITIONs
      Throws:
      IndexUnreachableException - if any.
      PresentationException - if any.
    • getNotConfiguredAccessConditions

      public List<String> getNotConfiguredAccessConditions() throws PresentationException, DAOException
      Returns:
      List of access condition values that have no corresponding license type in the database
      Throws:
      IndexUnreachableException
      PresentationException
      DAOException
    • getNumRecordsWithAccessCondition

      public long getNumRecordsWithAccessCondition(String accessCondition) throws IndexUnreachableException, PresentationException
      Parameters:
      accessCondition -
      Returns:
      Number of records containing the given access condition value
      Throws:
      PresentationException
      IndexUnreachableException
    • getUrlQueryForAccessCondition

      public String getUrlQueryForAccessCondition(String accessCondition)
      Parameters:
      accessCondition -
      Returns:
      Generated query for given accessCondition
    • getMessageKeyForPrivilege

      public String getMessageKeyForPrivilege(String privilege)
      Parameters:
      privilege -
      Returns:
      Composite message key for the given privilege name