@PublicApi public interface

PortalPageService

com.atlassian.jira.bc.portal.PortalPageService
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

The PortalPageService is the top level service for Dashboard operations.

For historical reasons, Dashboards where called Portals and hence the prefix "Portal" is used consistently throughout the code.

Summary

Public Methods
PortalPage createPortalPage(JiraServiceContext serviceCtx, PortalPage portalPage)
Called to create and store the specified portalPage into the database.
PortalPage createPortalPage(JiraServiceContext serviceCtx, PortalPage portalPage, boolean isFavourite)
Called to create and store the specified portalPage into the database.
PortalPage createPortalPageByClone(JiraServiceContext serviceCtx, PortalPage portalPage, Long clonePortalPageId, boolean isFavourite)
Called to create and store the specified portalPage into the database by cloning its Portlet content from an existing PortalPage object.
void decreasePortalPageSequence(JiraServiceContext serviceCtx, Long portalPageId)
Decreases the position of the page configuration in the user's page configuration set.
void deleteAllPortalPagesForUser(ApplicationUser user)
Delete all Portal Pages owned by a user.
void deletePortalPage(JiraServiceContext serviceCtx, Long portalPageId)
Called to delete the PortalPage with the specified portalPageId.
Collection<PortalPage> getFavouritePortalPages(ApplicationUser user)
Retrieve all PortalPage's a user has favourited.
Collection<PortalPage> getNonPrivatePortalPages(ApplicationUser user)
Get a user's non private PortalPage's.
Collection<PortalPage> getOwnedPortalPages(ApplicationUser user)
Retrieve all PortalPage's a user owns/has created.
PortalPage getPortalPage(JiraServiceContext servceCtx, Long portalPageId)
Retrieve a given PortalPage by id.
Collection<PortalPage> getPortalPagesFavouritedByOthers(ApplicationUser user)
Get PortalPage's owned by a given user that have been favourited by at least one other user
List<List<PortletConfiguration>> getPortletConfigurations(JiraServiceContext context, Long portalPageId)
Returns all portlet configurations for a particular dashboard in colums and rows.
PortalPage getSystemDefaultPortalPage()
This returns the System Default PortalPage as defined by the JIRA Administrators
void increasePortalPageSequence(JiraServiceContext serviceCtx, Long portalPageId)
Increases the position of the page configuration in the user's page configuration set
boolean isFavourite(ApplicationUser user, PortalPage portalPage)
Is the passed PortalPage a favourite of the passed User.
void moveToEndPortalPageSequence(JiraServiceContext serviceCtx, Long portalPageId)
Puts the given page to the end of the user's page configuration set.
void moveToStartPortalPageSequence(JiraServiceContext serviceCtx, Long portalPageId)
Puts the given page to the start of the user's page configuration set.
void saveLegacyPortletConfiguration(JiraServiceContext serviceCtx, PortletConfiguration portletConfiguration)
Save a specific PortletConfiguration to a database store.
SharedEntitySearchResult<PortalPage> search(JiraServiceContext serviceCtx, SharedEntitySearchParameters searchParameters, int pagePosition, int pageWidth)
Search for the PortalPages that match the passed SearchParameters.
PortalPage updatePortalPage(JiraServiceContext serviceCtx, PortalPage portalPage, boolean isFavourite)
Updates the specified PortalPage in the database
PortalPage updatePortalPageUnconditionally(JiraServiceContext serviceCtx, ApplicationUser user, PortalPage portalPage)
Updates the specified PortalPage in the database , no permission checks are applied, but the user must be an administrator
void validateForChangeOwner(JiraServiceContext ctx, PortalPage dashboard)
This will validate that the dashboard page can be changed to the new owbner.
boolean validateForChangePortalPageSequence(JiraServiceContext serviceCtx, Long portalPageId)
Called to validate that sequence of a PortalPage can be changed.
boolean validateForCreate(JiraServiceContext serviceCtx, PortalPage portalPage)
Called to validate that the PortalPage object is in a valid state for creation.
boolean validateForCreatePortalPageByClone(JiraServiceContext serviceCtx, PortalPage portalPage, Long clonePortalPageId)
Called to validate that a new PortalPage can be created by cloning its Portlet content from an existing PortalPage object.
boolean validateForDelete(JiraServiceContext serviceCtx, Long portalPageId)
Called to validate that the specified portalPage with the portalPageId can be deleted.
boolean validateForGetPortalPage(JiraServiceContext context, Long portalPageId)
Check if the user in the service context has permission to get the portal page with the id provided.
void validateForSearch(JiraServiceContext serviceCtx, SharedEntitySearchParameters searchParameters)
This will validate that the input parameters are valid for a search that encompasses ANY share entity type.
boolean validateForUpdate(JiraServiceContext serviceCtx, PortalPage portalPage)
Called to validate that the PortalPage can be be updated

