nl.gx.webmanager.services.contentapi
Interface PageManagementService


public interface PageManagementService

This class offers APIs to create, move and delete pages and page sections.

Author:
ivol

Method Summary
 boolean addLeadText(PageModel pageModel)
          Adds a lead text to the given PageModel object.
 boolean addLeadText(PageVersion pageVersion)
          Adds a lead text to this page version.
 boolean addRedirect(PageVersion pageVersion)
          Adds a redirect to this page version.
 Page copyBlock(Page block, Page targetParentBlock)
          Copies a block and assigns the copy under the given target block.
 Page copyBlock(PageVersion blockVersion, Page targetParentBlock)
          Copies a block and assigns the copy under the given target block.
 Page copyPage(Page page, Page targetParentPage)
          Copies a page and assigns the copy under the given target page.
 Page copyPage(Page page, Page targetPage, boolean recursive)
          Copies the page including subpages to the targetpage.
 Page copyPage(PageVersion pageVersion, Page targetParentPage)
          Copies a page and assigns the copy under the given target page.
 PageModel copyPageModel(PageModel pageModel)
          Not implemented yet.
 PageVersion copyPageVersion(PageVersion pageVersion)
          Copies a page version.
 PageVersion copyPageVersion(PageVersion pageVersion, Language language)
          Copies a page version for the specified language.
 Page createAndInsertDatabasePage(Page page, DatabaseEntity databaseEntity)
          Creates a new database page below the given page as last page.
 Page createAndInsertPage(Page page)
          Creates a new subpage below the given page as last page.
 Page createAndInsertPage(Page page, int position)
          Creates a new subpage at the given position into the given page.
 Page createAndInsertPageFromPageModel(Page page, PageModel pageModel)
          Create and insert a new page based on a page model below the given page.
 Page createAndInsertPageFromPageModel(Page page, PageModel pageModel, int position)
          Create and insert a new page based on a page model below the given page at the given position.
 Page createAndInsertPageSection(Page page)
          Creates a new page section below the given page section as last page section.
 Page createAndInsertPageSectionFromPageModel(Page page, PageModel pageModel)
          Create and insert a new page section based on a page model below the given page section.
 Page createOrphanPage(Page page)
          Creates a new orphan page (page without a parent).
 PageModel createPageModel(Website website)
          Creates a new page model.
 PageVersion createPageVersion(Page page, Language language)
          Creates a new empty version of the specified page.
 PageVersion createPageVersion(PageVersion pageVersion, Language language)
          Creates a new version based on the specified page version.
 boolean deletePage(Page page, boolean recursive)
          Deletes a page completely, including all its subpages if recursive is true.
 boolean deletePageModel(PageModel pageModel)
          Deletes an existing page model.
 boolean deletePageVersion(PageVersion pageVersion, boolean recursive)
          Deletes a page version, including all its subpages if it is the last version of the page and recursive is true.
 boolean movePage(Page page, Page toPage)
          Moves a page to another parent page as last page below that parent page.
 boolean movePage(Page page, Page toPage, int position)
          Moves a page to another location.
 boolean moveToOrphanPages(Page page)
          Moves the page to the orphanage (orphanage contains all pages without a parent).
 void performPostUpdateActions(PageVersion pageVersion)
          Tells WebManager a page version has been updated.
 void performWorkflowAction(PageVersion pageVersion, WorkflowAction workflowAction)
          Performs the given workflowAction to progress this pageVersion to the next state.
 boolean reorderElements(PageModel pageModel, Element[] elements)
          Reorders all the elements of a page model.
 boolean reorderElements(PageVersion pageVersion, Element[] elements)
          Reorders all the elements of a page version.
 

Method Detail

createAndInsertPage

Page createAndInsertPage(Page page)
Creates a new subpage below the given page as last page.

Parameters:
page - Page to add the subpage to. May not be null.
Returns:
The created subpage or null if the page could not be created.

createAndInsertPage

Page createAndInsertPage(Page page,
                         int position)
Creates a new subpage at the given position into the given page.

Parameters:
page - Page to add the subpage to
position - Position at which the page should be inserted, -1 will add the page as last page below the parent page, -2 will add the page as orphan page.
Returns:
The created subpage or null if the page could not be created.

createOrphanPage

Page createOrphanPage(Page page)
Creates a new orphan page (page without a parent). The given page will be used to copy basic properties from like Workflow model and page configuration.

Parameters:
page - Page which will be used to base the new page on (for Workflow model and basic configuration). May not be null.
Returns:
The created subpage or null if the page could not be created.

createPageVersion

PageVersion createPageVersion(Page page,
                              Language language)
Creates a new empty version of the specified page.

Parameters:
page - Page to create the new page version for
language - Language to create the new version in. Specify null to create a new page version in the current editing language.
Returns:
The created page version

createPageVersion

PageVersion createPageVersion(PageVersion pageVersion,
                              Language language)
Creates a new version based on the specified page version. The metadata and elements are copied to the new page version.

Parameters:
pageVersion - Page version to create the new page version from
language - Language to create the new version in. Specify null to create a new page version in the current editing language.
Returns:
The created page version

