nl.gx.webmanager.services.seo.impl
Class SEOServiceImpl

java.lang.Object
  extended by nl.gx.webmanager.services.seo.impl.SEOServiceImpl
All Implemented Interfaces:
InternalSEOService, SEOService

public final class SEOServiceImpl
extends java.lang.Object
implements SEOService, InternalSEOService

Provides concrete implementation of the SEOService and the InternalSEOService interfaces.

Author:
Hallo Khaznadar, Sander Dahlberg

Constructor Summary
SEOServiceImpl()
           
 
Method Summary
 void activateFriendlyURL(MediaItemVersion mediaItemVersion)
          Activates the friendly URL of the given media item version.
 void activateFriendlyURL(PageVersion pageVersion)
          Activates the friendly URL of the given page version.
 void createFriendlyURL(MediaItemVersion mediaItemVersion)
          Creates a new friendly URL for the given media item version.
 void createFriendlyURL(PageVersion pageVersion)
          Creates a new friendly URL for the given page version.
 void createFriendlyURL(ResourceInstance resourceInstance, java.lang.String urlTitle)
          Creates a new friendly URL for the given resource instance with the specified entity title.
 void deleteFriendlyURL(int id)
          DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.
 void deleteFriendlyURL(MediaItem mediaItem)
          Deletes the friendly URL for the given media item.
 void deleteFriendlyURL(MediaItemVersion mediaItemVersion)
          Deletes the friendly URL for the given media item version.
 void deleteFriendlyURL(Page page)
          Deletes all friendly URLs for the given page.
 void deleteFriendlyURL(PageVersion pageVersion)
          Deletes the friendly URL for the given page version.
 void deleteFriendlyURL(ResourceInstance resourceInstance)
          Deletes the friendly URL for the given resource instance.
 ConfigurationManagement getConfigManager()
          Provides the ConfigurationManagement service.
 MediaItemVersion getCurrent(MediaItem mediaItem)
          
 PageVersion getCurrent(Page page, Language language)
          Returns the current page version given the page and a language.
 DataSourceManager getDataSourceManager()
          Provides the DataSourceManager service.
 java.lang.String getDBPageFriendlyURL(int dbId, int typeOfPageId, java.lang.String host)
          DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.
 java.lang.String getFriendlyURL(MediaItemVersion mediaItemVersion, Website website)
          Deprecated. 
 java.lang.String getFriendlyURL(PageVersion pageVersion)
          Returns the friendly URL of the given page version.
 java.lang.String getFriendlyURL(PageVersion pageVersion, MediaItemVersion mediaItemVersion)
          Returns the friendly URL of the given media item version shown on the given page version.
 java.lang.String getFriendlyURL(PageVersion pageVersion, ResourceInstance resourceInstance)
          Returns the friendly URL of the given resource instance shown on the given page version.
 java.lang.String getFriendlyURL(ResourceInstance resourceInstance)
          Deprecated. 
 java.lang.String getFriendlyURL(java.lang.String internalURL, java.lang.String host)
          Returns the friendly URL given an internal URL.
 FriendlyURLEntity getFriendlyURLEntity(MediaItemVersion mediaItemVersion)
          Returns the friendly URL entity for the given media item version.
 FriendlyURLEntity getFriendlyURLEntity(PageVersion pageVersion)
          Returns the friendly URL entity for the given page version.
 FriendlyURLEntity getFriendlyURLEntity(ResourceInstance resourceInstance)
          Returns the friendly URL entity for the given resource instance.
 java.lang.String getMediaItemBaseEntityURLTitle(int mediaItemVersionId)
          DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.
 java.lang.String getMediaItemFriendlyURL(int mediaItemVersionId, java.lang.String host)
          DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.
 java.lang.String getMediaItemTitle(MediaItemVersion mediaItemVersion)
          Returns the input string used for generating the friendly URL for this media item version.
 PageFriendlyURLEntityDAO getPageEntityDAO()
          Returns reference to the page friendly URL entity DAO.
 java.lang.String getPageFriendlyURL(int pageVersionId, java.lang.String host)
          DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.
 java.lang.String getPageTitle(PageVersion pageVersion)
          Returns the title used for generating the friendly URL for this page version.
 java.lang.String getTargetURL(java.lang.String url, java.lang.String host)
          Calculates the targeted internal URL given a relative friendly URL and a host name, or the current Friendly URL when given an old friendly URL, or returns an empty String when no match can be found.
 boolean isFriendlyURL(java.lang.String url, java.lang.String host)
          Checks whether the given URL is a friendly URL.
 boolean isGoogleNewsIdOn(java.lang.String host)
          Returns true if the Google News id feature is activated.
 void moveFriendlyURL(Page page, Page sourceParentPage)
          Handles the effect of a page move on the friendly URL of the page and all its descendant pages.
 void publishFriendlyURL(MediaItemVersion mediaItemVersion)
          Handles the effect of a media item version roll over on the friendly URL of the media item version.
 void publishFriendlyURL(PageVersion pageVersion)
          Handles the effect of a public version roll over on friendly URLs of descendant pages.
 void start()
          Implements start method which will be invoked by the frame work each time this Service get started.