Public Methods

public PortalPage createPortalPage (JiraServiceContext serviceCtx, PortalPage portalPage)

Called to create and store the specified portalPage into the database.

Parameters
serviceCtx the JiraServiceContext in play
portalPage the PortalPage object that is to be created
Returns
  • a fully fledged PortalPage with the new Id in it.

public PortalPage createPortalPage (JiraServiceContext serviceCtx, PortalPage portalPage, boolean isFavourite)

Called to create and store the specified portalPage into the database.

Parameters
serviceCtx the JiraServiceContext in play
portalPage the PortalPage object that is to be created
isFavourite set to true if the PortalPage should be marked as a favourite
Returns
  • a fully fledged PortalPage with the new Id in it.

public PortalPage createPortalPageByClone (JiraServiceContext serviceCtx, PortalPage portalPage, Long clonePortalPageId, boolean isFavourite)

Called to create and store the specified portalPage into the database by cloning its Portlet content from an existing PortalPage object.

Parameters
serviceCtx the JiraServiceContext in play
portalPage the PortalPage object that is to be created
clonePortalPageId the id of an existing PortalPage to clone
isFavourite set to true if the PortalPage should be marked as a favourite
Returns
  • a fully fledged PortalPage with the new Id in it.

public void decreasePortalPageSequence (JiraServiceContext serviceCtx, Long portalPageId)

Decreases the position of the page configuration in the user's page configuration set.

Parameters
serviceCtx the context of the service call
portalPageId the id of the PortalPage to re-sequence

public void deleteAllPortalPagesForUser (ApplicationUser user)

Delete all Portal Pages owned by a user. This method will also remove all favourites for all portlets as well as remove all favourites for the user. A nice big cleanup method for when deleting a user.

Parameters
user The user to clean up after.

public void deletePortalPage (JiraServiceContext serviceCtx, Long portalPageId)

Called to delete the PortalPage with the specified portalPageId.

Parameters
serviceCtx the JiraServiceContext in play
portalPageId the id of the PortalPage to delete

public Collection<PortalPage> getFavouritePortalPages (ApplicationUser user)

Retrieve all PortalPage's a user has favourited. Permission checks are done to ensure the user can see the PortalPage, as visibility may have been removed from underneath them.

Parameters
user The user who has favourite PortalPage's. Also to test visibility and with
Returns

public Collection<PortalPage> getNonPrivatePortalPages (ApplicationUser user)

Get a user's non private PortalPage's. I.e. PortalPage's that other users can possibly see.

Parameters
user The author of the PortalPage's
Returns
  • Collection of PortalPage objects that do not have private scope.

public Collection<PortalPage> getOwnedPortalPages (ApplicationUser user)

Retrieve all PortalPage's a user owns/has created.

Parameters
user The user who created the PortalPage's.
Returns

public PortalPage getPortalPage (JiraServiceContext servceCtx, Long portalPageId)

Retrieve a given PortalPage by id.

Parameters
servceCtx JIRA Service context containing an error collection and user requesting (to run) the PortalPage. The PortalPage must exist and the user must be able to see PortalPage else an error will result.
portalPageId The id of the PortalPage to retrieve. Id must not be null.
Returns
  • The PortalPage as specified by the id, or null if none exists for the user.

public Collection<PortalPage> getPortalPagesFavouritedByOthers (ApplicationUser user)

Get PortalPage's owned by a given user that have been favourited by at least one other user

Parameters
user The author of the PortalPage's
Returns
  • Collection of PortalPage objects owned by the given user and favourited by at least one other user

public List<List<PortletConfiguration>> getPortletConfigurations (JiraServiceContext context, Long portalPageId)

Returns all portlet configurations for a particular dashboard in colums and rows. The portlet configurations are returned sorted correctly in each column by row.

Parameters
context Context containing user, error collection and i18n bean
portalPageId The id of the portal page to get
Returns
  • A list of lists representing all portlet configs in all columns for the gadget in question.

public PortalPage getSystemDefaultPortalPage ()

This returns the System Default PortalPage as defined by the JIRA Administrators

Returns
  • the system default PortalPage

public void increasePortalPageSequence (JiraServiceContext serviceCtx, Long portalPageId)

Increases the position of the page configuration in the user's page configuration set

Parameters
serviceCtx the context of the service call
portalPageId the id of the PortalPage to re-sequence

public boolean isFavourite (ApplicationUser user, PortalPage portalPage)

Is the passed PortalPage a favourite of the passed User.

Parameters
user the user to check.
portalPage the page to check.
Returns
  • true if the PortalPage is a favourite of the passed User.