createAndInsertPageSection

Page createAndInsertPageSection(Page page)
Creates a new page section below the given page section as last page section.

Parameters:
page - Page section to add the sub page section to. May not be null.
Returns:
The created sub page section or null if the page section could not be created.

createAndInsertDatabasePage

Page createAndInsertDatabasePage(Page page,
                                 DatabaseEntity databaseEntity)
Creates a new database page below the given page as last page.

Parameters:
page - Page to add the sub database page to. May not be null.
databaseEntity - Database page type to create the database page from
Returns:
The created sub database page or null if the database page could not be created.

createAndInsertPageFromPageModel

Page createAndInsertPageFromPageModel(Page page,
                                      PageModel pageModel)
Create and insert a new page based on a page model below the given page.

Parameters:
page - Page to add the sub page to. May not be null.
pageModel - Page model on which the new page is based
Returns:
The created sub page or null if the page could not be created.

createAndInsertPageFromPageModel

Page createAndInsertPageFromPageModel(Page page,
                                      PageModel pageModel,
                                      int position)
Create and insert a new page based on a page model below the given page at the given position.

Parameters:
page - Page to add the sub page to. May not be null.
pageModel - Page model on which the new page is based
position - Position at which the database page should be inserted, -1 will add the database page as last page below the parent page.
Returns:
The created sub page or null if the page could not be created.

createAndInsertPageSectionFromPageModel

Page createAndInsertPageSectionFromPageModel(Page page,
                                             PageModel pageModel)
Create and insert a new page section based on a page model below the given page section.

Parameters:
page - Page section to add the sub page section to. May not be null.
pageModel - Page model on which the new page section is based
Returns:
The created sub page section or null if the page section could not be created.

createPageModel

PageModel createPageModel(Website website)
Creates a new page model.

Parameters:
website - Website to create the page model for
Returns:
Returns the created page model object
Throws:
DuplicateNameException
HtmlObjectNotFoundException

copyPage

Page copyPage(Page page,
              Page targetParentPage)
              throws NoAuthorizationException
Copies a page and assigns the copy under the given target page. Copies a page version for each language (if there is a page version available for a language).
For each language the current page version is copied, which is the published version with the most recent publication date. If no published version is available, a non published version is copied with the most recent publication date.

If the parentTarget parameter is null then the copy will be assigned to the same parent as the source page, or if the source page has no parent the copy will be moved to the orphan pages pool.

Regarding authorization an user needs both CREATE and UPDATE permissions on pages, CREATE permission on page versions, and CREATE permissions on all the page version's elements.

For example, to copy the home page and its most current version as an orphan page: copyPage(homePage, homePage.getCurrent(), null).

Steps performed:

Parameters:
page - The page to copy. May not be null.
targetParentPage - The copy will be assigned under this page.
Returns:
The copied page.
Throws:
NoAuthorizationException - If user has no rights to copy the page.

copyPage

Page copyPage(PageVersion pageVersion,
              Page targetParentPage)
              throws NoAuthorizationException
Copies a page and assigns the copy under the given target page. The source page is specified by one of its page versions. Also, only that page version is copied.

Parameters:
pageVersion - The pageVersion which page to copy. May not be null.
targetParentPage - The copy will be assigned under this page.
Returns:
The copied page.
Throws:
NoAuthorizationException - If user has no rights to copy the page.

copyBlock

Page copyBlock(Page block,
               Page targetParentBlock)
               throws NoAuthorizationException
Copies a block and assigns the copy under the given target block. For further reading see copyPage(Page, Page).

Parameters:
block - The block to copy. May not be null.
targetParentBlock - The copy will be assigned under this block.
Returns:
The copied block.
Throws:
NoAuthorizationException - If user has no rights to copy the block.

copyBlock

Page copyBlock(PageVersion blockVersion,
               Page targetParentBlock)
               throws NoAuthorizationException
Copies a block and assigns the copy under the given target block. For further reading see copyPage(PageVersion, Page).

Parameters:
blockVersion - The block version for which its block to copy. May not be null.
targetParentBlock - The copy will be assigned under this block.
Returns:
The copied block.
Throws:
NoAuthorizationException - If user has no rights to copy the block.

copyPageVersion

PageVersion copyPageVersion(PageVersion pageVersion)
                            throws NoAuthorizationException
Copies a page version. The copied page version exists for the same page as the source page version, and the same language.

Parameters:
pageVersion - The page version to copy. May not be null.
Returns:
The copied page version.
Throws:
NoAuthorizationException - If user has no rights to copy the page version.

copyPageVersion

PageVersion copyPageVersion(PageVersion pageVersion,
                            Language language)
                            throws NoAuthorizationException
Copies a page version for the specified language. The copied page version exists for the same page as the source page version. Next to this, the copied page version is available for the given language. If the language parameter is null the copy exists for the same language as the source page version.

Parameters:
pageVersion - The page version to copy. May not be null.
language - The copy will be created for this language.
Returns:
The copied page version.
Throws:
NoAuthorizationException - If user has no rights to copy the page version.

copyPageModel

