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:
    • EXTERNAL_USERS_PERMISSION

      public static final String EXTERNAL_USERS_PERMISSION
      See Also:
    • MAX_FAVORITE_APPS

      public static final String MAX_FAVORITE_APPS
      See Also:
    • APP_CENTER_SETTINGS_KEY

      public static final String APP_CENTER_SETTINGS_KEY
      SettingService key under which the whole app-center configuration is stored, serialized as a single JSON blob (see ApplicationCenterSettings). Storing all settings under one key lets new settings be added as POJO fields without introducing a new setting key nor an upgrade plugin.
      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
    • MAX_LISTED_APPLICATIONS

      public static final int MAX_LISTED_APPLICATIONS
      Most applications a Shortcuts portlet lists in its SELECTED mode (D6).
      See Also:
    • SYSTEM_APPLICATIONS_BUNDLE

      public static final String SYSTEM_APPLICATIONS_BUNDLE
      The bundle of the titles the portlets show system applications with.
      See Also:
    • MAX_SUGGESTIONS

      public static final int MAX_SUGGESTIONS
      Most suggestions returned by one call of the Shortcuts app suggester.
      See Also:
    • MAX_ILLUSTRATION_SIZE

      public static final int MAX_ILLUSTRATION_SIZE
      Largest illustration of an application created from a Shortcuts portlet, in bytes.
      See Also:
    • NOT_FAVORITABLE_MESSAGE

      public static final String NOT_FAVORITABLE_MESSAGE
      See Also:
    • NOT_CONTEXTUAL_MESSAGE

      public static final String NOT_CONTEXTUAL_MESSAGE
      See Also:
    • NOT_OWNED_MESSAGE

      public static final String NOT_OWNED_MESSAGE
      See Also:
    • INVALID_UPLOAD_MESSAGE

      public static final String INVALID_UPLOAD_MESSAGE
      See Also:
    • INVALID_TYPE_MESSAGE

      public static final String INVALID_TYPE_MESSAGE
      See Also:
    • TOO_LARGE_MESSAGE

      public static final String TOO_LARGE_MESSAGE
      See Also:
    • TITLE_MANDATORY_MESSAGE

      public static final String TITLE_MANDATORY_MESSAGE
      See Also:
    • TOO_MANY_CATEGORIES_MESSAGE

      public static final String TOO_MANY_CATEGORIES_MESSAGE
      See Also:
    • INVALID_URL_MESSAGE

      public static final String INVALID_URL_MESSAGE
      See Also:
    • INVALID_HELP_PAGE_URL_MESSAGE

      public static final String INVALID_HELP_PAGE_URL_MESSAGE
      See Also:
    • INVALID_ICON_MESSAGE

      public static final String INVALID_ICON_MESSAGE
      See Also:
    • CONTEXTUAL_MESSAGE_PREFIX

      public static final String CONTEXTUAL_MESSAGE_PREFIX
      Prefix of the codes naming a field: <prefix><field>TooLong
      See Also:
  • 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
      IllegalArgumentException - with the message "appCenter.contextual.notFavoritable" for an application created from a Shortcuts portlet
    • 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
    • getSettings

      public ApplicationCenterSettings getSettings()
      Returns the global app-center settings, deserialized from the single JSON blob stored in SettingService. When no blob is stored yet, sane defaults are returned (see getStoredSettings()).
      Returns:
      the current ApplicationCenterSettings, never null
    • saveSettings

      public void saveSettings(ApplicationCenterSettings settings, String username) throws IllegalAccessException
      Persists the whole app-center settings blob. The incoming settings are merged onto the currently stored ones (so a partial update never drops fields it didn't set) then serialized back as a single JSON blob. Admin only.
      Parameters:
      settings - the settings to persist, must not be null
      username - the user performing the operation
      Throws:
      IllegalAccessException - if the user is not allowed to change app-center settings
    • isUserPersonalAppsEnabled

      public boolean isUserPersonalAppsEnabled()
      Returns whether users are allowed to create personal URL apps.
      Returns:
      true if the personal URL apps feature is enabled
    • setUserPersonalAppsEnabled

      public void setUserPersonalAppsEnabled(boolean enabled, String username) throws IllegalAccessException
      Enables or disables the user personal apps feature. Admin only. The value is merged into the settings JSON blob (see saveSettings(io.meeds.appcenter.model.ApplicationCenterSettings, java.lang.String)).
      Parameters:
      enabled - whether the personal apps feature should be enabled
      username - the user performing the operation
      Throws:
      IllegalAccessException - if the user is not allowed to change app-center settings
    • createPersonalApplication

      public Application createPersonalApplication(Application application, String username) throws IllegalAccessException
      Creates a personal URL application for the given user.
      Throws:
      IllegalAccessException
    • updatePersonalApplication

      public void updatePersonalApplication(Application application, String username) throws IllegalAccessException, ApplicationNotFoundException
      Updates a personal URL application. Only the owner may update it.
      Throws:
      IllegalAccessException
      ApplicationNotFoundException
    • getApplicationPlacements

      public ApplicationPlacements getApplicationPlacements(String username, String siteName)
      Retrieves the applications the given user stuck to each side of the layout, resolved and re-validated at read time, along with whether the given site is allowed to display stuck panels: only the meta site and the sites listed in its sidebar configuration are, by design.
    • isPlacementEligibleSite

      public boolean isPlacementEligibleSite(String siteName)
    • stickApplication

      public void stickApplication(long applicationId, PlacementSide side, String username) throws IllegalAccessException, ApplicationNotFoundException
      Sticks an application to one side of the layout for the given user, replacing the application previously stuck to that side if any.
      Throws:
      IllegalAccessException
      ApplicationNotFoundException
    • unstickApplication

      public void unstickApplication(PlacementSide side, String username)
      Removes the application stuck to the given side for the given user. A side already empty is left as is, so the operation stays idempotent.
    • normalizePersonalUrl

      protected String normalizePersonalUrl(String url)
      Normalizes an URL entered by an end user for a personal application. The scheme is optional, so that "meeds.io" is stored as "https://meeds.io"; when it is omitted the host must be qualified, so that a plain word is rejected instead of silently becoming a link to a non existing host. Only http and https are accepted, which rules out "javascript:" links. Portal relative links ("/portal/dw", "./dw") are kept as is, but scheme relative ones ("//host", which a browser resolves to an external origin) are rejected. This method is the security boundary: the mirror written in ApplicationUrlService.js only exists to give an immediate feedback in the form, and both must be updated together.
      Parameters:
      url - the URL as entered by the user
      Returns:
      the normalized URL, either an absolute http(s) link or a portal relative one
      Throws:
      IllegalArgumentException - if the URL is blank or isn't an http(s) link
    • deletePersonalApplication

      public void deletePersonalApplication(Long applicationId, String username) throws IllegalAccessException, ApplicationNotFoundException
      Deletes a personal URL application. Only the owner may delete it.
      Throws:
      IllegalAccessException
      ApplicationNotFoundException
    • 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

      @Deprecated(since="7.3.0", forRemoval=true) @Transactional(rollbackFor=java.lang.Exception.class) public void updateFavoriteApplicationOrder(ApplicationOrder applicationOrder, String userName) throws ApplicationNotFoundException, IllegalAccessException
      Deprecated, for removal: This API element is subject to removal in a future version.
      use updateFavoriteApplicationsOrder(List, String), which checks every application before it writes any order; since 7.3.0, for removal
      Update favorite applications order for a user
      Parameters:
      applicationOrder -
      userName -
      Throws:
      ApplicationNotFoundException
      IllegalAccessException
    • updateFavoriteApplicationsOrder

      @Transactional(rollbackFor=java.lang.Exception.class) public void updateFavoriteApplicationsOrder(List<ApplicationOrder> applicationOrders, String userName) throws ApplicationNotFoundException, IllegalAccessException
      Orders the favorite applications of a user, an application not yet favorite becoming one, unless mandatory. Every application is checked before any order is written: the batch is refused as a whole when one of them does not exist, is not accessible to the user or was created from a Shortcuts portlet. The orders are written in one transaction: a write failing midway writes none.
      Parameters:
      applicationOrders - the applications and their order
      userName - the user
      Throws:
      ApplicationNotFoundException - when an application does not exist
      IllegalAccessException - when the user may not access an application
      IllegalArgumentException - with the message "appCenter.contextual.notFavoritable" for an application created from a Shortcuts portlet
    • 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
    • isIllustrationTokenValid

      public boolean isIllustrationTokenValid(long applicationId, String token, long lastModified)
      Parameters:
      applicationId - technical id of application
      token - the token of an illustration URL
      lastModified - the version of the illustration the URL names
      Returns:
      true when the token is the one the application's illustration URL carries for that version
    • 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)
      Reads the mandatory and favorite applications of a user, never one created from a Shortcuts portlet, which only that portlet lists.
      Parameters:
      pageable - the page to read
      username - the user
      locale - the language of the labels, none when null
      Returns:
      the applications
    • getListedApplications

      public List<Application> getListedApplications(ApplicationListFilter filter, Locale locale, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Reads the applications a Shortcuts portlet window lists. With application ids, in the order of its selection. With category ids, the applications linked to each category or to one of its sub-categories, grouped per category in the order of the selection, sorted by title within a group, each application once, where it first appears, and at most MAX_LISTED_APPLICATIONS. Each application is read from the app-center.application cache, kept when it is active and the user may access it, and decorated on a copy with its labels and badge name only. Unknown and duplicate ids are skipped.
      Parameters:
      filter - the window's setting name and selected ids or category ids
      locale - the language of the labels and of the title order, none when null
      username - the viewer
      Returns:
      the applications to list, never null
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the window's setting does not exist
      IllegalArgumentException - when both ids and category ids are given, when more than MAX_LISTED_APPLICATIONS ids or more than MyApplicationsSettingsService.MAX_LISTED_CATEGORIES category ids are selected
    • clearCategoryApplications

      public void clearCategoryApplications()
      Clears the applications listed per category, after a change of a category or of a category link.
    • getContextApplications

      public List<Application> getContextApplications(ApplicationListFilter filter, Locale locale, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Reads the applications a Shortcuts portlet window lists, for a user editing its settings: as getListedApplications(io.meeds.appcenter.model.ApplicationListFilter, java.util.Locale, java.lang.String), plus the applications the window created whose audience excludes the user, unless an administrator emptied that audience. The applications the window created carry their category ids, which its form edits: an empty list when they have none, null when they could not be read.
      Parameters:
      filter - the window's setting name and selected ids
      locale - the language of the labels, none when null
      username - the user editing the window's settings
      Returns:
      the applications to list, never null
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the window's setting does not exist
      IllegalAccessException - when the user may not edit the window's settings
      IllegalArgumentException - when more than MAX_LISTED_APPLICATIONS ids are selected
    • getContextSuggestions

      public List<Application> getContextSuggestions(String settingName, String keyword, List<Long> excludedIds, int offset, int limit, Locale locale, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Suggests the applications a Shortcuts portlet window may list: active, non-personal applications the user may access, matching the keyword, read from the app-center.application cache and decorated on a copy. An application created from a Shortcuts portlet is suggested to its own window only, whatever its audience unless an administrator emptied it, so that one left out of the list, by a failed save or a closed drawer, can be selected again; it carries its category ids as on getContextApplications(io.meeds.appcenter.model.ApplicationListFilter, java.util.Locale, java.lang.String).
      Parameters:
      settingName - the window's CMS setting name
      keyword - matched in title and url, all applications when blank
      excludedIds - the applications already selected, never suggested, at most MAX_LISTED_APPLICATIONS
      offset - the number of matching applications to skip
      limit - the maximum number of suggestions, at most MAX_SUGGESTIONS
      locale - the language of the labels, none when null
      username - the user editing the window's settings
      Returns:
      the suggested applications, never null
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the window's setting does not exist
      IllegalAccessException - when the user may not edit the window's settings
      IllegalArgumentException - when more than MAX_LISTED_APPLICATIONS ids are excluded
    • createContextApplication

      public Application createContextApplication(ApplicationForm application, String settingName, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Creates an application from the settings of a Shortcuts portlet window, owned by that window: listed there only, never in the users' Application Center. Its audience derives from the context the window's setting recorded server-side, the members of its space, or every platform user, internal and external alike, never from the request. Every field the form does not offer is forced, every one it offers is validated, and its illustration is read from an upload only.
      Parameters:
      application - the form's fields
      settingName - the window's CMS setting name
      username - the user creating the application
      Returns:
      the created application, its badge resolved
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the window's setting, or the space of its context, does not exist
      IllegalAccessException - when the user may not manage the window's applications
      IllegalArgumentException - when a field or the illustration is invalid, the message naming it
    • createCopiedContextApplication

      public Application createCopiedContextApplication(ApplicationForm application, byte[] illustration, String settingName) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Creates, in the context of a copy of a Shortcuts portlet window, the copy of an application the source window created, when the copy is first rendered: owned by the copy, with the audience of the context the copy's setting recorded. No right applies, as the first viewer of the copy can be anyone: the payload was written by the copy step or by an editor of the page, and the application is created in the copy's own context only. Every field is validated as on createContextApplication(io.meeds.appcenter.model.ApplicationForm, java.lang.String, java.lang.String), the one exception being a portlet instance, which needs only to exist. The illustration's type is decided from its content; an invalid or too large one is dropped, the application being created without it. Its categories are linked with no right checked, as the copy's first viewer can be anyone, a category that does not exist, or that fails to link, being skipped.
      Parameters:
      application - the copied application's fields and categories
      illustration - the copied illustration's content, null when none
      settingName - the copy's CMS setting name
      Returns:
      the created application, with the categories it got
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the copy's setting, or the space of its context, does not exist
      IllegalArgumentException - when a field is invalid, the message naming it
    • getApplicationCategoryIds

      public Map<Long,List<Long>> getApplicationCategoryIds(List<Long> applicationIds)
      Parameters:
      applicationIds - application ids
      Returns:
      the ids of each application's categories, read in one query, by application id, none for an application without category
    • deleteContextApplication

      public void deleteContextApplication(long applicationId, String settingName, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Deletes an application created from the settings of a Shortcuts portlet window, from that window's settings.
      Parameters:
      applicationId - the application id
      settingName - the window's CMS setting name
      username - the user deleting the application
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the window's setting does not exist, or when the application does not exist, or the window does not manage it and the user may not access it
      IllegalAccessException - when the user may not manage the window's applications
      IllegalArgumentException - with the message "appCenter.contextual.notContextual" for an application of the Application Center, "appCenter.contextual.notOwned" for one another window created
    • updateContextApplication

      public Application updateContextApplication(long applicationId, ApplicationForm application, String settingName, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Updates an application created from the settings of a Shortcuts portlet window, from that window's settings, with the fields its form offers, each one validated as on creation, but a portlet instance it keeps, which it does not check again. Its owner, audience, order and every field the form does not offer keep their stored or forced value. Its badge binding is the administrators' to change: for another editor, a new type drops it, and so does, unless the badge is turned off, a new url a badge provider declares. Its illustration is replaced from an upload only, removed only on the form's explicit request, and kept otherwise. Its categories become the form's ones as far as they can: a category the user may not link or unlink, or that fails to, keeps its state, and none changes when the form sends no list of them or when the stored ones cannot be read.
      Parameters:
      applicationId - the application id
      application - the form's fields
      settingName - the window's CMS setting name
      username - the user updating the application
      Returns:
      the updated application, as a listing tile without its permissions, its badge resolved, with its categories, null when they could not be read
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the window's setting does not exist, when the application does not exist, or the window does not manage it and the user may not access it, or when the update's own read of the application, or its read back once saved, finds none
      IllegalAccessException - when the user may not manage the window's applications
      IllegalArgumentException - with the message "appCenter.contextual.notContextual" for an application of the Application Center, "appCenter.contextual.notOwned" for one another window created, or a message naming the invalid field or illustration
    • deleteSpaceApplications

      public void deleteSpaceApplications(long spaceId)
      Deletes the applications Shortcuts portlet windows created in the context of a deleted space: a space created later with the same name gets the same group, so the same audience. One application failing to delete does not keep the others.
      Parameters:
      spaceId - the deleted space id
    • deleteSectionTemplateApplications

      public void deleteSectionTemplateApplications(long templateId)
      Deletes the applications the windows of a section template's drafts created, every administrator's, once the template is deleted.
      Parameters:
      templateId - the deleted section template id
    • deleteSectionTemplateDraftLeftovers

      public void deleteSectionTemplateDraftLeftovers(String settingName, String draftPageReference, Collection<String> windowStorageIds)
      Deletes the applications an earlier editing session of a section template left behind on a user's draft page: the section-template editor saves the draft page again, with new windows, each time it opens the template, so that the applications of the windows it replaced are listed nowhere. Kept: those of a window of the current draft page, among which the window being initialized, whatever their order of rendering, those of a window recorded on another draft page, another administrator's, and those whose window's setting cannot be read. Each application is checked when its turn comes, after all were selected: one created meanwhile waits for the next session, one deleted meanwhile is skipped. Nothing is deleted once the window being initialized no longer exists as committed: its render loaded the draft page before a later session saved it again, so that the given windows are not those of the current draft page. That window is read once, when the first application to delete is reached, after the selection, which lists the applications of such a later session's windows only once the draft page was saved again; a read that fails stops the deletion, its exception thrown.
      Parameters:
      settingName - the CMS setting name of the window being initialized, which names that window: when it does not, nothing is deleted
      draftPageReference - the draft page the window is rendered on
      windowStorageIds - the storage ids of the windows of that page, as the render loaded it
    • canEditContextApplication

      public boolean canEditContextApplication(Application application, String username)
      Whether a user may edit an application from the settings of a Shortcuts portlet window: an administrator any application, whoever manages the applications of the window that created one that application only. When that window's setting no longer exists, or an administrator emptied the application's audience, administrators only.
      Parameters:
      application - the application
      username - the user, blank for a guest
      Returns:
      true when the user may edit the application
    • getApplicationShortcuts

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

      public boolean canAccess(Application application, String username)
      Whether a user may see an application. An application created from a Shortcuts portlet whose audience an administrator emptied is shown to administrators only, where any other application without permissions is shown to every platform user.
      Parameters:
      application - the application
      username - the user, blank for a guest
      Returns:
      true when the user may see the application
    • canEdit

      public boolean canEdit(String username)
    • isShown

      public boolean isShown(Application application, String settingName, String username, boolean editor)
      Whether a Shortcuts portlet window's settings drawer lists an application to a user, the rule a copy of the window applies too.
      Parameters:
      application - the application
      settingName - the window's CMS setting name
      username - the user
      editor - whether the user may edit the window's settings
      Returns:
      true for an application the user may access, and for an editor of the window's settings one the window manages