Class ApplicationCenterService
java.lang.Object
org.exoplatform.appcenter.service.ApplicationCenterService
- All Implemented Interfaces:
org.picocontainer.Startable
A Service to access and store applications
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic Stringstatic final Stringstatic Stringstatic final Stringstatic final Stringstatic Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionApplicationCenterService(org.exoplatform.container.configuration.ConfigurationManager configurationManager, ApplicationCenterStorage appCenterStorage, org.exoplatform.commons.api.settings.SettingService settingService, org.exoplatform.services.security.IdentityRegistry identityRegistry, org.exoplatform.services.security.Authenticator authenticator, org.exoplatform.container.PortalContainer container, org.exoplatform.container.xml.InitParams params) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddApplicationPlugin(ApplicationPlugin applicationPlugin) Inject a default application using IOCComponentPluginusing configurationvoidaddFavoriteApplication(long applicationId, String username) Add an application, identified by its technical id, as favorite of a usercreateApplication(Application application) Create new Application that will be available for all users.voiddeleteApplication(Long applicationId, String username) Delete application identified by its id and check if username has permission to delete it.voiddeleteFavoriteApplication(Long applicationId, String username) Deletes an application identified by its id from favorite applications of userfindApplication(long applicationId) Get an application by idgetApplicationImageInputStream(long applicationId, String username) Return theApplicationillustrationInputStream, if not found, the default imageInputStreamwill be retrievedgetApplicationImageLastUpdated(long applicationId, String username) Return theApplicationillustration last modifed timestamp (in ms), if not found, the default image last modifed timestamp will be retrievedgetApplicationsList(int offset, int limit, String keyword) Retrieves the list of applications with offset, limit and a keyword that can be emptygetAuthorizedApplicationsList(int offset, int limit, String keyword, String username) Retrieves the list of applications switch offset and limit of the query, a keyword to filter on title and url ofApplicationand the username to filter on authorized applicationsRetrieves all the list of applications for a userlongbooleanisDefaultSystemApplication(Application application) Checks whether the application is a system application injected by configuration or notvoidremoveApplicationPlugin(String pluginName) Delete an injected plugin identified by its namesetDefaultAppImage(ApplicationImage defaultAppImage) Stores default image for applications not having an attached illustrationvoidsetMaxFavoriteApps(long maxFavoriteApplications) Change general setting for maximum allowed favorites that a user can havevoidstart()A method that will be invoked when the server starts (PortalContainerstarts ) to inject default application and to delete injected default applicationsvoidstop()updateApplication(Application application, String username) Update an existing application on datasource.voidupdateFavoriteApplicationOrder(ApplicationOrder applicationOrder, String userName) Update favorite applications order for a user
-
Field Details
-
DEFAULT_ADMINISTRATORS_GROUP
- See Also:
-
DEFAULT_ADMINISTRATORS_PERMISSION
- See Also:
-
ANY_PERMISSION
- See Also:
-
DEFAULT_USERS_GROUP
- See Also:
-
DEFAULT_USERS_PERMISSION
- See Also:
-
MAX_FAVORITE_APPS
- See Also:
-
DEFAULT_APP_IMAGE_ID
- See Also:
-
DEFAULT_APP_IMAGE_NAME
- See Also:
-
DEFAULT_APP_IMAGE_BODY
- See Also:
-
DEFAULT_LIMIT
public static final int DEFAULT_LIMIT- See Also:
-
LOG_SERVICE_NAME
-
LOG_OPEN_FAVORITE_DRAWER
-
LOG_CLICK_ALL_APPLICATIONS
-
LOG_OPEN_APPLICATION
- See Also:
-
LOG_REORGANIZE_FAVORITES
- See Also:
-
LOG_ADD_FAVORITE
- See Also:
-
LOG_REMOVE_FAVORITE
- See Also:
-
MERGE_MODE
- See Also:
-
-
Constructor Details
-
ApplicationCenterService
public ApplicationCenterService(org.exoplatform.container.configuration.ConfigurationManager configurationManager, ApplicationCenterStorage appCenterStorage, org.exoplatform.commons.api.settings.SettingService settingService, org.exoplatform.services.security.IdentityRegistry identityRegistry, org.exoplatform.services.security.Authenticator authenticator, org.exoplatform.container.PortalContainer container, org.exoplatform.container.xml.InitParams params)
-
-
Method Details
-
start
public void start()A method that will be invoked when the server starts (PortalContainerstarts ) to inject default application and to delete injected default applications- Specified by:
startin interfaceorg.picocontainer.Startable
-
stop
public void stop()- Specified by:
stopin interfaceorg.picocontainer.Startable
-
createApplication
Create new Application that will be available for all users. If the application already exits anApplicationAlreadyExistsExceptionwill be thrown.- Parameters:
application- application to create- Returns:
- stored
Applicationin datasource - Throws:
Exception- when application already exists or an error occurs while creating application or its attached image
-
findApplication
Get an application by id- Parameters:
applicationId- application to find- Returns:
- stored
Applicationin datasource - Throws:
Exception- whenApplicationNotFoundExceptionis thrown or an error occurs while saving application
-
updateApplication
Update an existing application on datasource. If the application doesn't exit anApplicationNotFoundExceptionwill be thrown.- Parameters:
application- dto to update on storeusername- username storing application- Returns:
- stored
Applicationin datasource - Throws:
Exception- whenApplicationNotFoundExceptionis thrown or an error occurs while saving application
-
deleteApplication
public void deleteApplication(Long applicationId, String username) throws ApplicationNotFoundException, IllegalAccessException, org.exoplatform.commons.file.services.FileStorageException Delete application identified by its id and check if username has permission to delete it.- Parameters:
applicationId- technical identifier of applicationusername- user currently deleting application- Throws:
ApplicationNotFoundException- if application wasn't foundIllegalAccessException- if user is not allowed to delete applicationorg.exoplatform.commons.file.services.FileStorageException
-
addFavoriteApplication
public void addFavoriteApplication(long applicationId, String username) throws ApplicationNotFoundException, IllegalAccessException, org.exoplatform.commons.file.services.FileStorageException Add an application, identified by its technical id, as favorite of a user- Parameters:
applicationId- technical application idusername- user login- Throws:
ApplicationNotFoundException- when application is not foundIllegalAccessException- if user hasn't access permission to the applicationorg.exoplatform.commons.file.services.FileStorageException
-
deleteFavoriteApplication
Deletes an application identified by its id from favorite applications of user- Parameters:
applicationId- application technical identifierusername- login of user currently deleting application
-
setMaxFavoriteApps
public void setMaxFavoriteApps(long maxFavoriteApplications) Change general setting for maximum allowed favorites that a user can have- Parameters:
maxFavoriteApplications- max favorite applications count
-
getMaxFavoriteApps
public long getMaxFavoriteApps()- Returns:
- the maximum favorite applications that a user can have as favorite
-
setDefaultAppImage
Stores default image for applications not having an attached illustration- Parameters:
defaultAppImage- image content and name- Returns:
- stored image
- Throws:
Exception- if an exception occurs while storing image into database
-
getAppGeneralSettings
- Returns:
GeneralSettingsof application including default image and maximum favorite applications count- Throws:
Exception- if an exception occurs while retrieving image data from store
-
getApplicationsList
public ApplicationList getApplicationsList(int offset, int limit, String keyword) throws org.exoplatform.commons.file.services.FileStorageException Retrieves the list of applications with offset, limit and a keyword that can be empty- Parameters:
offset- offset of the querylimit- limit of the query that can be less or equal to 0, which mean, getting all available applicationskeyword- used to search in title and url- Returns:
ApplicationListthat contains the list of applications- Throws:
org.exoplatform.commons.file.services.FileStorageException
-
getAuthorizedApplicationsList
public ApplicationList getAuthorizedApplicationsList(int offset, int limit, String keyword, String username) throws org.exoplatform.commons.file.services.FileStorageException Retrieves the list of applications switch offset and limit of the query, a keyword to filter on title and url ofApplicationand the username to filter on authorized applications- Parameters:
offset- offset of the querylimit- limit of the query that can be less or equal to 0, which mean, getting all available applicationskeyword- used to search in title and urlusername- login of user to use to filter on authorized applications- Returns:
ApplicationListthat contains theListof authorizedUserApplication- Throws:
org.exoplatform.commons.file.services.FileStorageException
-
getMandatoryAndFavoriteApplicationsList
Retrieves all the list of applications for a user- Parameters:
username- login of user- Returns:
ApplicationListthat containsListofUserApplication
-
updateFavoriteApplicationOrder
public void updateFavoriteApplicationOrder(ApplicationOrder applicationOrder, String userName) throws ApplicationNotFoundException, org.exoplatform.commons.file.services.FileStorageException Update favorite applications order for a user- Parameters:
applicationOrder-userName-- Throws:
ApplicationNotFoundExceptionorg.exoplatform.commons.file.services.FileStorageException
-
getApplicationImageLastUpdated
public Long getApplicationImageLastUpdated(long applicationId, String username) throws ApplicationNotFoundException, IllegalAccessException, org.exoplatform.commons.file.services.FileStorageException Return theApplicationillustration last modifed timestamp (in ms), if not found, the default image last modifed timestamp will be retrieved- Parameters:
applicationId- technical id of applicationusername- login of user accessing application- Returns:
- timestamp in milliseconds of last modified date of illustration
- Throws:
ApplicationNotFoundException- if application wasn't foundIllegalAccessException- if user doesn't have access permission to applicationorg.exoplatform.commons.file.services.FileStorageException- if an error occurs while accessing file from store
-
getApplicationImageInputStream
public InputStream getApplicationImageInputStream(long applicationId, String username) throws ApplicationNotFoundException, IllegalAccessException, org.exoplatform.commons.file.services.FileStorageException, IOException Return theApplicationillustrationInputStream, if not found, the default imageInputStreamwill be retrieved- Parameters:
applicationId- technical id of applicationusername- login of user accessing application- Returns:
InputStreamof application illustration- Throws:
ApplicationNotFoundException- if application wasn't foundIllegalAccessException- if user doesn't have access permission to applicationorg.exoplatform.commons.file.services.FileStorageException- if an error occurs while accessing file from storeIOException- if an error occurs while buildingInputStream
-
addApplicationPlugin
Inject a default application using IOCComponentPluginusing configuration- Parameters:
applicationPlugin- plugin containing application to inject
-
removeApplicationPlugin
Delete an injected plugin identified by its name- Parameters:
pluginName- plugin name to delete
-
isDefaultSystemApplication
Checks whether the application is a system application injected by configuration or not- Parameters:
application- application to check its state- Returns:
- true if the configuration of the application exists with same title and URL, else false.
-