com.atlassian.jira.portal
Class DefaultPortalPageManager

java.lang.Object
  extended by com.atlassian.jira.portal.DefaultPortalPageManager
All Implemented Interfaces:
PortalPageManager, SharedEntityAccessor<PortalPage>

public class DefaultPortalPageManager
extends Object
implements PortalPageManager

The base class for PortalPageManager implementations

Since:
v3.13

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.sharing.SharedEntityAccessor
SharedEntityAccessor.Factory, SharedEntityAccessor.RetrievalDescriptor
 
Constructor Summary
DefaultPortalPageManager(ShareManager shareManager, PortalPageStore portalPageStore, PortletConfigurationManager portletConfigurationManager, SharedEntityIndexer indexer, com.atlassian.event.api.EventPublisher eventPublisher, JiraAuthenticationContext authenticationContext)
           
 
Method Summary
 void adjustFavouriteCount(SharedEntity entity, int adjustmentValue)
          Adjusts the favourite counts for a given entity.
 PortalPage create(PortalPage portalPage)
          Creates the specified PortalPage in the database
 PortalPage createBasedOnClone(com.atlassian.crowd.embedded.api.User pageOwner, PortalPage portalPage, PortalPage clonePortalPage)
          Creates a PortalPage in the database by cloning its Portlet content from the specified clonePortalPage
 void delete(Long portalPageId)
          Deletes the PortalPage with the specified portalPageId
 void deleteAllPortalPagesForUser(com.atlassian.crowd.embedded.api.User user)
           
 EnclosedIterable<PortalPage> get(SharedEntityAccessor.RetrievalDescriptor descriptor)
          Used to get sharable entities from a search result.
 EnclosedIterable<PortalPage> get(com.atlassian.crowd.embedded.api.User user, SharedEntityAccessor.RetrievalDescriptor ids)
          Used to get sharable entities from a search result.
 EnclosedIterable<PortalPage> getAll()
          Get all sharable entities this accessor can see.
 EnclosedIterable<SharedEntity> getAllIndexableSharedEntities()
          Get all sharable entities this accessor can see for use in indexing.
 Collection<PortalPage> getAllOwnedPortalPages(com.atlassian.crowd.embedded.api.User owner)
          Returns a Collection of PortalPage objects that are owned by the specified User
 PortalPage getPortalPage(com.atlassian.crowd.embedded.api.User user, Long id)
          Returns the PortalPage with the specified portalPageId, IF the user is allowed to see it.
 PortalPage getPortalPageById(Long portalPageId)
          Gets a PortalPage by id regardless of owner
 PortalPage getPortalPageByName(com.atlassian.crowd.embedded.api.User owner, String pageName)
          Returns a PortalPage by searching for it by owner and pageName.
 List<List<PortletConfiguration>> getPortletConfigurations(Long portalPageId)
          Returns a sorted immutable list of lists of portletconfigurations for a particular portal page.
 PortalPage getSharedEntity(Long entityId)
          This will call back to ask for a SharedEntity based on id.
 PortalPage getSharedEntity(com.atlassian.crowd.embedded.api.User user, Long entityId)
          This is called to get SharedEntity by id If the user is allows to see it
 PortalPage getSystemDefaultPortalPage()
          Returns the system default PortalPage.
 SharedEntity.TypeDescriptor<PortalPage> getType()
          Returns the type that this object can work with.
 boolean hasPermissionToUse(com.atlassian.crowd.embedded.api.User user, PortalPage portalPage)
          Returns true if the user has permission to use the SharedEntity
 void saveLegacyPortletConfiguration(PortletConfiguration portletConfiguration)
          This can be called to save a PortletConfiguration object inside a PortalPage object to the underlying database store.
 SharedEntitySearchResult<PortalPage> search(SharedEntitySearchParameters searchParameters, com.atlassian.crowd.embedded.api.User user, int pagePosition, int pageWidth)
          Search for the PortalPages that match the passed SearchParameters.
 PortalPage update(PortalPage portalPage)
          Updates the specified PortalPage in the database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPortalPageManager

public DefaultPortalPageManager(ShareManager shareManager,
                                PortalPageStore portalPageStore,
                                PortletConfigurationManager portletConfigurationManager,
                                SharedEntityIndexer indexer,
                                com.atlassian.event.api.EventPublisher eventPublisher,
                                JiraAuthenticationContext authenticationContext)
