Class AppModuleService

java.lang.Object
java.util.Observable
org.eblocker.server.http.service.AppModuleService

public class AppModuleService extends Observable
  • Field Details

  • Constructor Details

    • AppModuleService

      @Inject public AppModuleService(DataSource dataSource, com.fasterxml.jackson.databind.ObjectMapper objectMapper, AppModuleRemovalMessageProvider appModuleRemovalMessageProvider, String appModulesFilePath, int tempAppModuleId, int standardAppModuleId, int userAppModuleId, int autoTrustAppModuleId)
  • Method Details

    • init

      public void init()
    • getUpdater

      public Runnable getUpdater()
    • getTempAppModuleId

      public int getTempAppModuleId()
    • getStandardAppModuleId

      public int getStandardAppModuleId()
    • getUserAppModuleId

      public int getUserAppModuleId()
    • getAutoSslAppModule

      public AppWhitelistModule getAutoSslAppModule()
    • getAll

      public List<AppWhitelistModule> getAll()
      Load all app modules from database.
    • get

      public AppWhitelistModule get(int id)
    • save

      public AppWhitelistModule save(AppWhitelistModule module)
      Save a new user-defined module. The module's ID must be null.
      Parameters:
      module - to save. Note: the module is enabled automatically
      Returns:
    • update

      public AppWhitelistModule update(AppWhitelistModule module, int id)
      Update an existing module.
      Parameters:
      module - the module to update. Note: the enabled state is not updated.
      id - the module's ID
      Returns:
    • restoreModified

      public void restoreModified(List<AppWhitelistModule> modules, Map<Integer,Boolean> enabledStates)
      Restore all modules that the user has modified or created, for example from a backup. Also restore the enabled states given in the map.
      Parameters:
      modules - the modules that the user has modified or created
      enabledStates - the enabled states of all modules
    • isUniqueCustomerCreatedName

      public boolean isUniqueCustomerCreatedName(Integer id, String name)
      Checks if module name is unique among customer created modules.

      Please note that customer created modules may have the same name as builtin ones.

      Parameters:
      id - id of module if it is a already persistent (may be null)
      name - name of module
      Returns:
      if module name is unique among customer created modules.
    • delete

      public void delete(int id)
    • storeAndActivateEnabledState

      public void storeAndActivateEnabledState(int id, boolean enabled)
    • activateEnabledState

      public void activateEnabledState(AppWhitelistModule module)
    • activateEnabledState

      public void activateEnabledState(List<AppWhitelistModule> modules)
    • getAllUrlsFromEnabledModules

      public List<String> getAllUrlsFromEnabledModules()
      Get all URLs from all enabled AppWhitelistModules
    • getBlacklistedDomains

      public List<String> getBlacklistedDomains()
    • getAllIPsFromEnabledModules

      public List<String> getAllIPsFromEnabledModules()
      Get all IPs from all enabled AppWhitelistModules
    • deleteBuiltinModule

      public void deleteBuiltinModule(AppWhitelistModule module)
    • addDomainToModule

      public void addDomainToModule(String domain, String name, int id)
    • removeDomainFromModule

      public void removeDomainFromModule(String domain, int id)
    • addDomainsToModule

      public void addDomainsToModule(List<SSLWhitelistUrl> domainsToAdd, int id)
    • removeDomainsFromModule

      public void removeDomainsFromModule(List<SSLWhitelistUrl> domainsToRemove, int id)