Class UserPopulationDAO

java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.user.population.UserPopulationDAO
All Implemented Interfaces:
LogEnabled, Disposable, Initializable, Component, Serviceable

DAO for accessing UserPopulation
  • Field Details

  • Constructor Details

  • Method Details

    • initialize

      public void initialize()
      Specified by:
      initialize in interface Initializable
    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • getUserPopulationsAsJson

      public List<Object> getUserPopulationsAsJson(boolean withAdmin)
      Gets all the populations to JSON format
      Parameters:
      withAdmin - True to include the "admin" population
      Returns:
      A list of object representing the UserPopulations
    • getUserPopulationAsJson

      Gets a population to JSON format
      Parameters:
      userPopulation - The user population to get
      Returns:
      An object representing a UserPopulation
    • getUserPopulations

      public List<UserPopulation> getUserPopulations(boolean includeAdminPopulation)
      Gets all the populations of this application
      Parameters:
      includeAdminPopulation - True to include the "admin" population
      Returns:
      A list of UserPopulation
    • getEnabledUserPopulations

      public List<UserPopulation> getEnabledUserPopulations(boolean withAdmin)
      Gets all the enabled populations of this application
      Parameters:
      withAdmin - True to include the "admin" population
      Returns:
      A list of enabled UserPopulation
    • getUserPopulation

      Gets a population with its id.
      Parameters:
      id - The id of the population
      Returns:
      The UserPopulation, or null if not found
    • getUserPopulationsIds

      Gets the list of the ids of all the population of the application
      Returns:
      The list of the ids of all the populations
    • getIgnoredPopulations

      Returns the id of population which have a fatal invalid configuration. These populations can NOT be used by application.
      Returns:
      The ignored populations
    • getMisconfiguredPopulations

      Returns the id of population which have at least one user directory or one credential provider misconfigured These populations can be used by application.
      Returns:
      The misconfigured populations.
    • getConfigurationFile

      Return the configuration file.
      Returns:
      the configuration file.
    • getEditionConfiguration

      Gets the configuration for creating/editing a user population.
      Returns:
      A map containing information about what is needed to create/edit a user population
      Throws:
      Exception - If an error occurs.
    • getPopulationParameterValues

      Gets the values of the parameters of the given population
      Parameters:
      id - The id of the population
      Returns:
      The values of the parameters
    • getAdminPopulation

      Gets the "admin" population
      Returns:
      The "admin" population
    • add

      public Map<String,Object> add(String id, String label, List<Map<String,Object>> userDirectoriesParameters, List<Map<String,Object>> credentialProvidersParameters)
      Adds a new population
      Parameters:
      id - The unique id of the population
      label - The label of the population
      userDirectoriesParameters - A list of user directory parameters
      credentialProvidersParameters - A list of credential provider parameters
      Returns:
      A map containing the id of the created population, or the kind of error that occured
    • edit

      public Map<String,Object> edit(String id, String label, List<Map<String,Object>> userDirectoriesParameters, List<Map<String,Object>> credentialProvidersParameters)
      Edits the given population.
      Parameters:
      id - The id of the population to edit
      label - The label of the population
      userDirectoriesParameters - A list of user directory parameters
      credentialProvidersParameters - A list of credential provider parameters
      Returns:
      A map containing the id of the edited population, or the kind of error that occured
    • remove

      public Map<String,Object> remove(String id)
      Removes the given population.
      Parameters:
      id - The id of the population to remove
      Returns:
      A map containing the id of the removed population
    • remove

      public Map<String,Object> remove(String id, boolean forceDeletion)
      Removes the given population.
      Parameters:
      id - The id of the population to remove
      forceDeletion - Delete the population even if it is still in use
      Returns:
      A map containing the id of the removed population
    • enable

      public Map<String,Object> enable(String populationId, boolean enabled)
      Enables/Disables the given population
      Parameters:
      populationId - The id of the population to enable/disable
      enabled - True to enable the population, false to disable it.
      Returns:
      A map containing the id of the enabled/disabled population, or with an error.
    • isValid

      public boolean isValid(String populationId)
      Determines if a population has a valid configuration
      Parameters:
      populationId - The id of the population to retrieve state
      Returns:
      A map, with the response as a boolean, or an error.
    • isEnabled

      public Map<String,Object> isEnabled(String populationId)
      Returns the enabled state of the given population
      Parameters:
      populationId - The id of the population to retrieve state
      Returns:
      A map, with the response as a booolean, or an error.
    • canRemove

      public Map<String,Object> canRemove(String populationId)
      Determines if a population can be removed
      Parameters:
      populationId - The id of the population
      Returns:
      A map, with the response as a boolean, or an error.
    • dispose

      public void dispose()
      Specified by:
      dispose in interface Disposable