this method will initialize all required resources for this service.
 void stop()
          Implements stop method which will be invoked by the frame work each time this Service get stopped.
 java.lang.String translateTitleToFriendlyURL(java.lang.String title, java.lang.String host)
          DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.
 java.lang.String translateTitleToURLIdentifier(java.lang.String title)
          DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.
 java.lang.String translateTitleToURLTitle(java.lang.String title)
          DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.
 void updateAlternativePath(PageVersion pageVersion)
          Updates the friendly URL for the given page version according to its alternative path.
 void updateFriendlyURL(MediaItemVersion mediaItemVersion)
          Updates the friendly URL for the given media item version.
 void updateFriendlyURL(MediaItemVersion mediaItemVersion, java.lang.String urlTitleOverrule)
          Deprecated. 
 void updateFriendlyURL(PageVersion pageVersion)
          Updates the friendly URL for the given page version.
 void updateFriendlyURL(ResourceInstance resourceInstance, java.lang.String urlTitle)
          Updates the friendly URL for the given resource instance using the given URL title.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SEOServiceImpl

public SEOServiceImpl()
Method Detail

start

public void start()
Implements start method which will be invoked by the frame work each time this Service get started.
this method will initialize all required resources for this service.


stop

public void stop()
Implements stop method which will be invoked by the frame work each time this Service get stopped. this method will release unwanted resources when this service is stopped.


getTargetURL

public java.lang.String getTargetURL(java.lang.String url,
                                     java.lang.String host)
Calculates the targeted internal URL given a relative friendly URL and a host name, or the current Friendly URL when given an old friendly URL, or returns an empty String when no match can be found. For articles holds that if the friendly url is not live, then also an empty is returned.

Specified by:
getTargetURL in interface SEOService
Parameters:
url - The relative friendly URL for which the internal URL is requested.
host - the host name.
Returns:
the target URL if any can be found.

getFriendlyURL

public java.lang.String getFriendlyURL(java.lang.String internalURL,
                                       java.lang.String host)
                                throws FriendlyURLException
Returns the friendly URL given an internal URL. The internal URL must at least contain the id and langid components. If not or there is no friendly URL matching these components then the internal URL itself is returned. Optionally the internal URL might contain the contentid component for media items or dbid and typeofpage components for database pages (resource instances), which are replaced by their friendly variant.

The host specifies some website specific configuration settings that are applied to the friendly URL. These are:

Example:
Given the friendly URL mappings of '&id=41323&langid=42' on 'My News' and '&contentid=4' on 'New and improved SEO in WebManager', and given the configuration where friendly URL prefix is '/gx', the Google News id is switched on, the friendly URL separator is '-' and the friendly URL extension is '.htm' for a website with host name 'www.gxwebmanager.com':

getFriendlyURL("/web/show?id=41323&langid=42&contentid=4&post=true", "www.gxwebmanager.com")
results in: /gx/My-News/004/New-and-improved-SEO-in-WebManager.htm?post=true