PageModel copyPageModel(PageModel pageModel)
                        throws NoAuthorizationException
Not implemented yet.

Parameters:
pageModel - Not implemented yet.
Returns:
Not implemented yet.
Throws:
NoAuthorizationException - If user has no rights to copy the page model.

copyPage

Page copyPage(Page page,
              Page targetPage,
              boolean recursive)
              throws NoAuthorizationException
Copies the page including subpages to the targetpage.

Parameters:
page - Page that will be copied, the root of the branch.
targetPage - Page under which the duplicated branch will be inserted.
recursive - Whether the complete subtree of pages should be copied also, or not.
Returns:
the last copied page
Throws:
NoAuthorizationException - If user has no rights to copy one of the pages.

movePage

boolean movePage(Page page,
                 Page toPage)
Moves a page to another parent page as last page below that parent page.

Parameters:
page - Page that will be moved.
toPage - Page under which the source page will be inserted.
Returns:
true if the move succeeded, false otherwise

moveToOrphanPages

boolean moveToOrphanPages(Page page)
Moves the page to the orphanage (orphanage contains all pages without a parent).

Parameters:
page - Page to move
Returns:
true if the move succeeded, false otherwise

movePage

boolean movePage(Page page,
                 Page toPage,
                 int position)
Moves a page to another location.

Parameters:
page - Page that will be moved
toPage - Page under which the source page will be inserted
position - New position at which the page should be moved into
Returns:
true if the move succeeded, false otherwise

deletePage

boolean deletePage(Page page,
                   boolean recursive)
Deletes a page completely, including all its subpages if recursive is true.

Parameters:
page - Page to delete
recursive - if true then all pages below this page are also deleted, if false only the page itself is deleted and all its first level subpages are moved to the orphan pages remaining the lower level structure
Returns:
true if the delete succeeded, false otherwise

deletePageVersion

boolean deletePageVersion(PageVersion pageVersion,
                          boolean recursive)
Deletes a page version, including all its subpages if it is the last version of the page and recursive is true.

Parameters:
pageVersion - PageVersion to delete. If this is the only version of the page, the page itself will also be deleted.
recursive - Only applicable if this is the last version of the page. If true then all pages below this page are also deleted, if false only the page itself is deleted and all its first level subpages are moved to the orphan pages remaining the lower level structure
Returns:
true if the delete succeeded, false otherwise

deletePageModel

boolean deletePageModel(PageModel pageModel)
Deletes an existing page model.

Parameters:
pageModel - Page model to delete
Returns:
true if the delete succeeded, false otherwise

addLeadText

boolean addLeadText(PageVersion pageVersion)
Adds a lead text to this page version.

Parameters:
pageVersion - Page version to add the lead text to
Returns:
true if adding the lead text succeeded, false otherwise

addLeadText

boolean addLeadText(PageModel pageModel)
Adds a lead text to the given PageModel object.

Parameters:
pageModel - PageModel object to add the lead text to.
Returns:
true if adding the lead text succeeded, false otherwise.

addRedirect

boolean addRedirect(PageVersion pageVersion)
Adds a redirect to this page version.

Parameters:
pageVersion - Page version to add the redirect to
Returns:
true if adding the redirect succeeded, false otherwise

reorderElements

boolean reorderElements(PageVersion pageVersion,
                        Element[] elements)
Reorders all the elements of a page version. The given elements defines the new ordering of elements. Note that there is no authorization required to reorder elements.

Before the reordering is applied to the given page version the original elements are checked with the new ordering to determine whether the elements are really reordered. If a reordering is needed then:

Parameters:
pageVersion - The page version which elements should be reordered.
elements - Elements that defines the new ordering of the page version's elements. The size of the elements array should match the number of the page version's elements
Returns:
Returns true if reorder is successful, false otherwise.
See Also:
#reorderElements(PageModel, Element[])}

reorderElements

boolean reorderElements(PageModel pageModel,
                        Element[] elements)
Reorders all the elements of a page model. The given elements defines the new ordering of elements. Note that there is no authorization required to reorder elements.

Parameters:
pageModel - The page model which elements should be reordered.
elements - Elements that defines the new ordering of the page model's elements. The size of the elements array should match the number of the page version's elements
Returns:
Returns true if reorder is successful, false otherwise.
See Also:
#reorderElements(PageVersion, Element[])}

performWorkflowAction

void performWorkflowAction(PageVersion pageVersion,
                           WorkflowAction workflowAction)
                           throws UnExecutableWorkflowActionException
Performs the given workflowAction to progress this pageVersion to the next state.

Parameters:
pageVersion - the pageVersion
workflowAction - the workflowAction
Throws:
UnExecutableWorkflowActionException - If the given workflow action is invalid.

performPostUpdateActions

void performPostUpdateActions(PageVersion pageVersion)
Tells WebManager a page version has been updated. Must be used after setting some properties of the page version to ensure that dependent components do their job.

Currently the SEO service (Search Engine Optimization) is instructed to update the page version's friendly URL if necessary.

Parameters:
pageVersion - The page version that has been updated.


Copyright © 2007-2011 GX Software BV. All Rights Reserved.