Package com.jalios.jcms.application
Class ApplicationManager
- java.lang.Object
 - 
- com.jalios.jcms.application.ApplicationManager
 
 
- 
- All Implemented Interfaces:
 JPropertiesListener
public final class ApplicationManager extends java.lang.Object implements JPropertiesListener
Manager for Application- Since:
 - jcms-10.0.3
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description classApplicationManager.InstalledApplicationsA POJO class representing installed applications with utility methods 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringACL_CAN_USE_APPLICATION_LAUNCHERstatic java.lang.StringACL_CAN_USE_APPLICATION_LAUNCHER_CATALOG_ADMINISTRATIONstatic java.lang.StringADMIN_ALERT_DOMAINstatic java.lang.StringALERT_DOMAINstatic java.lang.StringDEPLOY_ALERT_NAMEstatic java.lang.StringINSTALL_RECOMPUTE_ALARMstatic java.lang.StringINSTALL_RECOMPUTE_DEFAULT_SCHEDULEstatic java.lang.StringINSTALL_RECOMPUTE_SCHEDULE_PROPprotected static java.lang.ThreadlastAddApplicationThreadstatic java.lang.StringMBR_PREFstatic java.lang.StringSHORTCUT_TYPE_CATEGORY_VID- 
Fields inherited from interface com.jalios.util.JPropertiesListener
REVISION 
 - 
 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanaddApplication(Member mbr, int tabIndex, java.lang.String shortcutId)Deprecated.useaddApplication(Member, String, Shortcut, boolean, boolean)since it returns a ControllerStatusControllerStatusaddApplication(Member mbr, java.lang.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 tabControllerStatusaddApplication(Member mbr, java.util.Collection<Group> groups, java.util.Collection<Member> members, java.lang.String tabName, generated.Shortcut application)Returns a controller status as a result of the action that will : - Launch a new thread to retrieve all members from provided groups - Install the app in a new thread for each member - Create a tab if there's no matching tab in case tab name has been provided - Will send an alert telling the user an app has been installed - At the end of all threads, the author of the action will receive an alertbooleancanAdministrateApplications(Member mbr)booleancanRecomputeInstallCountCache(Member mbr)booleancanUseApplicationLauncher(Member mbr)Returns true if the given member can use the Application launcher.booleancanUseApplicationLauncherCatalogAdministration(Member mbr)Returns true if the given member can use the Application launcher catalog administration.ApplicationManager.InstalledApplicationsgetAlreadyInstalledTabsMap(Member mbr)ApplicationLaunchergetApplicationLauncher(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 launcherjava.lang.StringgetApplicationLauncherAsJson(ApplicationLauncher launcher)Transforms an application launcher into jsonjava.lang.StringgetApplicationLauncherAsJson(Member mbr)intgetAverageInstallCount()java.lang.StringgetCleanedApplicationLauncherAsJson(ApplicationLauncher launcher)Transforms an application launcher into json to save in the databaseApplicationLaunchergetDefaultApplicationLauncher()ApplicationLaunchergetDefaultApplicationLauncher(Group department)java.lang.StringgetDefaultApplicationLauncherAsJson()GroupgetDefaultApplicationLauncherGroup(Group department)java.util.Set<java.lang.String>getDepartmentShortcutIds(Group department)ApplicationLaunchergetEmptyApplicationLauncher()intgetInstallCount(Application application)java.util.List<Application>getInstalledApplications(Member mbr)intgetInstallOrganizationGroupCount(Application application, Member mbr)static ApplicationManagergetInstance()ApplicationLauncherTabgetOrAddTab(Member mbr, ApplicationLauncher applicationLauncher, java.lang.String tabName)Returns a tab by either finding it in the given launcher by its name, or by creating a new one if not foundApplicationLauncherTabgetTabByName(ApplicationLauncher applicationLauncher, java.lang.String tabName)Returns a tab by searching by its name in given application launcherjava.util.List<ApplicationLauncherTab>getTabs(Member mbr)intgetTotalInstallCount()CategorygetTypeRoot()booleanhasCustomApplicationLauncher(Group department)Check if a department has a custom launcherbooleanhasDefaultApplicationLauncher(Group department)Returns true if given department has a default launcherbooleanisApplicationAlreadyInTab(Member mbr, int tabIndex, java.lang.String shortcutId)Checks if application is already installed in given tab indexbooleanisApplicationInstalled(AbstractShortcut shortcut, Member mbr)booleanisDepartmentEnabled()booleanisDeployApplicationToLauncherRunning()booleanisInstallCountInitialized()booleanisResetApplicationLauncherRunning()voidpropertiesChange(JProperties properties)Invoked after properties have been modified in JCMS and save on disk.voidrecomputeInstallCountCache()Recomputes the install count cache asynchronouslybooleanremoveApplication(Member mbr, int tabIndex, java.lang.String shortcutId)Removes an application (shortcutId) in given tab for given memberbooleanremoveApplicationOnAllTabs(Member mbr, java.lang.String shortcutId)Remove an application (shortcutId) on all member tabsvoidresetApplicationLauncher(java.util.Collection<Member> members, java.util.Collection<Group> groups)Deletes saved launcher for given member and groupsvoidresetDefaultApplicationLauncher(Group department)booleansaveDefaultApplicationLauncher(Group department, java.lang.String data)Saves json data as default json launcher for the given departmentstatic voidwaitForAddingAllApplications()A convenient method for unit test to wait for the ending of the add application thread. 
 - 
 
- 
- 
Field Detail
- 
SHORTCUT_TYPE_CATEGORY_VID
public static final java.lang.String SHORTCUT_TYPE_CATEGORY_VID
- See Also:
 - Constant Field Values
 
 
- 
MBR_PREF
public static final java.lang.String MBR_PREF
- See Also:
 - Constant Field Values
 
 
- 
INSTALL_RECOMPUTE_SCHEDULE_PROP
public static final java.lang.String INSTALL_RECOMPUTE_SCHEDULE_PROP
- See Also:
 - Constant Field Values
 
 
- 
INSTALL_RECOMPUTE_DEFAULT_SCHEDULE
public static final java.lang.String INSTALL_RECOMPUTE_DEFAULT_SCHEDULE
- See Also:
 - Constant Field Values
 
 
- 
INSTALL_RECOMPUTE_ALARM
public static final java.lang.String INSTALL_RECOMPUTE_ALARM
- See Also:
 - Constant Field Values
 
 
- 
DEPLOY_ALERT_NAME
public static final java.lang.String DEPLOY_ALERT_NAME
- See Also:
 - Constant Field Values
 
 
- 
ALERT_DOMAIN
public static final java.lang.String ALERT_DOMAIN
- See Also:
 - Constant Field Values
 
 
- 
ADMIN_ALERT_DOMAIN
public static final java.lang.String ADMIN_ALERT_DOMAIN
- See Also:
 - Constant Field Values
 
 
- 
ACL_CAN_USE_APPLICATION_LAUNCHER
public static final java.lang.String ACL_CAN_USE_APPLICATION_LAUNCHER
- See Also:
 - Constant Field Values
 
 
- 
ACL_CAN_USE_APPLICATION_LAUNCHER_CATALOG_ADMINISTRATION
public static final java.lang.String ACL_CAN_USE_APPLICATION_LAUNCHER_CATALOG_ADMINISTRATION
- See Also:
 - Constant Field Values
 
 
- 
lastAddApplicationThread
protected static java.lang.Thread lastAddApplicationThread
 
 - 
 
- 
Method Detail
- 
getInstance
public static ApplicationManager getInstance()
 
- 
propertiesChange
public void propertiesChange(JProperties properties)
Description copied from interface:JPropertiesListenerInvoked 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.getPropertiesorchannel.getProperty.- Specified by:
 propertiesChangein interfaceJPropertiesListener- Parameters:
 properties- the properties which have been submitted to change
 
- 
isResetApplicationLauncherRunning
public boolean isResetApplicationLauncherRunning()
 
- 
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- theAbstractShortcutmbr- theMember- Returns:
 - true if application is installed for given member
 - Since:
 - jcms-10.0.3
 
 
- 
canRecomputeInstallCountCache
public boolean canRecomputeInstallCountCache(Member mbr)
- Parameters:
 mbr- theMember- Returns:
 - true if given member can recompute the install count cache
 - Since:
 - jcms-10.0.3
 
 
- 
canAdministrateApplications
public boolean canAdministrateApplications(Member mbr)
- Parameters:
 mbr- theMember- 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- theApplication- 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 java.util.Set<java.lang.String> getDepartmentShortcutIds(Group department)
- Parameters:
 department- the organization department- Returns:
 - the set of 
AbstractShortcutof given department - Since:
 - jcms-10.0.3
 
 
- 
getInstallOrganizationGroupCount
public int getInstallOrganizationGroupCount(Application application, Member mbr)
- Parameters:
 application- theApplicationmbr- theMember- Returns:
 - the install count for given application in given Member department
 
 
- 
getDefaultApplicationLauncher
public ApplicationLauncher getDefaultApplicationLauncher()
- Returns:
 - the default 
ApplicationLauncher - Since:
 - jcms-10.0.3
 
 
- 
saveDefaultApplicationLauncher
public boolean saveDefaultApplicationLauncher(Group department, java.lang.String data)
Saves json data as default json launcher for the given department- Parameters:
 department- theGrouprepresenting a departmentdata- 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- theGrouprepresenting department- Returns:
 - the default 
ApplicationLauncherfor 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- theGroup- Returns:
 - true if given department has a default launcher
 - Since:
 - jcms-10.0.3
 
 
- 
getDefaultApplicationLauncherAsJson
public java.lang.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
 
 
- 
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- theMember- Returns:
 - an 
ApplicationLauncher - Since:
 - jcms-10.0.3
 
 
- 
getApplicationLauncherAsJson
public java.lang.String getApplicationLauncherAsJson(ApplicationLauncher launcher)
Transforms an application launcher into json- Parameters:
 launcher- theApplicationLauncher- Returns:
 - a json representing the 
ApplicationLauncher - Since:
 - jcms-10.0.3
 
 
- 
getCleanedApplicationLauncherAsJson
public java.lang.String getCleanedApplicationLauncherAsJson(ApplicationLauncher launcher)
Transforms an application launcher into json to save in the database- Parameters:
 launcher- theApplicationLauncher- Returns:
 - a json representing the 
ApplicationLauncherto be saved in the database - Since:
 - jcms-10.0.6
 
 
- 
getApplicationLauncherAsJson
public java.lang.String getApplicationLauncherAsJson(Member mbr)
- Parameters:
 mbr- theMember- Returns:
 - the application launcher for given Member as json
 - Since:
 - jcms-10.0.3
 
 
- 
getTabs
public java.util.List<ApplicationLauncherTab> getTabs(Member mbr)
- Parameters:
 mbr- theMember- Returns:
 - the List of 
ApplicationLauncherTabfor given member - Since:
 - jcms-10.0.3
 
 
- 
addApplication
@Deprecated public boolean addApplication(Member mbr, int tabIndex, java.lang.String shortcutId)
Deprecated.useaddApplication(Member, String, Shortcut, boolean, boolean)since it returns a ControllerStatusAdds an application (shortcutId) in given tab for given member- Parameters:
 mbr- theMembertabIndex- the tab indexshortcutId- theAbstractShortcutid- Returns:
 - true if adding the application has succeed
 - Since:
 - jcms-10.0.3
 
 
- 
getOrAddTab
public ApplicationLauncherTab getOrAddTab(Member mbr, ApplicationLauncher applicationLauncher, java.lang.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- theMemberto update the launcherapplicationLauncher- theApplicationLaunchertabName- the name of the tab- Returns:
 - an 
ApplicationLauncherTab - Since:
 - 10.0.6
 
 
- 
addApplication
public ControllerStatus addApplication(Member mbr, java.util.Collection<Group> groups, java.util.Collection<Member> members, java.lang.String tabName, generated.Shortcut application)
Returns a controller status as a result of the action that will : - Launch a new thread to retrieve all members from provided groups - Install the app in a new thread for each member - Create a tab if there's no matching tab in case tab name has been provided - Will send an alert telling the user an app has been installed - At the end of all threads, the author of the action will receive an alert- Parameters:
 mbr- theMemberwhich performs the actiongroups- a collection ofGroupmembers- a colletion ofMembertabName- the tab name where the application will be installed (If empty, first tab will be used). If user doesn't have any tab by this name, a new one will be created.application- theShortcutto install- Returns:
 - a ControllerStatus as a result of adding the app to multiple users
 - 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, java.lang.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- theMemberto search for a matching launchertabName- the tab name where the application will be added (If not available, a new tab will be created)application- aShortcutcheckAlreadyInstalled- to prevent action to be performed if app is already installedsendAlert- to send an alert informing the user an app has been installed- Returns:
 - a 
ControllerStatusas a result of the operation - Since:
 - 10.0.6
 
 
- 
getTabByName
public ApplicationLauncherTab getTabByName(ApplicationLauncher applicationLauncher, java.lang.String tabName)
Returns a tab by searching by its name in given application launcher- Parameters:
 applicationLauncher- theApplicationLaunchertabName- the name of the tab- Returns:
 - an 
ApplicationLauncherTab - Since:
 - 10.0.6
 
 
- 
removeApplication
public boolean removeApplication(Member mbr, int tabIndex, java.lang.String shortcutId)
Removes an application (shortcutId) in given tab for given member- Parameters:
 mbr- theMembertabIndex- the tab indexshortcutId- theAbstractShortcutid- Returns:
 - true if removing the application has succeed
 - Since:
 - jcms-10.0.3
 
 
- 
removeApplicationOnAllTabs
public boolean removeApplicationOnAllTabs(Member mbr, java.lang.String shortcutId)
Remove an application (shortcutId) on all member tabs- Parameters:
 mbr-MembershortcutId- theAbstractShortcutid- Returns:
 - true if the app was remove on all tabs
 
 
- 
isApplicationAlreadyInTab
public boolean isApplicationAlreadyInTab(Member mbr, int tabIndex, java.lang.String shortcutId)
Checks if application is already installed in given tab index- Parameters:
 mbr- theMembertabIndex- the tab indexshortcutId- theAbstractShortcutid- Returns:
 - true if application is already installed in tab
 - Since:
 - jcms-10.0.3
 
 
- 
getInstalledApplications
public java.util.List<Application> getInstalledApplications(Member mbr)
- Parameters:
 mbr- theMember- Returns:
 ApplicationManager.InstalledApplicationsfor givenMember- Since:
 - jcms-10.0.3
 
 
- 
getAlreadyInstalledTabsMap
public ApplicationManager.InstalledApplications getAlreadyInstalledTabsMap(Member mbr)
 
- 
resetApplicationLauncher
public void resetApplicationLauncher(java.util.Collection<Member> members, java.util.Collection<Group> groups)
Deletes saved launcher for given member and groups 
- 
resetDefaultApplicationLauncher
public void resetDefaultApplicationLauncher(Group department)
 
 - 
 
 -