Note that the internal URL is allowed to be absolute. There is no validation though that the host name in an absolute internal URL matches the website of the specified host.

Specified by:
getFriendlyURL in interface SEOService
Parameters:
internalURL - The internal WebManager URL to translate to a friendly URL.
host - The host of the website to retrieve some configuration values from.
Returns:
A friendly URL if at least the id and langid components can be replaced by friendly variants, or else the internal URL.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

isFriendlyURL

public boolean isFriendlyURL(java.lang.String url,
                             java.lang.String host)
Checks whether the given URL is a friendly URL. An URL is defined to be friendly if and only if the URL ends with the friendly URL extension. The friendly URL extension can be configured separately for each website. As a host name can only be used for one website the host name parameter specifies for which website to check the friendly URL extension settings.

Setting this value can be done through the configuration key website_settings.friendly_url_extension.

Specified by:
isFriendlyURL in interface SEOService
Parameters:
url - Input URL to check whether it is a friendly URL. Can be absolute or relative.
host - Host name of the website to check its friendly URL extension for.
Returns:
true if the website_settings.friendly_url_extension configuration setting equals the last part after the '.' in the given URL, false otherwise.

isGoogleNewsIdOn

public boolean isGoogleNewsIdOn(java.lang.String host)
Returns true if the Google News id feature is activated. This feature can be switched on or off per website, specified by one of the website's host names.

Setting this value can be done through the configuration key website_settings.friendly_url_google_news_id.

Specified by:
isGoogleNewsIdOn in interface SEOService
Parameters:
host - Host name of the website to check this configuration option.
Returns:
true if the google_news_id for the current web initiative is checked, false otherwise.

activateFriendlyURL

public void activateFriendlyURL(MediaItemVersion mediaItemVersion)
                         throws FriendlyURLException
Activates the friendly URL of the given media item version. Once a friendly URL is activated the application won't overwrite this friendly URL if it is updated through SEOService.updateFriendlyURL(MediaItemVersion). The friendly URL is only activated if the given media item version is in a public state.

When a friendly URL is activated a history of friendly URLs is build after subsequent updates. Maintaining this history makes it possible to keep these old friendly URLs accessible. Old URLs typically come from bookmarks and search engines.

It is a good habit to change its title as long as its not public, and try to minimize title changes after it is in a public state. This avoids a lot of default title claims (see SEOService.createFriendlyURL(MediaItemVersion)) and a big history of friendly URLs.

Specified by:
activateFriendlyURL in interface SEOService
Parameters:
mediaItemVersion - Activate the friendly URL of this media item version.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

activateFriendlyURL

public void activateFriendlyURL(PageVersion pageVersion)
                         throws FriendlyURLException
Activates the friendly URL of the given page version. Once a friendly URL is activated the application won't overwrite this friendly URL if it is updated through SEOService.updateFriendlyURL(PageVersion). The friendly URL is only activated if the given page version is in a public state.

When a friendly URL is activated a history of friendly URLs is build after subsequent updates. Maintaining this history makes it possible to keep these old friendly URLs accessible. Old URLs typically come from book marks and search engines.

It is a good habit to change its title as long as its not public, and try to minimize title changes after it is in a public state. This avoids a lot of default title claims (see SEOService.createFriendlyURL(PageVersion)) and a big history of friendly URLs.

Specified by:
activateFriendlyURL in interface SEOService
Parameters:
pageVersion - Activate the friendly URL of this page version.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

publishFriendlyURL

public void publishFriendlyURL(PageVersion pageVersion)
                        throws FriendlyURLException
Handles the effect of a public version roll over on friendly URLs of descendant pages. This method does not in any way alter the friendly URL of the given page version, but might for all its descendants. Makes sure that all page versions refer to the current, or if not available, planned page version.

If the current version of the given page version's page is not null then all descendant page's friendly URLs are updated, so that the friendly URL of the given page version is substituted in their paths. If there was no current page version previously the friendly URL of the given page version in inserted in their paths. If there is no current page version now the previous friendly URL is removed from their paths.

Specified by:
publishFriendlyURL in interface SEOService
Parameters:
pageVersion - Publish the friendly URL of this page version.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

