Class License

All Implemented Interfaces:
IPrivilegeHolder, Serializable

@Entity public class License extends AbstractPrivilegeHolder implements Serializable
Represents an access licence assigned to a user, user group, or IP range, controlling permissions for specific access conditions.
See Also:
  • Constructor Details

    • License

      public License()
      Zero-arg constructor.
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • isValid

      public boolean isValid()
      Checks the validity of this license. A valid license is either not time limited (start and/or end) or the current date lies between the license's start and and dates.
      Returns:
      true if valid; false otherwise;
    • addPrivilege

      public boolean addPrivilege(String privilege)
      Adds the given privilege to the working set.
      Specified by:
      addPrivilege in interface IPrivilegeHolder
      Parameters:
      privilege - Privilege name to add to working set
      Returns:
      true if successful; false otherwise
    • removePrivilege

      public boolean removePrivilege(String privilege)
      Removes the given privilege from the working set.
      Specified by:
      removePrivilege in interface IPrivilegeHolder
      Parameters:
      privilege - Privilege name to remove from working set
      Returns:
      true if successful; false otherwise
    • hasPrivilege

      public boolean hasPrivilege(String privilege)
      hasPrivilege.
      Specified by:
      hasPrivilege in interface IPrivilegeHolder
      Parameters:
      privilege - privilege name constant to check
      Returns:
      true if this holder has the given privilege, false otherwise
    • isPrivCmsPages

      public boolean isPrivCmsPages()
      isPrivCmsPages.
      Specified by:
      isPrivCmsPages in interface IPrivilegeHolder
      Returns:
      true if this holder has the privilege to manage CMS pages, false otherwise
    • setPrivCmsPages

      public void setPrivCmsPages(boolean priv)
      setPrivCmsPages.
      Specified by:
      setPrivCmsPages in interface IPrivilegeHolder
      Parameters:
      priv - true to grant CMS pages privilege
    • isPrivCmsAllSubthemes

      public boolean isPrivCmsAllSubthemes()
      isPrivCmsAllSubthemes.
      Specified by:
      isPrivCmsAllSubthemes in interface IPrivilegeHolder
      Returns:
      true if this holder has the privilege to access all CMS subthemes, false otherwise
    • setPrivCmsAllSubthemes

      public void setPrivCmsAllSubthemes(boolean priv)
      setPrivCmsAllSubthemes.
      Specified by:
      setPrivCmsAllSubthemes in interface IPrivilegeHolder
      Parameters:
      priv - true to grant all CMS subthemes privilege
    • isPrivCmsAllCategories

      public boolean isPrivCmsAllCategories()
      isPrivCmsAllCategories.
      Specified by:
      isPrivCmsAllCategories in interface IPrivilegeHolder
      Returns:
      true if this holder has the privilege to access all CMS categories, false otherwise
    • setPrivCmsAllCategories

      public void setPrivCmsAllCategories(boolean priv)
      setPrivCmsAllCategories.
      Specified by:
      setPrivCmsAllCategories in interface IPrivilegeHolder
      Parameters:
      priv - true to grant all CMS categories privilege
    • isPrivCmsAllTemplates

      public boolean isPrivCmsAllTemplates()
      isPrivCmsAllTemplates.
      Specified by:
      isPrivCmsAllTemplates in interface IPrivilegeHolder
      Returns:
      true if this holder has the privilege to access all CMS page templates, false otherwise
    • setPrivCmsAllTemplates

      public void setPrivCmsAllTemplates(boolean priv)
      setPrivCmsAllTemplates.
      Specified by:
      setPrivCmsAllTemplates in interface IPrivilegeHolder
      Parameters:
      priv - true to grant all CMS templates privilege
    • isPrivCmsMenu

      public boolean isPrivCmsMenu()
      isPrivCmsMenu.
      Specified by:
      isPrivCmsMenu in interface IPrivilegeHolder
      Returns:
      true if this holder has the privilege to manage the CMS navigation menu, false otherwise
    • setPrivCmsMenu

      public void setPrivCmsMenu(boolean priv)
      setPrivCmsMenu.
      Specified by:
      setPrivCmsMenu in interface IPrivilegeHolder
      Parameters:
      priv - true to grant CMS menu privilege
    • isPrivCmsStaticPages

      public boolean isPrivCmsStaticPages()
      isPrivCmsStaticPages.
      Specified by:
      isPrivCmsStaticPages in interface IPrivilegeHolder
      Returns:
      true if this holder has the privilege to manage CMS static pages, false otherwise
    • setPrivCmsStaticPages

      public void setPrivCmsStaticPages(boolean priv)
      setPrivCmsStaticPages.
      Specified by:
      setPrivCmsStaticPages in interface IPrivilegeHolder
      Parameters:
      priv - true to grant CMS static pages privilege
    • isPrivCmsCollections

      public boolean isPrivCmsCollections()
      isPrivCmsCollections.
      Specified by:
      isPrivCmsCollections in interface IPrivilegeHolder
      Returns:
      true if this holder has the privilege to manage CMS collections, false otherwise
    • setPrivCmsCollections

      public void setPrivCmsCollections(boolean priv)
      setPrivCmsCollections.
      Specified by:
      setPrivCmsCollections in interface IPrivilegeHolder
      Parameters:
      priv - true to grant CMS collections privilege
    • isPrivCmsCategories

      public boolean isPrivCmsCategories()
      isPrivCmsCategories.
      Specified by:
      isPrivCmsCategories in interface IPrivilegeHolder
      Returns:
      true if this holder has the privilege to manage CMS categories, false otherwise
    • setPrivCmsCategories

      public void setPrivCmsCategories(boolean priv)
      setPrivCmsCategories.
      Specified by:
      setPrivCmsCategories in interface IPrivilegeHolder
      Parameters:
      priv - true to grant CMS categories privilege
    • isPrivCrowdsourcingAllCampaigns

      public boolean isPrivCrowdsourcingAllCampaigns()
      isPrivCrowdsourcingAllCampaigns.
      Specified by:
      isPrivCrowdsourcingAllCampaigns in interface IPrivilegeHolder
      Returns:
      true if this holder has the privilege to access all crowdsourcing campaigns, false otherwise
    • setPrivCrowdsourcingAllCampaigns

      public void setPrivCrowdsourcingAllCampaigns(boolean priv)
      setPrivCrowdsourcingAllCampaigns.
      Specified by:
      setPrivCrowdsourcingAllCampaigns in interface IPrivilegeHolder
      Parameters:
      priv - true to grant all crowdsourcing campaigns privilege
    • isPrivCrowdsourcingAnnotateCampaign

      public boolean isPrivCrowdsourcingAnnotateCampaign()
      isPrivCrowdsourcingAnnotateCampaign.
      Specified by:
      isPrivCrowdsourcingAnnotateCampaign in interface IPrivilegeHolder
      Returns:
      true if this holder has the privilege to annotate in crowdsourcing campaigns, false otherwise
    • setPrivCrowdsourcingAnnotateCampaign

      public void setPrivCrowdsourcingAnnotateCampaign(boolean priv)
      setPrivCrowdsourcingAnnotateCampaign.
      Specified by:
      setPrivCrowdsourcingAnnotateCampaign in interface IPrivilegeHolder
      Parameters:
      priv - true to grant crowdsourcing annotate campaign privilege
    • isPrivCrowdsourcingReviewCampaign

      public boolean isPrivCrowdsourcingReviewCampaign()
      isPrivCrowdsourcingReviewCampaign.
      Specified by:
      isPrivCrowdsourcingReviewCampaign in interface IPrivilegeHolder
      Returns:
      true if this holder has the privilege to review crowdsourcing campaign contributions, false otherwise
    • setPrivCrowdsourcingReviewCampaign

      public void setPrivCrowdsourcingReviewCampaign(boolean priv)
      setPrivCrowdsourcingReviewCampaign.
      Specified by:
      setPrivCrowdsourcingReviewCampaign in interface IPrivilegeHolder
      Parameters:
      priv - true to grant crowdsourcing review campaign privilege
    • isPrivViewUgc

      public boolean isPrivViewUgc()
      Description copied from interface: IPrivilegeHolder
      isPrivViewUgc.
      Specified by:
      isPrivViewUgc in interface IPrivilegeHolder
      Returns:
      true if this holder has the privilege to view user-generated content (UGC), false otherwise
    • setPrivViewUgc

      public void setPrivViewUgc(boolean priv)
      Description copied from interface: IPrivilegeHolder
      setPrivViewUgc.
      Specified by:
      setPrivViewUgc in interface IPrivilegeHolder
      Parameters:
      priv - true to grant view UGC privilege
    • resetTempData

      public void resetTempData()
      Resets all working copies of lists of various privileges.
    • getAvailablePrivileges

      public List<String> getAvailablePrivileges()
      Returns the list of available record privileges for adding to this license (using the working copy while editing).
      Returns:
      Values in IPrivilegeHolder.PRIVS_RECORD minus the privileges already added
    • getAvailablePrivileges

      public List<String> getAvailablePrivileges(Set<String> privileges)
      Returns the list of available record privileges for adding to this license (using the given privileges list).
      Parameters:
      privileges - Currently assigned privileges to exclude from result
      Returns:
      Values in IPrivilegeHolder.PRIVS_RECORD minus the privileges already added
    • getSortedPrivileges

      public List<String> getSortedPrivileges(Set<String> privileges)
      Returns a sorted list (according to the static array of privileges, either for records or CMS) based on the given set of privileges.
      Specified by:
      getSortedPrivileges in interface IPrivilegeHolder
      Parameters:
      privileges - Listed privileges
      Returns:
      Sorted list of privileges contained in privileges
    • getSelectableSubthemes

      public List<Selectable<String>> getSelectableSubthemes() throws PresentationException
      Returns:
      List<Selectablei<String>>
      Throws:
      DAOException
      PresentationException
    • getSelectableCategories

      public List<Selectable<CMSCategory>> getSelectableCategories() throws DAOException
      Returns:
      List<Selectable<CMSCategory>>
      Throws:
      DAOException
    • getSelectableTemplates

      public List<Selectable<CMSPageTemplate>> getSelectableTemplates() throws DAOException
      Returns:
      List<Selectable<CMSPageTemplate>>
      Throws:
      DAOException
    • getId

      public Long getId()
      Getter for the field id.
      Returns:
      the database primary key for this license
    • setId

      public void setId(Long id)
      Setter for the field id.
      Parameters:
      id - the database primary key for this license
    • getLicenseType

      public LicenseType getLicenseType()
      Getter for the field licenseType.
      Returns:
      the license type defining the access conditions and privileges for this license
    • setLicenseType

      public void setLicenseType(LicenseType licenseType)
      Setter for the field licenseType.
      Parameters:
      licenseType - the license type defining the access conditions and privileges for this license
    • getLicensees

      public List<LicenseRightsHolder> getLicensees()
    • setLicensees

      public void setLicensees(List<LicenseRightsHolder> licensees)
    • getUser

      @Deprecated(since="2026.01") public User getUser()
      Deprecated.
      Getter for the field user.
      Returns:
      the user this license is granted to, or null if granted to a group or IP range
    • setUser

      @Deprecated(since="2026.01") public void setUser(User user)
      Deprecated.
      Setter for the field user.
      Parameters:
      user - the user this license is granted to (clears userGroup and ipRange when non-null)
    • getUserGroup

      @Deprecated(since="2026.01") public UserGroup getUserGroup()
      Deprecated.
      Getter for the field userGroup.
      Returns:
      the user group this license is granted to, or null if granted to a user or IP range
    • setUserGroup

      @Deprecated(since="2026.01") public void setUserGroup(UserGroup userGroup)
      Deprecated.
      Setter for the field userGroup.
      Parameters:
      userGroup - the user group this license is granted to (clears user and ipRange when non-null)
    • getIpRange

      @Deprecated(since="2026.01") public IpRange getIpRange()
      Deprecated.
      Getter for the field ipRange.
      Returns:
      the IP range this license is granted to, or null if granted to a user or user group
    • setIpRange

      @Deprecated(since="2026.01") public void setIpRange(IpRange ipRange)
      Deprecated.
      Setter for the field ipRange.
      Parameters:
      ipRange - the IP range this license is granted to (clears user and userGroup when non-null)
    • getStart

      public LocalDateTime getStart()
      Getter for the field start.
      Returns:
      the date/time from which this license becomes valid, or null if there is no start restriction
    • setStart

      public void setStart(LocalDateTime start)
      Setter for the field start.
      Parameters:
      start - the date/time from which this license becomes valid; null means no start restriction
    • getEnd

      public LocalDateTime getEnd()
      Getter for the field end.
      Returns:
      the date/time after which this license expires, or null if there is no end restriction
    • setEnd

      public void setEnd(LocalDateTime end)
      Setter for the field end.
      Parameters:
      end - the date/time after which this license expires; null means no end restriction
    • getPrivileges

      public Set<String> getPrivileges()
      Getter for the field privileges.
      Returns:
      the set of privilege names granted by this license
    • setPrivileges

      public void setPrivileges(Set<String> privileges)
      Setter for the field privileges.
      Parameters:
      privileges - the set of privilege names granted by this license
    • getConditions

      public String getConditions()
      Getter for the field conditions.
      Returns:
      the Solr query expression restricting the records this license applies to
    • setConditions

      public void setConditions(String conditions)
      Setter for the field conditions.
      Parameters:
      conditions - the Solr query expression restricting the records this license applies to
    • getDescription

      public String getDescription()
      Getter for the field description.
      Returns:
      the human-readable description of this license
    • setDescription

      public void setDescription(String description)
      Setter for the field description.
      Parameters:
      description - the human-readable description of this license
    • isTicketRequired

      public boolean isTicketRequired()
    • setTicketRequired

      public void setTicketRequired(boolean ticketRequired)
    • isDisplayTicketRequiredToggle

      public boolean isDisplayTicketRequiredToggle()
      Returns:
      true if privilege PRIV_DOWNLOAD_BORN_DIGITAL_FILES is contained; false otherwise
    • getSubthemeDiscriminatorValues

      public List<String> getSubthemeDiscriminatorValues()
      Getter for the field subthemeDiscriminatorValues.
      Returns:
      the list of subtheme discriminator values that restrict the scope of this license
    • setSubthemeDiscriminatorValues

      public void setSubthemeDiscriminatorValues(List<String> subthemeDiscriminatorValues)
      Setter for the field subthemeDiscriminatorValues.
      Parameters:
      subthemeDiscriminatorValues - the list of subtheme discriminator values that restrict the scope of this license
    • getAllowedCategories

      public List<CMSCategory> getAllowedCategories()
      Getter for the field allowedCategories.
      Returns:
      the list of CMS categories accessible under this license
    • setAllowedCategories

      public void setAllowedCategories(List<CMSCategory> allowedCategories)
      Setter for the field allowedCategories.
      Parameters:
      allowedCategories - the list of CMS categories accessible under this license
    • getAllowedCmsTemplates

      public List<CMSPageTemplate> getAllowedCmsTemplates()
      Getter for the field allowedCmsTemplates.
      Returns:
      the list of CMS page templates accessible under this license
    • setAllowedCmsTemplates

      public void setAllowedCmsTemplates(List<CMSPageTemplate> allowedCmsTemplates)
      Setter for the field allowedCmsTemplates.
      Parameters:
      allowedCmsTemplates - the list of CMS page templates accessible under this license
    • getAllowedCrowdsourcingCampaigns

      public List<Campaign> getAllowedCrowdsourcingCampaigns()
      Getter for the field allowedCrowdsourcingCampaigns.
      Returns:
      the list of crowdsourcing campaigns accessible under this license
    • setAllowedCrowdsourcingCampaigns

      public void setAllowedCrowdsourcingCampaigns(List<Campaign> allowedCrowdsourcingCampaigns)
      Setter for the field allowedCrowdsourcingCampaigns.
      Parameters:
      allowedCrowdsourcingCampaigns - the list of crowdsourcing campaigns accessible under this license
    • getPrivilegesCopy

      public Set<String> getPrivilegesCopy()
    • setPrivilegesCopy

      public void setPrivilegesCopy(Set<String> privilegesCopy)
    • getDisclaimerScope

      public ConsentScope getDisclaimerScope()
    • getClientId

      @Deprecated(since="2026.01") public Long getClientId()
      Deprecated.
    • getClient

      @Deprecated(since="2026.01") public ClientApplication getClient()
      Deprecated.
    • setClient

      @Deprecated(since="2026.01") public void setClient(ClientApplication client)
      Deprecated.
    • addLicensee

      public void addLicensee()
    • removeLicensee

      public void removeLicensee(LicenseRightsHolder licensee)
    • isHasLicensees

      public boolean isHasLicensees()
      Returns:
      true if at least one of user/userGroup/ipRange/client are non-null; false otherwise
    • isHasMultipleLicensees

      public boolean isHasMultipleLicensees()
      Returns:
      true if at least two of user/userGroup/ipRange/client are non-null; false otherwise
    • getSecondaryAccessRequirement

      public ILicensee getSecondaryAccessRequirement()
      A.
      Returns:
      The other non-null member of user/userGroup/ipRange/client
    • getDisabledStatus

      public String getDisabledStatus()
      Convenience method for disabling the save button.
      Returns:
      "disabled" if any required values are missing; null otherwise