Class ApplicationCenterService

java.lang.Object
io.meeds.appcenter.service.ApplicationCenterService

@Service public class ApplicationCenterService extends Object
A Service to access and store applications
  • Field Details

    • ANY_PERMISSION

      public static final String ANY_PERMISSION
      See Also:
    • DEFAULT_USERS_GROUP

      public static final String DEFAULT_USERS_GROUP
      See Also:
    • DEFAULT_USERS_PERMISSION

      public static final String DEFAULT_USERS_PERMISSION
      See Also:
    • MAX_FAVORITE_APPS

      public static final String MAX_FAVORITE_APPS
      See Also:
    • DEFAULT_APP_IMAGE_NAME

      public static final String DEFAULT_APP_IMAGE_NAME
      See Also:
    • DEFAULT_APP_IMAGE_BODY

      public static final String 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 create
      username - user making the operation
      Returns:
      stored Application in datasource
      Throws:
      IllegalAccessException - if user is not allowed to create an application
    • createApplication

      public Application createApplication(Application application)
      Create new Application that will be available for all users.
      Parameters:
      application - application to create
      Returns:
      stored Application in datasource
    • getApplication

      public Application getApplication(long applicationId)
      Get an application by id
      Parameters:
      applicationId - application to find
      Returns:
      stored Application in datasource
    • findSystemApplicationByUrl

      public Application findSystemApplicationByUrl(String url)
    • updateApplication

      public void updateApplication(Application application, String username) throws IllegalAccessException, ApplicationNotFoundException
      Update an existing application on datasource. If the application doesn't exit an ApplicationNotFoundException will be thrown.
      Parameters:
      application - dto to update on store
      username - username storing application
      Throws:
      IllegalAccessException - if user is not allowed to update application
      ApplicationNotFoundException - if application wasn't found
    • updateApplication

      public void updateApplication(Application application)
    • 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 application
      username - user currently deleting application
      Throws:
      IllegalAccessException - if user is not allowed to delete application
      ApplicationNotFoundException - if application wasn't found
    • deleteApplication

      public void deleteApplication(Long applicationId) throws ApplicationNotFoundException
      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 id
      username - user login
      Throws:
      ApplicationNotFoundException - when application is not found
      IllegalAccessException - if user hasn't access permission to the application
    • deleteFavoriteApplication

      public void deleteFavoriteApplication(Long applicationId, String username)
      Deletes an application identified by its id from favorite applications of user
      Parameters:
      applicationId - application technical identifier
      username - login of user currently deleting application
    • getApplications

      public ApplicationList getApplications(int offset, int limit, String keyword)
      Retrieves the list of applications with offset, limit and a keyword that can be empty
      Parameters:
      offset - offset of the query
      limit - limit of the query that can be less or equal to 0, which mean, getting all available applications
      keyword - used to search in title and url
      Returns:
      ApplicationList that contains the list of applications
    • getApplications

      public ApplicationList getApplications(int offset, int limit, String keyword, Locale locale)
      Retrieves the list of applications with offset, limit and a keyword that can be empty
      Parameters:
      offset - offset of the query
      limit - limit of the query that can be less or equal to 0, which mean, getting all available applications
      keyword - used to search in title and url
      locale - used language to retrieve application title and description
      Returns:
      ApplicationList that 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 of Application and the username to filter on authorized applications
      Parameters:
      offset - offset of the query
      limit - limit of the query that can be less or equal to 0, which mean, getting all available applications
      keyword - used to search in title and url
      username - login of user to use to filter on authorized applications
      Returns:
      ApplicationList that contains the List of authorized UserApplication
    • 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 of Application and the username to filter on authorized applications
      Parameters:
      offset - offset of the query
      limit - limit of the query that can be less or equal to 0, which mean, getting all available applications
      keyword - used to search in title and url
      username - login of user to use to filter on authorized applications
      Returns:
      ApplicationList that contains the List of authorized UserApplication
    • 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) throws ApplicationNotFoundException
      Return the Application illustration 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 the Application illustration InputStream, if not found, the default image InputStream will be retrieved
      Parameters:
      applicationId - technical id of application
      Returns:
      InputStream of application illustration
      Throws:
      ApplicationNotFoundException - if application wasn't found
    • getApplicationImageInputStream

      public InputStream getApplicationImageInputStream(long applicationId, String dimensions) throws ApplicationNotFoundException
      Return the Application illustration InputStream, if not found, the default image InputStream will be retrieved
      Parameters:
      applicationId - technical id of application
      dimensions - Image dimensions to retrieve
      Returns:
      InputStream of application illustration
      Throws:
      ApplicationNotFoundException - if application wasn't found
    • getSystemApplications

      public List<Application> getSystemApplications()
    • getCategoryIds

      public List<Long> getCategoryIds()
    • getMandatoryAndFavoriteApplications

      public ApplicationList getMandatoryAndFavoriteApplications(org.springframework.data.domain.Pageable pageable, String username, Locale locale)
    • getApplicationShortcuts

      public List<String> getApplicationShortcuts(String username)
    • canAccess

      public boolean canAccess(Application application, String username)
    • canEdit

      public boolean canEdit(String username)