publishFriendlyURL

public void publishFriendlyURL(MediaItemVersion mediaItemVersion)
                        throws FriendlyURLException
Handles the effect of a media item version roll over on the friendly URL of the media item version. Makes sure that all media item versions refer to the current, or if not available, planned media item version.

Specified by:
publishFriendlyURL in interface SEOService
Parameters:
mediaItemVersion - Publish the friendly URL of this media item version.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

createFriendlyURL

public void createFriendlyURL(PageVersion pageVersion)
                       throws FriendlyURLException
Creates a new friendly URL for the given page version. Assumes the given page version does not have a friendly URL already. If the given page version already has a friendly URL then a FriendlyURLException is thrown. Also, the given page version must be of type Page.PAGE_TYPE, or else an IllegalArgumentException is thrown.

Depending on which meta data field of the page version is used as input (see SEOService.getPageTitle(PageVersion)) an entity URL is generated from it. The complete friendly URL of the page version consists of this entity URL and a path of all the parent page's friendly URLs. Only those parent pages are involved which have a page version for the same language as the given page version. Also the home page is excluded from those parent pages.

Example:
Assume three pages titled Home, News and Economy. Home is the home page, News is a child of Home, and Economy is a child of News. Creating a child page of Economy results in the following call and friendly URL:

mySEOService.createFriendlyURL(economyPage)

Resulting friendly URL: /News/Economy/New-Page.htm

Try to avoid calling this method a lot at once, without changing the URL title. Each newly created version has the same default title, so they will all claim the same friendly URL. In effect sequence numbers are appended to these friendly URLs to make them unique, resulting in a bit less friendly URLs.

Also, avoid publishing the newly created version, before changing its default title. A published version does never release its current friendly URL automatically, even if it is changed afterwards.

Specified by:
createFriendlyURL in interface SEOService
Parameters:
pageVersion - Create a friendly URL for this page version.
Throws:
FriendlyURLException - If any access to the persistent layer failed.
See Also:
#createFriendlyURL(MediaItemVersion)}, #createFriendlyURL(ResourceInstance, String)}, #getPageTitle(PageVersion)}

createFriendlyURL

public void createFriendlyURL(MediaItemVersion mediaItemVersion)
                       throws FriendlyURLException
Creates a new friendly URL for the given media item version. Assumes the given media item version does not have a friendly URL already. If the given media item version already has a friendly URL then a FriendlyURLException is thrown.

Try to avoid calling this method a lot at once, without changing the URL title. Each newly created version has the same default title, so they will all claim the same friendly URL. In effect sequence numbers are appended to these friendly URLs to make them unique, resulting in a bit less friendly URLs.

Also, avoid publishing the newly created version, before changing its default title. A published version does never release its current friendly URL automatically, even if it is changed afterwards.

Specified by:
createFriendlyURL in interface SEOService
Parameters:
mediaItemVersion - Create a friendly URL for this media item version.
Throws:
FriendlyURLException - Occurs in case the friendly URL could not be persisted.
See Also:
#createFriendlyURL(PageVersion)}, #createFriendlyURL(ResourceInstance, String)}

createFriendlyURL

public void createFriendlyURL(ResourceInstance resourceInstance,
                              java.lang.String urlTitle)
                       throws FriendlyURLException
Creates a new friendly URL for the given resource instance with the specified entity title. Assumes the given resource instance does not have a friendly URL already. If the given resource instance already has a friendly URL then a FriendlyURLException is thrown.

The entity title parameter should be an unformatted string, that is, the exact title given to the resource instance including any diacritical characters or spaces.

Example: mySEOService.createFriendlyURL(resourceInstance, "Marco van Basten")

Specified by:
createFriendlyURL in interface SEOService
Parameters:
resourceInstance - Create a friendly URL for this resource instance.
urlTitle - Use this entity title as input for the friendly URL.
Throws:
FriendlyURLException - Occurs in case the friendly URL could not be persisted.
See Also:
#createFriendlyURL(PageVersion)}, #createFriendlyURL(MediaItemVersion)}

