Package io.meeds.appcenter.service
Class ApplicationCenterService
java.lang.Object
io.meeds.appcenter.service.ApplicationCenterService
A Service to access and store applications
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFavoriteApplication(long applicationId, String username) Add an application, identified by its technical id, as favorite of a userbooleancanAccess(Application application, String username) booleancreateApplication(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 usergetActiveApplications(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 applicationsgetActiveApplications(int offset, int limit, String keyword, Locale locale, 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 applicationsgetApplication(long applicationId) Get an application by idgetApplicationImageInputStream(long applicationId) Return theApplicationillustrationInputStream, if not found, the default imageInputStreamwill be retrievedgetApplicationImageInputStream(long applicationId, String dimensions) Return theApplicationillustrationInputStream, if not found, the default imageInputStreamwill be retrievedgetApplicationImageLastUpdated(long applicationId) 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 emptygetApplications(int offset, int limit, String keyword, Locale locale) Retrieves the list of applications with offset, limit and a keyword that can be emptygetApplicationShortcuts(String username) getMandatoryAndFavoriteApplications(org.springframework.data.domain.Pageable pageable, String username, Locale locale) voidupdateApplication(Application application) voidupdateApplication(Application application, String username) Update an existing application on datasource.voidupdateFavoriteApplicationOrder(ApplicationOrder applicationOrder, String userName) Update favorite applications order for a user
-
Field Details
-
ANY_PERMISSION
- See Also:
-
DEFAULT_USERS_GROUP
- See Also:
-
DEFAULT_USERS_PERMISSION
- See Also:
-
MAX_FAVORITE_APPS
- 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 IllegalAccessException Create new Application that will be available for all users.- Parameters:
application- application to createusername- user making the operation- Returns:
- stored
Applicationin datasource - Throws:
IllegalAccessException- if user is not allowed to create an application
-
createApplication
Create new Application that will be available for all users.- Parameters:
application- application to create- Returns:
- stored
Applicationin datasource
-
getApplication
Get an application by id- Parameters:
applicationId- application to find- Returns:
- stored
Applicationin datasource
-
findSystemApplicationByUrl
-
updateApplication
public void 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- Throws:
IllegalAccessException- if user is not allowed to update applicationApplicationNotFoundException- if application wasn't found
-
updateApplication
-
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
-
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
-
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 urllocale- used language to retrieve application title and description- Returns:
ApplicationListthat contains the list of applications
-
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
-
getActiveApplications
public ApplicationList getActiveApplications(int offset, int limit, String keyword, Locale locale, 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
-
updateFavoriteApplicationOrder
public void updateFavoriteApplicationOrder(ApplicationOrder applicationOrder, String userName) throws ApplicationNotFoundException Update favorite applications order for a user- Parameters:
applicationOrder-userName-- Throws:
ApplicationNotFoundException
-
getApplicationImageLastUpdated
Return theApplicationillustration last modifed timestamp (in ms), if not found, the default image last modifed timestamp will be retrieved- Parameters:
applicationId- technical id of application- Returns:
- timestamp in milliseconds of last modified date of illustration
- Throws:
ApplicationNotFoundException- if application wasn't found
-
getApplicationImageInputStream
public InputStream getApplicationImageInputStream(long applicationId) throws ApplicationNotFoundException Return theApplicationillustrationInputStream, if not found, the default imageInputStreamwill be retrieved- Parameters:
applicationId- technical id of application- Returns:
InputStreamof application illustration- Throws:
ApplicationNotFoundException- if application wasn't found
-
getApplicationImageInputStream
public InputStream getApplicationImageInputStream(long applicationId, String dimensions) throws ApplicationNotFoundException Return theApplicationillustrationInputStream, if not found, the default imageInputStreamwill be retrieved- Parameters:
applicationId- technical id of applicationdimensions- Image dimensions to retrieve- Returns:
InputStreamof application illustration- Throws:
ApplicationNotFoundException- if application wasn't found
-
getSystemApplications
-
getCategoryIds
-
getMandatoryAndFavoriteApplications
public ApplicationList getMandatoryAndFavoriteApplications(org.springframework.data.domain.Pageable pageable, String username, Locale locale) -
getApplicationShortcuts
-
canAccess
-
canEdit
-