com.atlassian.confluence.content.service
Class DefaultPageService

java.lang.Object
  extended by com.atlassian.confluence.content.service.DefaultPageService
All Implemented Interfaces:
PageService

public class DefaultPageService
extends java.lang.Object
implements PageService


Constructor Summary
DefaultPageService(PageManager pageManager, PermissionManager permissionManager, ContentPermissionManager contentPermissionManager, DraftManager draftManager, DraftService draftService, AttachmentManager attachmentManager, NotificationManager notificationManager, com.atlassian.event.api.EventPublisher eventPublisher)
           
 
Method Summary
 PageLocator getIdPageLocator(long pageId)
          Creates a page locator that can locate a page based on an id.
 PageLocator getPageVersionLocator(long pageId, int version)
           
 PageLocator getTitleAndSpaceKeyPageLocator(java.lang.String spaceKey, java.lang.String title)
          Creates a page locator that can locate a page based on a space key and title.
 ServiceCommand newCreatePageCommand(PageProvider provider, ContentPermissionProvider permissionProvider, CreateContextProvider contextProvider, Draft draft, com.atlassian.user.User user, boolean notifySelf)
          Retrieve a command for creating a new page for the specified user.
 ServiceCommand newCreatePageCommand(PageProvider provider, ContentPermissionProvider permissionProvider, Draft draft, com.atlassian.user.User user, boolean notifySelf)
          Deprecated. 
 ServiceCommand newCreatePageCommand(PageProvider provider, ContentPermissionProvider permissionProvider, com.atlassian.user.User user, boolean notifySelf)
          Deprecated. 
 ServiceCommand newCreatePageCommandFromExisting(PageProvider provider, ContentPermissionProvider permissionProvider, Draft draft, com.atlassian.user.User user, boolean notifySelf)
          Deprecated. 
 ServiceCommand newCreatePageCommandFromExisting(PageProvider provider, ContentPermissionProvider permissionProvider, Draft draft, com.atlassian.user.User user, boolean notifySelf, SpaceProvider spaceProvider)
           This is not a public API method! Creating a page from an existing page has different authorisation and validation logic from creating a brand new page.
 ServiceCommand newDeletePageCommand(PageLocator pageLocator)
          Retrieve a command to remove an existing page
 MovePageCommand newMovePageCommand(PageLocator sourcePageLocator, PageLocator targetPageLocator, java.lang.String position)
          Retrieve a command to perform a simple move operation.
 MovePageCommand newMovePageCommand(PageLocator sourcePageLocator, SpaceLocator targetSpaceLocator)
          Retrieve a command that performs a move operation of a page to a top level of a target space.
 ServiceCommand newRemovePageVersionCommand(PageLocator pageLocator)
           
 ServiceCommand newRevertPageCommand(PageLocator pageToRevert, int version, java.lang.String revertComment, boolean revertTitle)
          Retrieve a command to revert a page
 ServiceCommand newRevertPageOrderCommand(PageLocator parentPageLocator)
          Retrieve a command to clear any existing positions for children of the located Page.
 ServiceCommand newSetPageOrderCommand(PageLocator parentPageLocator, java.util.List<java.lang.Long> childPageIds)
          Retrieve a command to set the order of all children for a supplied parent Page locator.
 void setPermissionManager(PermissionManager permissionManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPageService

public DefaultPageService(PageManager pageManager,
                          PermissionManager permissionManager,
                          ContentPermissionManager contentPermissionManager,
                          DraftManager draftManager,
                          DraftService draftService,
                          AttachmentManager attachmentManager,
                          NotificationManager notificationManager,
                          com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail

newMovePageCommand

public MovePageCommand newMovePageCommand(PageLocator sourcePageLocator,
                                          PageLocator targetPageLocator,
                                          java.lang.String position)
Description copied from interface: PageService
Retrieve a command to perform a simple move operation.

Specified by:
newMovePageCommand in interface PageService
position - the point describing where the source should be moved to in relation to the target, see MovePageCommand
Returns:
an appropriate command instance

newMovePageCommand

public MovePageCommand newMovePageCommand(PageLocator sourcePageLocator,
                                          SpaceLocator targetSpaceLocator)
Description copied from interface: PageService
Retrieve a command that performs a move operation of a page to a top level of a target space.

Specified by:
newMovePageCommand in interface PageService

newSetPageOrderCommand

public ServiceCommand newSetPageOrderCommand(PageLocator parentPageLocator,
                                             java.util.List<java.lang.Long> childPageIds)
Description copied from interface: PageService
Retrieve a command to set the order of all children for a supplied parent Page locator.

Specified by:
newSetPageOrderCommand in interface PageService
Parameters:
parentPageLocator - locator for the parent Page object
childPageIds - a list of child page ids

newRevertPageOrderCommand

public ServiceCommand newRevertPageOrderCommand(PageLocator parentPageLocator)
Description copied from interface: PageService
Retrieve a command to clear any existing positions for children of the located Page.

Specified by:
newRevertPageOrderCommand in interface PageService

newDeletePageCommand

public ServiceCommand newDeletePageCommand(PageLocator pageLocator)
Description copied from interface: PageService
Retrieve a command to remove an existing page

Specified by:
newDeletePageCommand in interface PageService

newRemovePageVersionCommand

public ServiceCommand newRemovePageVersionCommand(PageLocator pageLocator)
Specified by:
newRemovePageVersionCommand in interface PageService
Parameters:
pageLocator - a page locator that identifies either the historical version of a page directly (e.g. IdPageLocator) or the page and a version (e.g. IdAndVersionPageLocator).
Returns:
a command to remove a version of a page.

getIdPageLocator

public PageLocator getIdPageLocator(long pageId)
Description copied from interface: PageService
Creates a page locator that can locate a page based on an id.

Specified by:
getIdPageLocator in interface PageService

getTitleAndSpaceKeyPageLocator

public PageLocator getTitleAndSpaceKeyPageLocator(java.lang.String spaceKey,
                                                  java.lang.String title)
Description copied from interface: PageService
Creates a page locator that can locate a page based on a space key and title.

Specified by:
getTitleAndSpaceKeyPageLocator in interface PageService

getPageVersionLocator

public PageLocator getPageVersionLocator(long pageId,
                                         int version)
Specified by:
getPageVersionLocator in interface PageService
Parameters:
pageId - the id of the original version of the page
version - a historical version, where 1 refers to version 1.
Returns:
a page locator that will locate a historical version of a page.

newRevertPageCommand

public ServiceCommand newRevertPageCommand(PageLocator pageToRevert,
                                           int version,
                                           java.lang.String revertComment,
                                           boolean revertTitle)
Description copied from interface: PageService
Retrieve a command to revert a page

Specified by:
newRevertPageCommand in interface PageService

newCreatePageCommand

public ServiceCommand newCreatePageCommand(PageProvider provider,
                                           ContentPermissionProvider permissionProvider,
                                           CreateContextProvider contextProvider,
                                           Draft draft,
                                           com.atlassian.user.User user,
                                           boolean notifySelf)
Description copied from interface: PageService
Retrieve a command for creating a new page for the specified user.

Specified by:
newCreatePageCommand in interface PageService
Parameters:
provider - an object that will provide the page to be created.
permissionProvider - provide the permissions to be applied to the created page.
contextProvider - an object that can provide a context to be included when publishing the page creation event
user - the user creating this page
notifySelf - a flag indicating whether the user wants to be notified about this page creation.
Returns:
a CreatePageCommand for creating the specified page.

newCreatePageCommand

@Deprecated
public ServiceCommand newCreatePageCommand(PageProvider provider,
                                                      ContentPermissionProvider permissionProvider,
                                                      Draft draft,
                                                      com.atlassian.user.User user,
                                                      boolean notifySelf)
Deprecated. 

Description copied from interface: PageService
Retrieve a command for creating a new page for the specified user.

Specified by:
newCreatePageCommand in interface PageService
Parameters:
provider - an object that will provide the page to be created.
permissionProvider - provide the permissions to be applied to the created page.
user - the user creating this page
notifySelf - a flag indicating whether the user wants to be notified about this page creation.
Returns:
a CreatePageCommand for creating the specified page.

newCreatePageCommandFromExisting

@Deprecated
public ServiceCommand newCreatePageCommandFromExisting(PageProvider provider,
                                                                  ContentPermissionProvider permissionProvider,
                                                                  Draft draft,
                                                                  com.atlassian.user.User user,
                                                                  boolean notifySelf)
Deprecated. 

Description copied from interface: PageService

This is not a public API method! Creating a page from an existing page has different authorisation and validation logic from creating a brand new page. This method allows creation of a command that implements that difference in logic. Apart from that the command created here will have the same logic as that created by PageService.newCreatePageCommand(PageProvider, ContentPermissionProvider, Draft, User, boolean).

This logic in this command originates from CopyPageAction which differs from that of CreatePageAction.

I hope that when we get a chance to analyse why CopyPageAction has different permission and validation logic we will eventually remove this method.

Specified by:
newCreatePageCommandFromExisting in interface PageService
Parameters:
provider - an object that will provide the page to be created.
permissionProvider - provide the permissions to be applied to the created page.
draft - the draft associated with the copy, if present.
user - the user creating this page
notifySelf - a flag indicating whether the user wants to be notified about this page creation. @return a CreatePageCommand for creating the specified page.

newCreatePageCommandFromExisting

public ServiceCommand newCreatePageCommandFromExisting(PageProvider provider,
                                                       ContentPermissionProvider permissionProvider,
                                                       Draft draft,
                                                       com.atlassian.user.User user,
                                                       boolean notifySelf,
                                                       SpaceProvider spaceProvider)
Description copied from interface: PageService

This is not a public API method! Creating a page from an existing page has different authorisation and validation logic from creating a brand new page. This method allows creation of a command that implements that difference in logic. Apart from that the command created here will have the same logic as that created by PageService.newCreatePageCommand(PageProvider, ContentPermissionProvider, Draft, User, boolean).

This logic in this command originates from CopyPageAction which differs from that of CreatePageAction.

I hope that when we get a chance to analyse why CopyPageAction has different permission and validation logic we will eventually remove this method.

Specified by:
newCreatePageCommandFromExisting in interface PageService
Parameters:
provider - an object that will provide the page to be created.
permissionProvider - provide the permissions to be applied to the created page.
draft - the draft associated with the copy, if present.
user - the user creating this page
notifySelf - a flag indicating whether the user wants to be notified about this page creation. @return a CreatePageCommand for creating the specified page.
spaceProvider - provide the space where page will be created.

newCreatePageCommand

@Deprecated
public ServiceCommand newCreatePageCommand(PageProvider provider,
                                                      ContentPermissionProvider permissionProvider,
                                                      com.atlassian.user.User user,
                                                      boolean notifySelf)
Deprecated. 

Description copied from interface: PageService
Retrieve a command for creating a new page for the specified user.

Specified by:
newCreatePageCommand in interface PageService
Parameters:
provider - an object that will provide the page to be created.
permissionProvider - provide the permissions to be applied to the created page.
user - the user creating this page
notifySelf - a flag indicating whether the user wants to be notified about this page creation.
Returns:
a CreatePageCommand for creating the specified page.

setPermissionManager

public void setPermissionManager(PermissionManager permissionManager)


Copyright © 2003-2014 Atlassian. All Rights Reserved.