updateFriendlyURL

public void updateFriendlyURL(PageVersion pageVersion)
                       throws FriendlyURLException
Updates the friendly URL for the given page version. Assumes the given page version already has a friendly URL. Only has effect when the meta data field of the page version used for input has changed (see SEOService.getPageTitle(PageVersion)).

The friendly URL that is overwritten is not released, but becomes part of the history of friendly URLs of the given page version. If a website visitor requests a friendly URL from the history then the SEO application redirects to the most up-to-date friendly URL.

An exception on this is that as long as the given page version is not public (and also has never been), the friendly URL is overwritten. A page version is defined to be public whenever the work flow state of the page version is set to a public state. It is therefore good habit to change its title as long as its not public, and try to minimize title changes after it is in a public state.

Specified by:
updateFriendlyURL in interface SEOService
Parameters:
pageVersion - Update the friendly URL of this page version.
Throws:
FriendlyURLException - Occurs in case the friendly URL could not be persisted.
See Also:
#updateFriendlyURL(MediaItemVersion)}, #updateFriendlyURL(MediaItemVersion, String))}

updateFriendlyURL

public void updateFriendlyURL(MediaItemVersion mediaItemVersion)
                       throws FriendlyURLException
Updates the friendly URL for the given media item version. Assumes the given media item version already has a friendly URL. The title field of the media item version is used as input for the friendly URL. To overrule this use SEOService.updateFriendlyURL(MediaItemVersion, String).

The friendly URL that is overwritten is not released, but becomes part of the history of friendly URLs of the given media item version. If a website visitor requests a friendly URL from the history then the SEO application redirects to the most up-to-date friendly URL.

An exception on this is that as long as the given media item version is not public (and also has never been), the friendly URL is overwritten. A media item version is defined to be public whenever the work flow state of the media item version is set to a public state. It is therefore good habit to change its title as long as its not public, and try to minimize title changes after it is in a public state.

Specified by:
updateFriendlyURL in interface SEOService
Parameters:
mediaItemVersion - Update the friendly URL of this media item version.
Throws:
FriendlyURLException - Occurs in case the friendly URL could not be persisted.
See Also:
#updateFriendlyURL(MediaItemVersion, String))}, #updateFriendlyURL(PageVersion)}

deleteFriendlyURL

public void deleteFriendlyURL(MediaItemVersion mediaItemVersion)
                       throws FriendlyURLException
Deletes the friendly URL for the given media item version. Next to the current friendly URL also the complete history of friendly URLs of this media item version is deleted.

Specified by:
deleteFriendlyURL in interface SEOService
Throws:
FriendlyURLException - If any access to the persistent layer failed.

updateFriendlyURL

@Deprecated
public void updateFriendlyURL(MediaItemVersion mediaItemVersion,
                                         java.lang.String urlTitleOverrule)
                       throws FriendlyURLException
Deprecated. 

Updates the friendly URL for the given media item version using the given URL title. Assumes the given media item version already has a friendly URL. Uses the explicitly passed URL title overrule as input for generating the friendly URL.

This method is deprecated as it is a work around for the MediaItemVersion lacking an URL title overrule field.

Specified by:
updateFriendlyURL in interface SEOService
Parameters:
mediaItemVersion - Update the friendly URL of this media item version.
urlTitleOverrule - The string used as input for creating the friendly URL.
Throws:
FriendlyURLException - Occurs in case the friendly URL could not be persisted.
See Also:
#updateFriendlyURL(MediaItemVersion)}

updateFriendlyURL

public void updateFriendlyURL(ResourceInstance resourceInstance,
                              java.lang.String urlTitle)
                       throws FriendlyURLException
Updates the friendly URL for the given resource instance using the given URL title. Assumes the given resource instance already has a friendly URL.

Specified by:
updateFriendlyURL in interface SEOService
Parameters:
resourceInstance - Update the friendly URL of this resource instance.
urlTitle - The string used as input for creating the friendly URL.
Throws:
FriendlyURLException - Occurs in case the friendly URL could not be persisted.

deleteFriendlyURL

