Class ApplicationManager

java.lang.Object
com.jalios.jcms.application.ApplicationManager
All Implemented Interfaces:
JPropertiesListener

public final class ApplicationManager extends Object implements JPropertiesListener
Manager for Application
Since:
jcms-10.0.3
  • Field Details

  • Method Details

    • getInstance

      public static ApplicationManager getInstance()
    • propertiesChange

      public void propertiesChange(JProperties properties)
      Description copied from interface: JPropertiesListener
      Invoked after properties have been modified in JCMS and save on disk.

      You cannot alter the value received in parameters.

      Note that properties parameter may be null, a limited set of site properties, or all site properties.

      To check that a property has been modified, reload the "current" property instead using channel.getProperties or channel.getProperty.

      Specified by:
      propertiesChange in interface JPropertiesListener
      Parameters:
      properties - the properties which have been submitted to change
    • isDeployApplicationToLauncherRunning

      public boolean isDeployApplicationToLauncherRunning()
    • isDepartmentEnabled

      public boolean isDepartmentEnabled()
    • canUseApplicationLauncher

      public boolean canUseApplicationLauncher(Member mbr)
      Returns true if the given member can use the Application launcher.
      Parameters:
      mbr - the member
      Returns:
      true if the given member can use the application launcher.
      Since:
      jcms-10.0.3
    • canUseApplicationLauncherCatalogAdministration

      public boolean canUseApplicationLauncherCatalogAdministration(Member mbr)
      Returns true if the given member can use the Application launcher catalog administration.
      Parameters:
      mbr - the member
      Returns:
      true if the given member can use the Application launcher catalog administration.
      Since:
      jcms-10.0.4
    • isApplicationInstalled

      public boolean isApplicationInstalled(AbstractShortcut shortcut, Member mbr)
      Parameters:
      shortcut - the AbstractShortcut
      mbr - the Member
      Returns:
      true if application is installed for given member
      Since:
      jcms-10.0.3
    • canRecomputeInstallCountCache

      public boolean canRecomputeInstallCountCache(Member mbr)
      Parameters:
      mbr - the Member
      Returns:
      true if given member can recompute the install count cache
      Since:
      jcms-10.0.3
    • canAdministrateApplications

      public boolean canAdministrateApplications(Member mbr)
      Parameters:
      mbr - the Member
      Returns:
      true if given member can administrate applications (Launcher / Reset / Recompute)
      Since:
      jcms-10.0.6
    • getTypeRoot

      public Category getTypeRoot()
      Returns:
      the type root of Applications
      Since:
      jcms-10.0.3
    • recomputeInstallCountCache

      public void recomputeInstallCountCache()
      Recomputes the install count cache asynchronously
      Since:
      jcms-10.0.3
    • isInstallCountInitialized

      public boolean isInstallCountInitialized()
      Returns:
      true if install count is initialized
      Since:
      jcms-10.0.3
    • getAverageInstallCount

      public int getAverageInstallCount()
      Returns:
      the average install count per user
      Since:
      jcms-10.0.3
    • getInstallCount

      public int getInstallCount(Application application)
      Parameters:
      application - the Application
      Returns:
      the install count for given application
      Since:
      jcms-10.0.3
    • getTotalInstallCount

      public int getTotalInstallCount()
      Returns:
      the total count of installed applications
      Since:
      jcms-10.0.3
    • getDepartmentShortcutIds

      public Set<String> getDepartmentShortcutIds(Group department)
      Parameters:
      department - the organization department
      Returns:
      the set of AbstractShortcut of given department
      Since:
      jcms-10.0.3
    • getInstallOrganizationGroupCount

      public int getInstallOrganizationGroupCount(Application application, Member mbr)
      Parameters:
      application - the Application
      mbr - the Member
      Returns:
      the install count for given application in given Member department
    • getApplicationLauncherOrigin

      public ApplicationManager.ApplicationLauncherOrigin getApplicationLauncherOrigin(Member member)
      Returns an object containing the launcher (By also checking for the customized launcher of user), and the launcher origin (Default, custom or department)
      Parameters:
      member - the Member to audit
      Returns:
      ApplicationManager.ApplicationLauncherOrigin
      Since:
      jcms-10.0.8
    • getDefaultApplicationLauncherOrigin

      public ApplicationManager.ApplicationLauncherOrigin getDefaultApplicationLauncherOrigin(Member member)
      Returns an object containing the launcher, and the launcher origin (Default or department)
      Parameters:
      member - the Member to audit
      Returns:
      ApplicationManager.ApplicationLauncherOrigin
      Since:
      jcms-10.0.8
    • getDefaultApplicationLauncher

      public ApplicationLauncher getDefaultApplicationLauncher()
      Returns:
      the default ApplicationLauncher
      Since:
      jcms-10.0.3
    • saveDefaultApplicationLauncher

      public boolean saveDefaultApplicationLauncher(Group department, String data)
      Saves json data as default json launcher for the given department
      Parameters:
      department - the Group representing a department
      data - the json data
      Returns:
      true if save has succeed
      Since:
      jcms-10.0.3
    • hasCustomApplicationLauncher

      public boolean hasCustomApplicationLauncher(Group department)
      Check if a department has a custom launcher
      Parameters:
      department -
      Returns:
      true if the department has a custom Launcher
    • getDefaultApplicationLauncher

      public ApplicationLauncher getDefaultApplicationLauncher(Group department)
      Parameters:
      department - the Group representing department
      Returns:
      the default ApplicationLauncher for given department
      Since:
      jcms-10.0.3
    • getDefaultApplicationLauncherGroup

      public Group getDefaultApplicationLauncherGroup(Group department)
    • hasDefaultApplicationLauncher

      public boolean hasDefaultApplicationLauncher(Group department)
      Returns true if given department has a default launcher
      Parameters:
      department - the Group
      Returns:
      true if given department has a default launcher
      Since:
      jcms-10.0.3
    • getDefaultApplicationLauncherAsJson

      public String getDefaultApplicationLauncherAsJson()
      Returns:
      the default application launcher as Json
      Since:
      jcms-10.0.3
    • getEmptyApplicationLauncher

      public ApplicationLauncher getEmptyApplicationLauncher()
      Returns:
      an empty ApplicationLauncher with a tab
      Since:
      jcms-10.0.3
    • hasPersonalizedLauncher

      public boolean hasPersonalizedLauncher(Member member)
    • getApplicationLauncher

      public ApplicationLauncher getApplicationLauncher(Member mbr)
      Returns the application launcher for given member by searching for his saved launcher, or by searching in its department default launcher, or the global default launcher
      Parameters:
      mbr - the Member
      Returns:
      an ApplicationLauncher
      Since:
      jcms-10.0.3
    • getApplicationLauncherAsJson

      public String getApplicationLauncherAsJson(ApplicationLauncher launcher)
      Transforms an application launcher into json
      Parameters:
      launcher - the ApplicationLauncher
      Returns:
      a json representing the ApplicationLauncher
      Since:
      jcms-10.0.3
    • getCleanedApplicationLauncherAsJson

      public String getCleanedApplicationLauncherAsJson(ApplicationLauncher launcher)
      Transforms an application launcher into json to save in the database
      Parameters:
      launcher - the ApplicationLauncher
      Returns:
      a json representing the ApplicationLauncher to be saved in the database
      Since:
      jcms-10.0.6
    • getApplicationLauncherAsJson

      public String getApplicationLauncherAsJson(Member mbr)
      Parameters:
      mbr - the Member
      Returns:
      the application launcher for given Member as json
      Since:
      jcms-10.0.3
    • getTabs

      public List<ApplicationLauncherTab> getTabs(Member mbr)
      Parameters:
      mbr - the Member
      Returns:
      the List of ApplicationLauncherTab for given member
      Since:
      jcms-10.0.3
    • addApplication

      @Deprecated public boolean addApplication(Member mbr, int tabIndex, String shortcutId)
      Deprecated.
      use addApplication(Member, String, Shortcut, boolean, boolean) since it returns a ControllerStatus
      Adds an application (shortcutId) in given tab for given member
      Parameters:
      mbr - the Member
      tabIndex - the tab index
      shortcutId - the AbstractShortcut id
      Returns:
      true if adding the application has succeed
      Since:
      jcms-10.0.3
    • getOrAddTab

      public ApplicationLauncherTab getOrAddTab(Member mbr, ApplicationLauncher applicationLauncher, String tabName)
      Returns a tab by either finding it in the given launcher by its name, or by creating a new one if not found
      Parameters:
      mbr - the Member to update the launcher
      applicationLauncher - the ApplicationLauncher
      tabName - the name of the tab
      Returns:
      an ApplicationLauncherTab
      Since:
      10.0.6
    • waitForAddingAllApplications

      public static void waitForAddingAllApplications()
      A convenient method for unit test to wait for the ending of the add application thread. This method is not thread safe (it only wait for the last sending thread).
      Since:
      jcms-10.0.6
    • addApplication

      public ControllerStatus addApplication(Member mbr, String tabName, generated.Shortcut application, boolean checkAlreadyInstalled, boolean sendAlert)
      Returns a ControllerStatus as a result of the action which adds the given application to the member's shortcut in given tab
      Parameters:
      mbr - the Member to search for a matching launcher
      tabName - the tab name where the application will be added (If not available, a new tab will be created)
      application - a Shortcut
      checkAlreadyInstalled - to prevent action to be performed if app is already installed
      sendAlert - to send an alert informing the user an app has been installed
      Returns:
      a ControllerStatus as a result of the operation
      Since:
      10.0.6
    • getTabByName

      public ApplicationLauncherTab getTabByName(ApplicationLauncher applicationLauncher, String tabName)
      Returns a tab by searching by its name in given application launcher
      Parameters:
      applicationLauncher - the ApplicationLauncher
      tabName - the name of the tab
      Returns:
      an ApplicationLauncherTab
      Since:
      10.0.6
    • removeApplication

      public boolean removeApplication(Member mbr, int tabIndex, String shortcutId)
      Removes an application (shortcutId) in given tab for given member
      Parameters:
      mbr - the Member
      tabIndex - the tab index
      shortcutId - the AbstractShortcut id
      Returns:
      true if removing the application has succeed
      Since:
      jcms-10.0.3
    • removeApplicationOnAllTabs

      public boolean removeApplicationOnAllTabs(Member mbr, String shortcutId)
      Remove an application (shortcutId) on all member tabs
      Parameters:
      mbr - Member
      shortcutId - the AbstractShortcut id
      Returns:
      true if the app was remove on all tabs
    • isApplicationAlreadyInTab

      public boolean isApplicationAlreadyInTab(Member mbr, int tabIndex, String shortcutId)
      Checks if application is already installed in given tab index
      Parameters:
      mbr - the Member
      tabIndex - the tab index
      shortcutId - the AbstractShortcut id
      Returns:
      true if application is already installed in tab
      Since:
      jcms-10.0.3
    • getInstalledApplications

      public List<Application> getInstalledApplications(Member mbr)
      Parameters:
      mbr - the Member
      Returns:
      ApplicationManager.InstalledApplications for given Member
      Since:
      jcms-10.0.3
    • getAlreadyInstalledTabsMap

      public ApplicationManager.InstalledApplications getAlreadyInstalledTabsMap(Member mbr)
    • getResetApplicationLauncherProcess

      public ApplicationResetProcess getResetApplicationLauncherProcess(Collection<Member> members, Collection<Group> groups)
      Parameters:
      members -
      groups -
      Returns:
    • addMembersFromGroups

      public void addMembersFromGroups(Set<Member> mbrSet, Collection<Group> groups)
    • resetDefaultApplicationLauncher

      public void resetDefaultApplicationLauncher(Group department)