Package com.atlassian.jira.bc.portal
Class DefaultPortalPageService
java.lang.Object
com.atlassian.jira.bc.portal.DefaultPortalPageService
- All Implemented Interfaces:
PortalPageService
The base class for PortalPageService implementations
- Since:
- v3.13
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPortalPageService
(PortalPageManager portalPageManager, ShareTypeValidatorUtils shareTypeValidatorUtils, FavouritesManager<PortalPage> favouritesManager, PermissionManager permissionManager, UserUtil userUtil, FeatureManager featureManager, com.atlassian.event.api.EventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkSystemDefaultSharePermissions
(JiraServiceContext serviceCtx, SharedEntity.SharePermissions sharePermissions) Check that the passed permissions are valid for the System Dashboard.createPortalPage
(JiraServiceContext serviceCtx, PortalPage portalPage) Called to create and store the specified portalPage into the database.createPortalPage
(JiraServiceContext serviceCtx, PortalPage portalPage, boolean isFavourite) Called to create and store the specified portalPage into the database.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
Delete all Portal Pages owned by a user.void
deletePortalPage
(JiraServiceContext serviceCtx, Long portalPageId) Called to delete the PortalPage with the specified portalPageId.Retrieve allPortalPage
's a user has favourited.Get a user's non privatePortalPage
's.Retrieve allPortalPage
's a user owns/has created.getPortalPage
(JiraServiceContext context, Long portalPageId) Retrieve a givenPortalPage
by id.GetPortalPage
's owned by a given user that have been favourited by at least one other usergetPortletConfigurations
(JiraServiceContext serviceCtx, Long portalPageId) Returns all portlet configurations for a particular dashboard in colums and rows.This returns the System Default PortalPage as defined by the JIRA Administratorsvoid
increasePortalPageSequence
(JiraServiceContext serviceCtx, Long portalPageId) Increases the position of the page configuration in the user's page configuration setboolean
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 specificPortletConfiguration
to a database store.search
(JiraServiceContext serviceCtx, SharedEntitySearchParameters searchParameters, int pagePosition, int pageWidth) Search for the PortalPages that match the passed SearchParameters.updatePortalPage
(JiraServiceContext serviceCtx, PortalPage portalPage, boolean isFavourite) Updates the specified PortalPage in the databaseupdatePortalPageOwner
(JiraServiceContext serviceCtx, Long portalPageId, ApplicationUser newOwner) Changes the owner of the portal page.void
validateForChangeOwner
(JiraServiceContext serviceCtx, PortalPage page) 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
-
Constructor Details
-
Method Details
-
getFavouritePortalPages
Description copied from interface:PortalPageService
Retrieve allPortalPage
's a user has favourited. Permission checks are done to ensure the user can see thePortalPage
, as visibility may have been removed from underneath them.- Specified by:
getFavouritePortalPages
in interfacePortalPageService
- Parameters:
user
- The user who has favouritePortalPage
's. Also to test visibility and with- Returns:
- a Collection of
PortalPage
objects that representPortalPage
's the user has favourited.
-
isFavourite
Description copied from interface:PortalPageService
Is the passed PortalPage a favourite of the passed User.- Specified by:
isFavourite
in interfacePortalPageService
- Parameters:
user
- the user to check.portalPage
- the page to check.- Returns:
- true if the PortalPage is a favourite of the passed User.
-
getOwnedPortalPages
Description copied from interface:PortalPageService
Retrieve allPortalPage
's a user owns/has created.- Specified by:
getOwnedPortalPages
in interfacePortalPageService
- Parameters:
user
- The user who created thePortalPage
's.- Returns:
- a Collection of
PortalPage
objects that representPortalPage
's the user has created.
-
getNonPrivatePortalPages
Description copied from interface:PortalPageService
Get a user's non privatePortalPage
's. I.e.PortalPage
's that other users can possibly see.- Specified by:
getNonPrivatePortalPages
in interfacePortalPageService
- Parameters:
user
- The author of thePortalPage
's- Returns:
- Collection of PortalPage objects that do not have private scope.
-
getPortalPagesFavouritedByOthers
Description copied from interface:PortalPageService
GetPortalPage
's owned by a given user that have been favourited by at least one other user- Specified by:
getPortalPagesFavouritedByOthers
in interfacePortalPageService
- Parameters:
user
- The author of thePortalPage
's- Returns:
- Collection of PortalPage objects owned by the given user and favourited by at least one other user
-
getPortalPage
Description copied from interface:PortalPageService
Retrieve a givenPortalPage
by id.- Specified by:
getPortalPage
in interfacePortalPageService
- Parameters:
context
- JIRA Service context containing an error collection and user requesting (to run) thePortalPage
. ThePortalPage
must exist and the user must be able to seePortalPage
else an error will result.portalPageId
- The id of thePortalPage
to retrieve. Id must not be null.- Returns:
- The PortalPage as specified by the id, or null if none exists for the user.
-
validateForGetPortalPage
Description copied from interface:PortalPageService
Check if the user in the service context has permission to get the portal page with the id provided.- Specified by:
validateForGetPortalPage
in interfacePortalPageService
- Parameters:
context
- Context containing user, error collection and i18n beanportalPageId
- 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.
-
getSystemDefaultPortalPage
Description copied from interface:PortalPageService
This returns the System Default PortalPage as defined by the JIRA Administrators- Specified by:
getSystemDefaultPortalPage
in interfacePortalPageService
- Returns:
- the system default PortalPage
-
validateForCreate
Description copied from interface:PortalPageService
Called to validate that the PortalPage object is in a valid state for creation. Call this before calling the create method .- Specified by:
validateForCreate
in interfacePortalPageService
- Parameters:
serviceCtx
- the JiraServiceContext in playportalPage
- 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.
-
createPortalPage
Description copied from interface:PortalPageService
Called to create and store the specified portalPage into the database.- Specified by:
createPortalPage
in interfacePortalPageService
- Parameters:
serviceCtx
- the JiraServiceContext in playportalPage
- the PortalPage object that is to be created- Returns:
- a fully fledged PortalPage with the new Id in it.
-
createPortalPage
public PortalPage createPortalPage(JiraServiceContext serviceCtx, PortalPage portalPage, boolean isFavourite) Description copied from interface:PortalPageService
Called to create and store the specified portalPage into the database.- Specified by:
createPortalPage
in interfacePortalPageService
- Parameters:
serviceCtx
- the JiraServiceContext in playportalPage
- the PortalPage object that is to be createdisFavourite
- set to true if the PortalPage should be marked as a favourite- Returns:
- a fully fledged PortalPage with the new Id in it.
-
validateForCreatePortalPageByClone
public boolean validateForCreatePortalPageByClone(JiraServiceContext serviceCtx, PortalPage portalPage, Long clonePortalPageId) Description copied from interface:PortalPageService
Called to validate that a new PortalPage can be created by cloning its Portlet content from an existing PortalPage object.- Specified by:
validateForCreatePortalPageByClone
in interfacePortalPageService
- Parameters:
serviceCtx
- the JiraServiceContext in playportalPage
- the PortalPage object that is to be createdclonePortalPageId
- the id of an existing PortalPage to clone- Returns:
- true if the PortalPage can be cloned from another page
-
createPortalPageByClone
public PortalPage createPortalPageByClone(JiraServiceContext serviceCtx, PortalPage portalPage, Long clonePortalPageId, boolean isFavourite) Description copied from interface:PortalPageService
Called to create and store the specified portalPage into the database by cloning its Portlet content from an existing PortalPage object.- Specified by:
createPortalPageByClone
in interfacePortalPageService
- Parameters:
serviceCtx
- the JiraServiceContext in playportalPage
- the PortalPage object that is to be createdclonePortalPageId
- the id of an existing PortalPage to cloneisFavourite
- set to true if the PortalPage should be marked as a favourite- Returns:
- a fully fledged PortalPage with the new Id in it.
-
validateForDelete
Description copied from interface:PortalPageService
Called to validate that the specified portalPage with the portalPageId can be deleted.- Specified by:
validateForDelete
in interfacePortalPageService
- Parameters:
serviceCtx
- the JiraServiceContext in playportalPageId
- 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.
-
deleteAllPortalPagesForUser
Description copied from interface:PortalPageService
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.- Specified by:
deleteAllPortalPagesForUser
in interfacePortalPageService
- Parameters:
user
- The user to clean up after.
-
deletePortalPage
Description copied from interface:PortalPageService
Called to delete the PortalPage with the specified portalPageId.- Specified by:
deletePortalPage
in interfacePortalPageService
- Parameters:
serviceCtx
- the JiraServiceContext in playportalPageId
- the id of the PortalPage to delete
-
validateForUpdate
Description copied from interface:PortalPageService
Called to validate that the PortalPage can be be updated- Specified by:
validateForUpdate
in interfacePortalPageService
- Parameters:
serviceCtx
- the JiraServiceContext in playportalPage
- the PortalPage to update- Returns:
- true if the PortalPage is valid or false. The ErrorCollection of the serviceCtx will have any errors in it.
-
updatePortalPage
public PortalPage updatePortalPage(JiraServiceContext serviceCtx, PortalPage portalPage, boolean isFavourite) Description copied from interface:PortalPageService
Updates the specified PortalPage in the database- Specified by:
updatePortalPage
in interfacePortalPageService
- Parameters:
serviceCtx
- the JiraServiceContext in playportalPage
- the PortalPage to updateisFavourite
- set to true if the PortalPage is to be marked as a favourite- Returns:
- a newly updated PortalPage
-
validateForChangeOwner
Description copied from interface:PortalPageService
This will validate that the dashboard page can be changed to the new owbner.- Specified by:
validateForChangeOwner
in interfacePortalPageService
- Parameters:
serviceCtx
- Context containing user, error collection and i18n beanpage
- the PortalPage to validate
-
updatePortalPageOwner
public PortalPage updatePortalPageOwner(JiraServiceContext serviceCtx, Long portalPageId, ApplicationUser newOwner) Description copied from interface:PortalPageService
Changes the owner of the portal page. User performing this operation must be an administrator.You should call
PortalPageService.validateForChangeOwner(JiraServiceContext, PortalPage)
prior to calling this method.- Specified by:
updatePortalPageOwner
in interfacePortalPageService
- Parameters:
serviceCtx
- the context of the service callportalPageId
- the id of the PortalPage to updatenewOwner
- the new owner- Returns:
- a newly updated PortalPage, or null if user is not an admin
-
validateForChangePortalPageSequence
public boolean validateForChangePortalPageSequence(JiraServiceContext serviceCtx, Long portalPageId) Description copied from interface:PortalPageService
Called to validate that sequence of a PortalPage can be changed.- Specified by:
validateForChangePortalPageSequence
in interfacePortalPageService
- Parameters:
serviceCtx
- the context of the service callportalPageId
- the id of the PortalPage to re-sequence- Returns:
- true if the PortalPage can be re-sequenced
-
increasePortalPageSequence
Description copied from interface:PortalPageService
Increases the position of the page configuration in the user's page configuration set- Specified by:
increasePortalPageSequence
in interfacePortalPageService
- Parameters:
serviceCtx
- the context of the service callportalPageId
- the id of the PortalPage to re-sequence
-
decreasePortalPageSequence
Description copied from interface:PortalPageService
Decreases the position of the page configuration in the user's page configuration set.- Specified by:
decreasePortalPageSequence
in interfacePortalPageService
- Parameters:
serviceCtx
- the context of the service callportalPageId
- the id of the PortalPage to re-sequence
-
moveToStartPortalPageSequence
Description copied from interface:PortalPageService
Puts the given page to the start of the user's page configuration set.- Specified by:
moveToStartPortalPageSequence
in interfacePortalPageService
- Parameters:
serviceCtx
- the context of the service callportalPageId
- the id of the PortalPage to re-sequence
-
moveToEndPortalPageSequence
Description copied from interface:PortalPageService
Puts the given page to the end of the user's page configuration set.- Specified by:
moveToEndPortalPageSequence
in interfacePortalPageService
- Parameters:
serviceCtx
- the context of the service callportalPageId
- the id of the PortalPage to re-sequence
-
saveLegacyPortletConfiguration
public void saveLegacyPortletConfiguration(JiraServiceContext serviceCtx, PortletConfiguration portletConfiguration) Description copied from interface:PortalPageService
Save a specificPortletConfiguration
to a database store.- Specified by:
saveLegacyPortletConfiguration
in interfacePortalPageService
- Parameters:
serviceCtx
- the context of the service callportletConfiguration
- The portletConfiguration to update
-
getPortletConfigurations
public List<List<PortletConfiguration>> getPortletConfigurations(JiraServiceContext serviceCtx, Long portalPageId) Description copied from interface:PortalPageService
Returns all portlet configurations for a particular dashboard in colums and rows. The portlet configurations are returned sorted correctly in each column by row.- Specified by:
getPortletConfigurations
in interfacePortalPageService
- Parameters:
serviceCtx
- Context containing user, error collection and i18n beanportalPageId
- 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.
-