public void deleteFriendlyURL(MediaItem mediaItem)
                       throws FriendlyURLException
Deletes the friendly URL for the given media item. Next to the current friendly URL also the complete history of friendly URLs of this media item is deleted.

Specified by:
deleteFriendlyURL in interface SEOService
Parameters:
mediaItem - Delete the friendly URL for this media item.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

deleteFriendlyURL

public void deleteFriendlyURL(Page page)
                       throws FriendlyURLException
Deletes all friendly URLs for the given page. Next to each language version's current friendly URL also the complete history of friendly URLs of this page is deleted.

Specified by:
deleteFriendlyURL in interface SEOService
Parameters:
page - Delete all friendly URLs of this page.
Throws:
FriendlyURLException - Occurs in case the friendly URL could not be persisted.

deleteFriendlyURL

public void deleteFriendlyURL(PageVersion pageVersion)
                       throws FriendlyURLException
Deletes the friendly URL for the given page version. Next to the current friendly URL also the complete history of friendly URLs of this page version is deleted.

Specified by:
deleteFriendlyURL in interface SEOService
Parameters:
pageVersion - Delete the friendly URL for this page version.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

deleteFriendlyURL

public void deleteFriendlyURL(ResourceInstance resourceInstance)
                       throws FriendlyURLException
Deletes the friendly URL for the given resource instance. Next to the current friendly URL also the complete history of friendly URLs of this resource instance is deleted.

Specified by:
deleteFriendlyURL in interface SEOService
Parameters:
resourceInstance - Delete the friendly URL for this resource instance.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

moveFriendlyURL

public void moveFriendlyURL(Page page,
                            Page sourceParentPage)
                     throws FriendlyURLException
Handles the effect of a page move on the friendly URL of the page and all its descendant pages. Assumes the move already happened, so that the source parent page must be passed in to be able to detect that a move actually happened. If the given page happens to be the home page then an IllegalArgumentException is thrown.

Specified by:
moveFriendlyURL in interface SEOService
Parameters:
page - Move the friendly URL for this page.
sourceParentPage - The parent page the given page previously was a child of.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

updateAlternativePath

public void updateAlternativePath(PageVersion pageVersion)
                           throws FriendlyURLException
Updates the friendly URL for the given page version according to its alternative path. A page version can be given an explicit path, different from the path constructed from its parent pages. This alternative path is obtained by PageVersion.getAlternativeURLPath().

If the alternative path is set to an empty string then its normal path is used.

Specified by:
updateAlternativePath in interface SEOService
Parameters:
pageVersion - Update the friendly URL of this page version.
Throws:
FriendlyURLException - Occurs in case the friendly URL could not be persisted.

getFriendlyURLEntity

public FriendlyURLEntity getFriendlyURLEntity(MediaItemVersion mediaItemVersion)
                                       throws FriendlyURLException
Returns the friendly URL entity for the given media item version.

Specified by:
getFriendlyURLEntity in interface SEOService
Parameters:
mediaItemVersion - Return the friendly URL of this media item version.
Returns:
The friendly URL entity for the given media item version.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

getFriendlyURLEntity

public FriendlyURLEntity getFriendlyURLEntity(PageVersion pageVersion)
                                       throws FriendlyURLException
Returns the friendly URL entity for the given page version.

Specified by:
getFriendlyURLEntity in interface SEOService
Parameters:
pageVersion - Return the friendly URL of this page version.
Returns:
The friendly URL entity for the given page version.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

getFriendlyURLEntity

public FriendlyURLEntity getFriendlyURLEntity(ResourceInstance resourceInstance)
                                       throws FriendlyURLException
Returns the friendly URL entity for the given resource instance.

Specified by:
getFriendlyURLEntity in interface SEOService
Parameters:
resourceInstance - Return the friendly URL of this resource instance.
Returns:
The friendly URL entity for the given resource instance.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

getFriendlyURL

@Deprecated
public java.lang.String getFriendlyURL(MediaItemVersion mediaItemVersion,
                                                  Website website)
                                throws FriendlyURLException
Deprecated. 

Returns the friendly URL of the given media item version.