Method Detail

getType

public SharedEntity.TypeDescriptor<PortalPage> getType()
Description copied from interface: SharedEntityAccessor
Returns the type that this object can work with.

Specified by:
getType in interface SharedEntityAccessor<PortalPage>
Returns:
the type that this object can work with.

adjustFavouriteCount

public void adjustFavouriteCount(SharedEntity entity,
                                 int adjustmentValue)
Description copied from interface: SharedEntityAccessor
Adjusts the favourite counts for a given entity. This resulting value must always be greater or equal to one.

Specified by:
adjustFavouriteCount in interface SharedEntityAccessor<PortalPage>
Parameters:
entity - the entity to adjust
adjustmentValue - the value to adjust by.

getSharedEntity

public PortalPage getSharedEntity(Long entityId)
Description copied from interface: SharedEntityAccessor
This will call back to ask for a SharedEntity based on id.

Specified by:
getSharedEntity in interface SharedEntityAccessor<PortalPage>
Parameters:
entityId - the id of the SharedEntity
Returns:
a SharedEntity or null if it cant be found

getSharedEntity

public PortalPage getSharedEntity(com.atlassian.crowd.embedded.api.User user,
                                  Long entityId)
Description copied from interface: SharedEntityAccessor
This is called to get SharedEntity by id If the user is allows to see it

Specified by:
getSharedEntity in interface SharedEntityAccessor<PortalPage>
Parameters:
user - the user in play
entityId - the id of the SharedEntity
Returns:
a SharedEntity if it exists and the user can see it and null otherwise

hasPermissionToUse

public boolean hasPermissionToUse(com.atlassian.crowd.embedded.api.User user,
                                  PortalPage portalPage)
Description copied from interface: SharedEntityAccessor
Returns true if the user has permission to use the SharedEntity

Specified by:
hasPermissionToUse in interface SharedEntityAccessor<PortalPage>
Parameters:
user - the user in play
portalPage - the SharedEntity to check
Returns:
true if the user has permission to use it

getAll

public EnclosedIterable<PortalPage> getAll()
Description copied from interface: SharedEntityAccessor
Get all sharable entities this accessor can see.

Specified by:
getAll in interface SharedEntityAccessor<PortalPage>
Returns:
a EnclosedIterable of SharedEntity's

getAllIndexableSharedEntities

public EnclosedIterable<SharedEntity> getAllIndexableSharedEntities()
Description copied from interface: SharedEntityAccessor
Get all sharable entities this accessor can see for use in indexing.

Specified by:
getAllIndexableSharedEntities in interface SharedEntityAccessor<PortalPage>
Returns:
a EnclosedIterable of SharedEntity's

get

public EnclosedIterable<PortalPage> get(SharedEntityAccessor.RetrievalDescriptor descriptor)
Description copied from interface: SharedEntityAccessor
Used to get sharable entities from a search result.

Specified by:
get in interface SharedEntityAccessor<PortalPage>
Parameters:
descriptor - retrieval descriptor
Returns:
a EnclosedIterable of SharedEntity's

get

public EnclosedIterable<PortalPage> get(com.atlassian.crowd.embedded.api.User user,
                                        SharedEntityAccessor.RetrievalDescriptor ids)
Description copied from interface: SharedEntityAccessor
Used to get sharable entities from a search result. The entities returned may be modified by the user parameter (e.g. permissions or clause sanitisation).

Specified by:
get in interface SharedEntityAccessor<PortalPage>
Parameters:
user - the user performing the search
ids - retrieval descriptor
Returns:
a EnclosedIterable of SharedEntity's

getAllOwnedPortalPages

public Collection<PortalPage> getAllOwnedPortalPages(com.atlassian.crowd.embedded.api.User owner)
Description copied from interface: PortalPageManager
Returns a Collection of PortalPage objects that are owned by the specified User

Specified by:
getAllOwnedPortalPages in interface PortalPageManager
Parameters:
owner - the User who owns the PortalPage's
Returns:
a Collection of PortalPage objects that are owned by the specified User

getPortalPageByName

public PortalPage getPortalPageByName(com.atlassian.crowd.embedded.api.User owner,
                                      String pageName)
Description copied from interface: PortalPageManager
Returns a PortalPage by searching for it by owner and pageName.

Specified by:
getPortalPageByName in interface PortalPageManager
Parameters:
owner - the owner in play
pageName - the name of the PortalPage
Returns:
a PortalPage object if one can be found with the name and owner or null if not

