Package io.meeds.appcenter.service
Class ApplicationCenterService
java.lang.Object
io.meeds.appcenter.service.ApplicationCenterService
A Service to access and store applications
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final org.exoplatform.commons.api.settings.data.Contextstatic final org.exoplatform.commons.api.settings.data.Scopestatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFavoriteApplication(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.createApplication(Application application, String username) Create new Application that will be available for all users.voiddeleteApplication(Long applicationId) 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 idgetActiveApplications(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 applicationsgetApplicationByTitle(String title) getApplicationImageInputStream(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 retrievedgetApplications(int offset, int limit, String keyword) Retrieves the list of applications with offset, limit and a keyword that can be emptyorg.exoplatform.services.security.IdentityRegistrygetMandatoryAndFavoriteApplications(String username, org.springframework.data.domain.Pageable pageable) Retrieves all the list of applications for a userlongsetDefaultAppImage(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 haveupdateApplication(Application application) 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:
-
APP_CENTER_CONTEXT
public static final org.exoplatform.commons.api.settings.data.Context APP_CENTER_CONTEXT -
APP_CENTER_SCOPE
public static final org.exoplatform.commons.api.settings.data.Scope APP_CENTER_SCOPE
-
-
Constructor Details
-
ApplicationCenterService
public ApplicationCenterService()
-
-
Method Details
-
createApplication
public Application createApplication(Application application, String username) throws ApplicationAlreadyExistsException, IllegalAccessException Create new Application that will be available for all users. If the application already exits anApplicationAlreadyExistsExceptionwill be thrown.- Parameters:
application- application to createusername- user making the operation- Returns:
- stored
Applicationin datasource - Throws:
ApplicationAlreadyExistsException- when application already existsIllegalAccessException- if user is not allowed to create an application
-
createApplication
public Application createApplication(Application application) throws ApplicationAlreadyExistsException 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:
ApplicationAlreadyExistsException- when application already exists
-
findApplication
Get an application by id- Parameters:
applicationId- application to find- Returns:
- stored
Applicationin datasource - Throws:
ApplicationNotFoundException- when application doesn't exists
-
updateApplication
public Application updateApplication(Application application, String username) throws IllegalAccessException, ApplicationNotFoundException 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:
IllegalAccessException- if user is not allowed to update applicationApplicationNotFoundException- if application wasn't found
-
updateApplication
- Throws:
ApplicationNotFoundException
-
deleteApplication
public void deleteApplication(Long applicationId, String username) throws ApplicationNotFoundException, IllegalAccessException 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:
IllegalAccessException- if user is not allowed to delete applicationApplicationNotFoundException- if application wasn't found
-
deleteApplication
- Throws:
ApplicationNotFoundException
-
addFavoriteApplication
public void addFavoriteApplication(long applicationId, String username) throws ApplicationNotFoundException, IllegalAccessException 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 application
-
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
-
getSettings
- Returns:
GeneralSettingsof application including default image and maximum favorite applications count
-
getApplications
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
-
getApplicationByTitle
-
getActiveApplications
public ApplicationList getActiveApplications(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 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
-
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 Update favorite applications order for a user- Parameters:
applicationOrder-userName-- Throws:
ApplicationNotFoundException
-
getApplicationImageLastUpdated
public Long getApplicationImageLastUpdated(long applicationId, String username) throws ApplicationNotFoundException, IllegalAccessException 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 application
-
getApplicationImageInputStream
public InputStream getApplicationImageInputStream(long applicationId, String username) throws ApplicationNotFoundException, IllegalAccessException 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 application
-
getSystemApplications
-
getMandatoryAndFavoriteApplications
public ApplicationList getMandatoryAndFavoriteApplications(String username, org.springframework.data.domain.Pageable pageable) -
getIdentityRegistry
public org.exoplatform.services.security.IdentityRegistry getIdentityRegistry()
-