Specified by:
getFriendlyURL in interface SEOService
Parameters:
mediaItemVersion - Get the friendly URL for this media item version.
website - Use friendly URL configuration values from this website.
Returns:
The friendly URL for the given media item version.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

getFriendlyURL

public java.lang.String getFriendlyURL(PageVersion pageVersion)
                                throws FriendlyURLException
Returns the friendly URL of the given page version. The URL is relative starting with the friendly URL prefix and ending with the friendly URL extension. The middle part consists of a slash separated path of pages.

Assuming default settings /web as prefix and .htm as extension a second level page titled 'Today', with parent page named 'News' will result in the friendly URL: /web/News/Today.htm.

Specified by:
getFriendlyURL in interface SEOService
Parameters:
pageVersion - Get the friendly URL for this page version.
Returns:
The friendly URL for the given page version.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

getFriendlyURL

public java.lang.String getFriendlyURL(PageVersion pageVersion,
                                       MediaItemVersion mediaItemVersion)
                                throws FriendlyURLException
Returns the friendly URL of the given media item version shown on the given page version. The URL is relative starting with the friendly URL prefix and ending with the friendly URL extension. The middle part consists of a slash separated path of pages ending with a slash and the title of the media item version.

Assuming default settings /web as prefix and .htm as extension a second level page titled 'Today', with parent page named 'News' and a media item version titled 'Booming Economy'. will result in the friendly URL: /web/News/Today/BoomingEconomy.htm.

Specified by:
getFriendlyURL in interface SEOService
Parameters:
pageVersion - The friendly URL consists of a path of pages till this page version.
mediaItemVersion - Get the friendly URL for this media item version.
Returns:
The friendly URL for the given media item version shown on the given page version.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

getFriendlyURL

public java.lang.String getFriendlyURL(PageVersion pageVersion,
                                       ResourceInstance resourceInstance)
                                throws FriendlyURLException
Returns the friendly URL of the given resource instance shown on the given page version. The URL is relative starting with the friendly URL prefix and ending with the friendly URL extension. The middle part consists of a slash separated path of pages ending with a slash and the title of the resource instance.

Assuming default settings /web as prefix and .htm as extension a second level page titled 'Netherlands', with parent page named 'Competitions' and a resource instance titled 'Ajax'. will result in the friendly URL: /web/Competitions/Netherlands/Ajax.htm.

Specified by:
getFriendlyURL in interface SEOService
Parameters:
pageVersion - The friendly URL consists of a path of pages till this page version.
resourceInstance - Get the friendly URL for this resource instance shown on the given page version.
Returns:
The friendly URL for the given resource instance shown on the given page version.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

getFriendlyURL

@Deprecated
public java.lang.String getFriendlyURL(ResourceInstance resourceInstance)
                                throws FriendlyURLException
Deprecated. 

Returns the friendly URL of the given resource instance.

Specified by:
getFriendlyURL in interface SEOService
Parameters:
resourceInstance - Get the friendly URL for this resource instance.
Returns:
The friendly URL for the given resource instance.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

getDBPageFriendlyURL

public java.lang.String getDBPageFriendlyURL(int dbId,
                                             int typeOfPageId,
                                             java.lang.String host)
                                      throws FriendlyURLException
DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.

Specified by:
getDBPageFriendlyURL in interface SEOService
Parameters:
dbId - Get the friendly URL for this db id and the type of page id.
typeOfPageId - Get the friendly URL for this type of page id and the db id.
host - The host for which the db id and type of page id are valid.
Returns:
The friendly URL for the given db id and type of page id.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

getMediaItemFriendlyURL

public java.lang.String getMediaItemFriendlyURL(int mediaItemVersionId,
                                                java.lang.String host)
                                         throws FriendlyURLException
DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.

Specified by:
getMediaItemFriendlyURL in interface SEOService
Parameters:
mediaItemVersionId - Get the friendly URL for this media item version id.
host - The host for which the media item version id is valid.
Returns:
The friendly URL for the given media item version id.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

getPageFriendlyURL