getSystemDefaultPortalPage

public PortalPage getSystemDefaultPortalPage()
Description copied from interface: PortalPageManager
Returns the system default PortalPage. This has no owner and is used when a User has no PortalPage objects defined for them

Specified by:
getSystemDefaultPortalPage in interface PortalPageManager
Returns:
a non null system default PortalPage object

getPortalPage

public PortalPage getPortalPage(com.atlassian.crowd.embedded.api.User user,
                                Long id)
Description copied from interface: PortalPageManager
Returns the PortalPage with the specified portalPageId, IF the user is allowed to see it.

Specified by:
getPortalPage in interface PortalPageManager
Parameters:
user - the User in play
id - the id of the PortalPage to return
Returns:
a PortalPage if the user is allowed to see it or null if they are not allowed

getPortalPageById

public PortalPage getPortalPageById(Long portalPageId)
Description copied from interface: PortalPageManager
Gets a PortalPage by id regardless of owner

Specified by:
getPortalPageById in interface PortalPageManager
Parameters:
portalPageId - the id of the PortalPage to retrieve
Returns:
a PortalPage object or null if it cant be found

create

public PortalPage create(PortalPage portalPage)
Description copied from interface: PortalPageManager
Creates the specified PortalPage in the database

Specified by:
create in interface PortalPageManager
Parameters:
portalPage - the PortalPage to create
Returns:
the newly created PortalPage with its new id

createBasedOnClone

public PortalPage createBasedOnClone(com.atlassian.crowd.embedded.api.User pageOwner,
                                     PortalPage portalPage,
                                     PortalPage clonePortalPage)
Description copied from interface: PortalPageManager
Creates a PortalPage in the database by cloning its Portlet content from the specified clonePortalPage

Specified by:
createBasedOnClone in interface PortalPageManager
Parameters:
pageOwner - the User who will own the cloned portal page
portalPage - the PortalPage to create
clonePortalPage - the PortalPage to clone Portlet content from
Returns:
the newly created PortalPage with its new id

update

public PortalPage update(PortalPage portalPage)
Description copied from interface: PortalPageManager
Updates the specified PortalPage in the database

Specified by:
update in interface PortalPageManager
Parameters:
portalPage - the PortalPage to update
Returns:
the newly updated PortalPage

deleteAllPortalPagesForUser

public void deleteAllPortalPagesForUser(com.atlassian.crowd.embedded.api.User user)

delete

public void delete(Long portalPageId)
Description copied from interface: PortalPageManager
Deletes the PortalPage with the specified portalPageId

Specified by:
delete in interface PortalPageManager
Parameters:
portalPageId - the id of the PortalPage to delete

saveLegacyPortletConfiguration

public void saveLegacyPortletConfiguration(PortletConfiguration portletConfiguration)
Description copied from interface: PortalPageManager
This can be called to save a PortletConfiguration object inside a PortalPage object to the underlying database store.

Specified by:
saveLegacyPortletConfiguration in interface PortalPageManager
Parameters:
portletConfiguration - The portletConfiguration to save.

search

public SharedEntitySearchResult<PortalPage> search(SharedEntitySearchParameters searchParameters,
                                                   com.atlassian.crowd.embedded.api.User user,
                                                   int pagePosition,
                                                   int pageWidth)
Description copied from interface: PortalPageManager
Search for the PortalPages that match the passed SearchParameters. The result can be paged so that a subset of the results can be returned.

Specified by:
search in interface PortalPageManager
Parameters:
searchParameters - the SearchParameters to query.
user - the user performing the search.
pagePosition - the page to return.
pageWidth - the number of results per page.
Returns:
the result containing the PortalPages objects that match the request.

getPortletConfigurations

public List<List<PortletConfiguration>> getPortletConfigurations(Long portalPageId)
Description copied from interface: PortalPageManager
Returns a sorted immutable list of lists of portletconfigurations for a particular portal page. The outer list represents columns and the inner lists represent rows within a column. This method will return portlet configs sorted correctly as returned by the underlying persistance layer.

Specified by:
getPortletConfigurations in interface PortalPageManager
Parameters:
portalPageId - The portal page id to fetch portlet configs for
Returns:
immutable list of lists representing portletconfigs on a dashboard


Copyright © 2002-2012 Atlassian. All Rights Reserved.