public void moveToEndPortalPageSequence (JiraServiceContext serviceCtx, Long portalPageId)

Puts the given page to the end of the user's page configuration set.

Parameters
serviceCtx the context of the service call
portalPageId the id of the PortalPage to re-sequence

public void moveToStartPortalPageSequence (JiraServiceContext serviceCtx, Long portalPageId)

Puts the given page to the start of the user's page configuration set.

Parameters
serviceCtx the context of the service call
portalPageId the id of the PortalPage to re-sequence

public void saveLegacyPortletConfiguration (JiraServiceContext serviceCtx, PortletConfiguration portletConfiguration)

Save a specific PortletConfiguration to a database store.

Parameters
serviceCtx the context of the service call
portletConfiguration The portletConfiguration to update

public SharedEntitySearchResult<PortalPage> search (JiraServiceContext serviceCtx, SharedEntitySearchParameters searchParameters, int pagePosition, int pageWidth)

Search for the PortalPages that match the passed SearchParameters. The result can be paged so that a subset of the results can be returned.

Parameters
serviceCtx Context containing user, error collection and i18n bean
searchParameters the searchParameters to query.
pagePosition the page to return.
pageWidth the number of results per page.
Returns
  • the result of the search.

public PortalPage updatePortalPage (JiraServiceContext serviceCtx, PortalPage portalPage, boolean isFavourite)

Updates the specified PortalPage in the database

Parameters
serviceCtx the JiraServiceContext in play
portalPage the PortalPage to update
isFavourite set to true if the PortalPage is to be marked as a favourite
Returns
  • a newly updated PortalPage

public PortalPage updatePortalPageUnconditionally (JiraServiceContext serviceCtx, ApplicationUser user, PortalPage portalPage)

Updates the specified PortalPage in the database , no permission checks are applied, but the user must be an administrator

Parameters
serviceCtx the JiraServiceContext in play
user must be admin in order to make the change
portalPage the PortalPage to update
Returns
  • a newly updated PortalPage

public void validateForChangeOwner (JiraServiceContext ctx, PortalPage dashboard)

This will validate that the dashboard page can be changed to the new owbner.

Parameters
ctx Context containing user, error collection and i18n bean
dashboard the PortalPage to validate

public boolean validateForChangePortalPageSequence (JiraServiceContext serviceCtx, Long portalPageId)

Called to validate that sequence of a PortalPage can be changed.

Parameters
serviceCtx the context of the service call
portalPageId the id of the PortalPage to re-sequence
Returns
  • true if the PortalPage can be re-sequenced

public boolean validateForCreate (JiraServiceContext serviceCtx, PortalPage portalPage)

Called to validate that the PortalPage object is in a valid state for creation. Call this before calling the create method .

Parameters
serviceCtx the JiraServiceContext in play
portalPage the PortalPage object that is to be validated for create
Returns
  • true if the PortalPage is valid or false. The ErrorCollection of the serviceCtx will have any errors in it.

public boolean validateForCreatePortalPageByClone (JiraServiceContext serviceCtx, PortalPage portalPage, Long clonePortalPageId)

Called to validate that a new PortalPage can be created by cloning its Portlet content from an existing PortalPage object.

Parameters
serviceCtx the JiraServiceContext in play
portalPage the PortalPage object that is to be created
clonePortalPageId the id of an existing PortalPage to clone
Returns
  • true if the PortalPage can be cloned from another page

public boolean validateForDelete (JiraServiceContext serviceCtx, Long portalPageId)

Called to validate that the specified portalPage with the portalPageId can be deleted.

Parameters
serviceCtx the JiraServiceContext in play
portalPageId the id of the PortalPage to delete
Returns
  • true if the PortalPage can be deleted. The ErrorCollection of the serviceCtx will have any errors in it.

public boolean validateForGetPortalPage (JiraServiceContext context, Long portalPageId)

Check if the user in the service context has permission to get the portal page with the id provided.

Parameters
context Context containing user, error collection and i18n bean
portalPageId The id of the portal page to get
Returns
  • true if the user has permission, false if the user has no permission, or if the page doesn't exist.

public void validateForSearch (JiraServiceContext serviceCtx, SharedEntitySearchParameters searchParameters)

This will validate that the input parameters are valid for a search that encompasses ANY share entity type.

Parameters
serviceCtx Context containing user, error collection and i18n bean
searchParameters the SharedEntitySearchParameters to validate

public boolean validateForUpdate (JiraServiceContext serviceCtx, PortalPage portalPage)

Called to validate that the PortalPage can be be updated

Parameters
serviceCtx the JiraServiceContext in play
portalPage the PortalPage to update
Returns
  • true if the PortalPage is valid or false. The ErrorCollection of the serviceCtx will have any errors in it.