com.atlassian.jira.portal
Class DefaultPortalPageManager

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

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, PortletAccessManager portletAccessManager, PortletConfigurationManager portletConfigurationManager, SharedEntityIndexer indexer)
           
 
Method Summary
 PortletConfiguration addPortalPagePortletConfiguration(PortalPage portalPage, String portletKey, int column, int row)
          Adds a Portlet to the PortalPage and returns the [@link PortletConfiguration} that represents the newly added configuration.
 void adjustFavouriteCount(SharedEntity entity, int adjustmentValue)
          Adjusts the favourite counts for a given entity.
 boolean canUserSeePortlet(User user, Portlet portlet)
          Returns true if the user is able to view the passed portlet.
 boolean canUserSeePortlet(User user, String portletKey)
          Returns true if the user is able to view the Portlet identified by portletKey.
 PortalPage copyPortletConfigurationInPortalPage(PortalPage portalPage, Long portletConfigId)
          Make a new copy of a PortletConfiguration on a PortalPage.
 PortalPage create(PortalPage portalPage)
          Creates the specified PortalPage in the database
 PortalPage createBasedOnClone(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(User user)
           
 PortalPage deletePortalPagePortletConfiguration(PortalPage portalPage, Long portletConfigId)
          This can be called to delete a specific PortletConfiguration object by id inside a PortalPage object from the underlying database store.
 boolean doesPortletExist(String portletKey)
          This is called to see if the specified portlet plugin, identified by portletKey, exists at all.
 CloseableIterable get(SharedEntityAccessor.RetrievalDescriptor ids)
          Used to get sharable entities from a search result.
 CloseableIterable getAll()
          Get all sharable entities this accessor can see.
 Collection getAllOwnedPortalPages(User owner)
          Returns a Collection of PortalPage objects that are owned by the specified User
 PortalPage getPortalPage(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(User owner, String pageName)
          Returns a PortalPage by searching for it by owner and pageName.
 String getPortalPageOwnerUserName(Long id)
          Returns the user name of the user who owns the specified PortalPage
 SharedEntity getSharedEntity(Long entityId)
          This will call back to ask for a SharedEntity based on id.
 SharedEntity getSharedEntity(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 getType()
          Returns the type that this object can work with.
 Portlet getVisiblePortlet(User user, String portletKey)
          Returns a Portlet if the user can see it
 Collection getVisiblePortlets(User user)
          This returns a collections of the all the Portlet's a user can see
 boolean hasPermissionToUse(User user, SharedEntity entity)
          Returns true if the user has permission to use the SharedEntity
 PortalPage movePortletConfigurationToPortalPage(PortalPage srcPortalPage, PortalPage targetPortalPage, Long portletConfigId)
          Move a PortletConfiguration from one PortalPage to another.
 PortalPage saveAllPortalPagePortletConfiguration(PortalPage portalPage)
          This can be called to save the PortletConfiguration objects inside a PortalPage object to the underlying database store.
 PortalPage savePortalPagePortletConfiguration(PortalPage portalPage, Long portletConfigId)
          This can be called to save a PortletConfiguration object inside a PortalPage object to the underlying database store.
 SharedEntitySearchResult search(SharedEntitySearchParameters searchParameters, 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,
                                PortletAccessManager portletAccessManager,
                                PortletConfigurationManager portletConfigurationManager,
                                SharedEntityIndexer indexer)
Method Detail

getType

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

Specified by:
getType in interface SharedEntityAccessor
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
Parameters:
entity - the entity to adjust
adjustmentValue - the value to adjust by.

getSharedEntity

public SharedEntity 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
Parameters:
entityId - the id of the SharedEntity
Returns:
a SharedEntity or null if it cant be found

getSharedEntity

public SharedEntity getSharedEntity(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
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(User user,
                                  SharedEntity entity)
Description copied from interface: SharedEntityAccessor
Returns true if the user has permission to use the SharedEntity

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

getAll

public CloseableIterable getAll()
Description copied from interface: SharedEntityAccessor
Get all sharable entities this accessor can see.

Specified by:
getAll in interface SharedEntityAccessor
Returns:
a CloseableIterable of SharedEntity's

get

public CloseableIterable get(SharedEntityAccessor.RetrievalDescriptor ids)
Description copied from interface: SharedEntityAccessor
Used to get sharable entities from a search result.

Specified by:
get in interface SharedEntityAccessor
Parameters:
ids - retrieval descriptor
Returns:
a CloseableIterable of SharedEntity's

getAllOwnedPortalPages

public Collection getAllOwnedPortalPages(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(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(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

getPortalPageOwnerUserName

public String getPortalPageOwnerUserName(Long id)
Description copied from interface: PortalPageManager
Returns the user name of the user who owns the specified PortalPage

Specified by:
getPortalPageOwnerUserName in interface PortalPageManager
Parameters:
id - the id of the PortalPage
Returns:
the user name of the owner of the PortalPage or null if there is not one

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(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(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

saveAllPortalPagePortletConfiguration

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

Specified by:
saveAllPortalPagePortletConfiguration in interface PortalPageManager
Parameters:
portalPage - the PortalPage in question
Returns:
a newly refreshed PortalPage object whose internals reflects what has been saved

savePortalPagePortletConfiguration

public PortalPage savePortalPagePortletConfiguration(PortalPage portalPage,
                                                     Long portletConfigId)
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:
savePortalPagePortletConfiguration in interface PortalPageManager
Parameters:
portalPage - the PortalPage in question
portletConfigId - the id of the PortletConfiguration inside the PortalPage.
Returns:
a newly refreshed PortalPage object whose internals reflects what has been saved

deletePortalPagePortletConfiguration

public PortalPage deletePortalPagePortletConfiguration(PortalPage portalPage,
                                                       Long portletConfigId)
Description copied from interface: PortalPageManager
This can be called to delete a specific PortletConfiguration object by id inside a PortalPage object from the underlying database store.

Specified by:
deletePortalPagePortletConfiguration in interface PortalPageManager
Parameters:
portalPage - the PortalPage in question
portletConfigId - the id of the PortletConfiguration inside the PortalPage
Returns:
a newly refreshed PortalPage object whose internals reflects what has been changed

copyPortletConfigurationInPortalPage

public PortalPage copyPortletConfigurationInPortalPage(PortalPage portalPage,
                                                       Long portletConfigId)
Description copied from interface: PortalPageManager
Make a new copy of a PortletConfiguration on a PortalPage.

Specified by:
copyPortletConfigurationInPortalPage in interface PortalPageManager
Parameters:
portalPage - the PortalPage that contains the PortletConfiguration to copy.
portletConfigId - the id of the PortletConfiguration to copy. It must be attached to the passed PortalPage.
Returns:
the new PortalPage with the copied PortletConfiguration. Null will be returned on error.

movePortletConfigurationToPortalPage

public PortalPage movePortletConfigurationToPortalPage(PortalPage srcPortalPage,
                                                       PortalPage targetPortalPage,
                                                       Long portletConfigId)
Description copied from interface: PortalPageManager
Move a PortletConfiguration from one PortalPage to another.

Specified by:
movePortletConfigurationToPortalPage in interface PortalPageManager
Parameters:
srcPortalPage - the PortalPage that contains the PortletConfiguration to move.
targetPortalPage - the PortalPage to receive the PortletConfiguration.
portletConfigId - the id of the PortletConfiguration to move.
Returns:
the changed targetPortalPage or null if the call failed.

addPortalPagePortletConfiguration

public PortletConfiguration addPortalPagePortletConfiguration(PortalPage portalPage,
                                                              String portletKey,
                                                              int column,
                                                              int row)
Description copied from interface: PortalPageManager
Adds a Portlet to the PortalPage and returns the [@link PortletConfiguration} that represents the newly added configuration.

Specified by:
addPortalPagePortletConfiguration in interface PortalPageManager
Parameters:
portalPage - the PortalPage to add the Portlet to
portletKey - the key of the Portlet to add
column - the suggested column inside the PortalPage
row - the suggested row inside the PortalPage
Returns:
a PortletConfiguration representing where the Portlet was placed. The PortalPage may in fact renumber where the PP was placed.

canUserSeePortlet

public boolean canUserSeePortlet(User user,
                                 String portletKey)
Description copied from interface: PortalPageManager
Returns true if the user is able to view the Portlet identified by portletKey.

Specified by:
canUserSeePortlet in interface PortalPageManager
Parameters:
user - the user to test.
portletKey - the plugin id of the portlet to test.
Returns:
true if the user is able to view the Portlet identified by portletKey.

canUserSeePortlet

public boolean canUserSeePortlet(User user,
                                 Portlet portlet)
Description copied from interface: PortalPageManager
Returns true if the user is able to view the passed portlet.

Specified by:
canUserSeePortlet in interface PortalPageManager
Parameters:
user - the user to test.
portlet - the portlet to check.
Returns:
true if the user is able to view the Portlet identified by portletKey.

doesPortletExist

public boolean doesPortletExist(String portletKey)
Description copied from interface: PortalPageManager
This is called to see if the specified portlet plugin, identified by portletKey, exists at all.

Specified by:
doesPortletExist in interface PortalPageManager
Parameters:
portletKey - the identifier of the Portlet
Returns:
true if the Portlet exists

getVisiblePortlets

public Collection getVisiblePortlets(User user)
Description copied from interface: PortalPageManager
This returns a collections of the all the Portlet's a user can see

Specified by:
getVisiblePortlets in interface PortalPageManager
Parameters:
user - the user in play
Returns:
a list of Portlet's the user can see

getVisiblePortlet

public Portlet getVisiblePortlet(User user,
                                 String portletKey)
Description copied from interface: PortalPageManager
Returns a Portlet if the user can see it

Specified by:
getVisiblePortlet in interface PortalPageManager
Parameters:
user - the User in play
portletKey - the plugin id of the Portlet
Returns:
a Portlet if the user can see it

search

public SharedEntitySearchResult search(SharedEntitySearchParameters searchParameters,
                                       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.


Copyright © 2002-2009 Atlassian. All Rights Reserved.