public java.lang.String getPageFriendlyURL(int pageVersionId,
                                           java.lang.String host)
                                    throws FriendlyURLException
DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.

Specified by:
getPageFriendlyURL in interface SEOService
Parameters:
pageVersionId - Get the friendly URL for this page version id.
host - The host for which the page version id is valid.
Returns:
The friendly URL for the given page version id.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

getMediaItemBaseEntityURLTitle

public java.lang.String getMediaItemBaseEntityURLTitle(int mediaItemVersionId)
                                                throws FriendlyURLException
DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.

Specified by:
getMediaItemBaseEntityURLTitle in interface SEOService
Parameters:
mediaItemVersionId - Get the base entity URL title for this media item version id.
Returns:
The base entity URL title for this media item version id.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

deleteFriendlyURL

public void deleteFriendlyURL(int id)
                       throws FriendlyURLException
DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.

Specified by:
deleteFriendlyURL in interface SEOService
Parameters:
id - Delete the friendly URL entity with this id.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

translateTitleToFriendlyURL

public java.lang.String translateTitleToFriendlyURL(java.lang.String title,
                                                    java.lang.String host)
                                             throws FriendlyURLException
DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.

Specified by:
translateTitleToFriendlyURL in interface SEOService
Parameters:
title - Translate this title to a friendly URL.
host - Translate the title given the configuration for this host.
Returns:
Friendly URL variant of the title.
Throws:
FriendlyURLException - If any access to the persistent layer failed.

translateTitleToURLIdentifier

public java.lang.String translateTitleToURLIdentifier(java.lang.String title)
DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.

Specified by:
translateTitleToURLIdentifier in interface SEOService
Parameters:
title - Translate this title to an URL identifier.
Returns:
URL identifier of the title.

translateTitleToURLTitle

public java.lang.String translateTitleToURLTitle(java.lang.String title)
DO NOT USE THIS METHOD OUTSIDE PRODUCT DEPARTMENT.

Specified by:
translateTitleToURLTitle in interface SEOService
Parameters:
title - Translate this title to an URL title.
Returns:
URL title of the title.

getConfigManager

public ConfigurationManagement getConfigManager()
Provides the ConfigurationManagement service.

Specified by:
getConfigManager in interface InternalSEOService
Returns:
Reference to the ConfigurationManagement service.

getDataSourceManager

public DataSourceManager getDataSourceManager()
Provides the DataSourceManager service.

Specified by:
getDataSourceManager in interface InternalSEOService
Returns:
Reference to the DataSourceManager service.

getCurrent

public PageVersion getCurrent(Page page,
                              Language language)
Returns the current page version given the page and a language. Different from Page.getCurrent(Language) in that it does not return results from the current cache.

Specified by:
getCurrent in interface InternalSEOService
Parameters:
page - Calculate current page version from this page.
language - Scope the results to this language.
Returns:
Current page version.

getCurrent

public MediaItemVersion getCurrent(MediaItem mediaItem)

Specified by:
getCurrent in interface InternalSEOService

getPageTitle

public java.lang.String getPageTitle(PageVersion pageVersion)
Returns the title used for generating the friendly URL for this page version. The returned string depends on the configuration value of key website_settings.friendly_url_setting. This key can be one of title, navigationtitle or urltitle. If left empty then the default is navigationtitle.

Specified by:
getPageTitle in interface InternalSEOService
Specified by:
getPageTitle in interface SEOService
Parameters:
pageVersion - Get the page title from this page version.
Returns:
The title string used as input for generating a friendly URL for this page version.

getMediaItemTitle

public java.lang.String getMediaItemTitle(MediaItemVersion mediaItemVersion)
Returns the input string used for generating the friendly URL for this media item version.

Specified by:
getMediaItemTitle in interface InternalSEOService
Parameters:
mediaItemVersion - Media item version.
Returns:
Raw friendly URL.

getPageEntityDAO

public PageFriendlyURLEntityDAO getPageEntityDAO()
Returns reference to the page friendly URL entity DAO.

Specified by:
getPageEntityDAO in interface InternalSEOService
Returns:
reference to the page friendly URL entity DAO.


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