nl.gx.webmanager.services.seo.entity.impl
Class FriendlyURLEntityImpl

java.lang.Object
  extended by nl.gx.webmanager.services.seo.entity.impl.FriendlyURLEntityImpl
All Implemented Interfaces:
FriendlyURLEntityMutator, FriendlyURLEntity
Direct Known Subclasses:
DBPageFriendlyURLEntityImpl, MediaItemFriendlyURLEntityImpl, PageFriendlyURLEntityImpl

public class FriendlyURLEntityImpl
extends java.lang.Object
implements FriendlyURLEntityMutator

A FriendlyURLEntity represents (part of) a friendly URL. It consists of a mapping of its URL identifier and website ID onto an internal location formed by a query string. There are three types of content that can have a friendly URL: pages, media items and resource instances. Therefore, this class is subclassed to represent any of these types of content: PageFriendlyURLEntity, MediaItemFriendlyURLEntity and DBPageFriendlyURLEntity.

Author:
Sander Dahlberg

Nested Class Summary
 
Nested classes/interfaces inherited from interface nl.gx.webmanager.services.seo.FriendlyURLEntity
FriendlyURLEntity.ContentType
 
Field Summary
 
Fields inherited from interface nl.gx.webmanager.services.seo.FriendlyURLEntity
PATH_SEPARATOR
 
Constructor Summary
protected FriendlyURLEntityImpl()
          Constructor used by subclasses for existing friendly URLs.
  FriendlyURLEntityImpl(int id)
          Constructor used to instantiate a friendly URL entity based on an existing one.
protected FriendlyURLEntityImpl(int id, java.lang.String urlIdentifier, java.lang.String entityIdentifier, java.lang.String urlTitle, int websiteId, java.lang.Integer sequenceNumber, boolean activated, boolean alternative, boolean isLive, FriendlyURLEntity reference, java.lang.String queryString, java.util.Date entryDate)
          Constructor used to instantiate an existing friendly URL entity when all fields are available.
protected FriendlyURLEntityImpl(java.lang.String urlTitle, boolean isActive, boolean isLive, int websiteId, java.lang.String queryString)
          Constructor used by subclasses for new friendly URLs.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
 java.lang.String getAlternativePath()
          Returns the alternative path of the entity.
 java.lang.String getBaseEntityIdentifier()
          Returns the entity identifier without a potential sequence number.
 java.lang.String getBaseIdentifier()
          Returns the URL identifier without a potential sequence number.
 java.lang.String getBaseURLTitleEntityIdentifier()
          Returns the URL title entity without a potential sequence number.
 FriendlyURLEntity.ContentType getContentType()
          Returns the content type of the friendly URL entity.
 java.lang.String getEntityIdentifier()
          Returns the entity identifier of the friendly URL.
 java.util.Date getEntryDate()
          Returns the creation or update date of the friendly URL.
 java.lang.Integer getId()
          Returns the identifier of the friendly URL.
 java.lang.String getQueryString()
          Returns the query string of the friendly URL.
 FriendlyURLEntity getReference()
          Returns the friendly URL entity referred to by the friendly URL.
 java.lang.Integer getSequenceNumber()
          Returns the sequence number of the friendly URL.
 java.lang.String getURLIdentifier()
          Returns the URL identifier of the friendly URL.
 java.lang.String getURLTitle()
          Returns the URL title of the friendly URL.
 java.lang.String getURLTitleEntity()
          Returns the last element of the URL title.
 java.lang.Integer getVersionId()
          Returns the version id of the friendly URL.
 java.lang.Integer getWebsiteId()
          Returns the website id of the friendly URL.
 int hashCode()
          
 boolean isActivated()
          Tells whether the friendly URL is activated.
 boolean isAlternative()
          Tells whether the friendly URL has an alternative path.
 boolean isCurrent()
          Deprecated. 
 boolean isLive()
          Returns whether the content backed by the query string is last known to be current.
 void setActivated(boolean activated)
          Sets the activated bit.
 void setAlternative(boolean alternative)
          Sets the alternative bit for the friendly URL.
 void setId(int id)
          Sets the id.
 void setLive(boolean live)
          Sets the is live bit.
 void setReference(FriendlyURLEntity friendlyURLEntity)
          Sets the friendly URL entity which is referenced by this friendly URL.
 void setSequenceNumber(java.lang.Integer sequenceNumber)
          Sets the sequence number for the friendly URL.
protected  void setURLTitle(java.lang.String urlTitle)
          Sets the URL title for the friendly URL.
 void setURLTitleIdentifier(java.lang.String urlTitleIdentifier)
          Sets the URL title identifier.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FriendlyURLEntityImpl

public FriendlyURLEntityImpl(int id)
Constructor used to instantiate a friendly URL entity based on an existing one.

Parameters:
id - Id of the friendly URL.

FriendlyURLEntityImpl

protected FriendlyURLEntityImpl(java.lang.String urlTitle,
                                boolean isActive,
                                boolean isLive,
                                int websiteId,
                                java.lang.String queryString)
Constructor used by subclasses for new friendly URLs.

Parameters:
urlTitle - The URL title of the entity.
isActive - true if the URL title is active, that is, is accessible, false otherwise.
isLive - true if the content the URL title is pointing to is current, false otherwise.
websiteId - The website ID for which the entity exists.
queryString - The query string representing the identifying part of the internal URL of the entity.

FriendlyURLEntityImpl

protected FriendlyURLEntityImpl()
Constructor used by subclasses for existing friendly URLs.


FriendlyURLEntityImpl

protected FriendlyURLEntityImpl(int id,
                                java.lang.String urlIdentifier,
                                java.lang.String entityIdentifier,
                                java.lang.String urlTitle,
                                int websiteId,
                                java.lang.Integer sequenceNumber,
                                boolean activated,
                                boolean alternative,
                                boolean isLive,
                                FriendlyURLEntity reference,
                                java.lang.String queryString,
                                java.util.Date entryDate)
Constructor used to instantiate an existing friendly URL entity when all fields are available.

Parameters:
id - The identifier of the entity.
urlIdentifier - The URL identifier of the entity.
entityIdentifier - The entity identifier of the entity.
urlTitle - The URL title of the entity.
websiteId - The host id of the entity.
sequenceNumber - The sequence number of the entity.
activated - The activated bit the entity.
alternative - The alternative path of the entity.
isLive - The live bit of the entity.
reference - The reference of the entity.
queryString - The query string of the entity.
entryDate - The creation date of the entity.
Method Detail

getId

public final java.lang.Integer getId()
Returns the identifier of the friendly URL.

Specified by:
getId in interface FriendlyURLEntity
Returns:
The identifier of the friendly URL.

getURLIdentifier

public final java.lang.String getURLIdentifier()
Returns the URL identifier of the friendly URL.

Specified by:
getURLIdentifier in interface FriendlyURLEntity
Returns:
The URL identifier of the friendly URL.

getEntityIdentifier

public final java.lang.String getEntityIdentifier()
Returns the entity identifier of the friendly URL.

Specified by:
getEntityIdentifier in interface FriendlyURLEntity
Returns:
The entity identifier of the friendly URL.

getURLTitle

public final java.lang.String getURLTitle()
Returns the URL title of the friendly URL.

Specified by:
getURLTitle in interface FriendlyURLEntity
Returns:
The URL title of the friendly URL.

getVersionId

public java.lang.Integer getVersionId()
Returns the version id of the friendly URL.

Specified by:
getVersionId in interface FriendlyURLEntity
Returns:
The version id of the friendly URL.

getWebsiteId

public final java.lang.Integer getWebsiteId()
Returns the website id of the friendly URL.

Specified by:
getWebsiteId in interface FriendlyURLEntity
Returns:
The website identifier of the friendly URL.

getSequenceNumber

public final java.lang.Integer getSequenceNumber()
Returns the sequence number of the friendly URL.

Specified by:
getSequenceNumber in interface FriendlyURLEntity
Returns:
The sequence number of the friendly URL.

isActivated

public final boolean isActivated()
Tells whether the friendly URL is activated. A friendly URL is activated when the friendly URL is or has once been accessible by the outside world, and thus potentially indexed by search engines. If a friendly URL is updated while being activated the old friendly URL is remembered, so that it can be redirected to the new friendly URL if requested. If a friendly URL is updated while being not active the old friendly URL is simply overwritten.

Specified by:
isActivated in interface FriendlyURLEntity
Returns:
True for a possible indexed friendly URL, false otherwise.

isAlternative

public final boolean isAlternative()
Tells whether the friendly URL has an alternative path.

Specified by:
isAlternative in interface FriendlyURLEntity
Returns:
True for a friendly URL with an alternative path, false otherwise.

isLive

public final boolean isLive()
Returns whether the content backed by the query string is last known to be current.

Specified by:
isLive in interface FriendlyURLEntity
Returns:
true if the content backed by the query string is last known to be current, false otherwise.

getQueryString

public final java.lang.String getQueryString()
Returns the query string of the friendly URL. This query string represents the internal resource backed by this friendly URL.

Specified by:
getQueryString in interface FriendlyURLEntity
Returns:
The query string of the friendly URL.

getEntryDate

public final java.util.Date getEntryDate()
Returns the creation or update date of the friendly URL.

Specified by:
getEntryDate in interface FriendlyURLEntity
Returns:
The creation or update date of the friendly URL.

getReference

public final FriendlyURLEntity getReference()
Returns the friendly URL entity referred to by the friendly URL. If not null the friendly URL is unavailable, and is redirected to the referred friendly URL.

Note that only the id field of the referenced entity is set.

Specified by:
getReference in interface FriendlyURLEntity
Returns:
The referenced friendly URL entity.

getContentType

public FriendlyURLEntity.ContentType getContentType()
Returns the content type of the friendly URL entity.

Specified by:
getContentType in interface FriendlyURLEntity
Returns:
The content type of the friendly URL entity.

setId

public final void setId(int id)
Sets the id.

Specified by:
setId in interface FriendlyURLEntityMutator
Parameters:
id - New id.

setSequenceNumber

public final void setSequenceNumber(java.lang.Integer sequenceNumber)
Sets the sequence number for the friendly URL.

Specified by:
setSequenceNumber in interface FriendlyURLEntityMutator
Parameters:
sequenceNumber - The new sequence number for the friendly URL.

setAlternative

public final void setAlternative(boolean alternative)
Sets the alternative bit for the friendly URL.

Specified by:
setAlternative in interface FriendlyURLEntityMutator
Parameters:
alternative - The new alternative bit for the friendly URL.

setReference

public final void setReference(FriendlyURLEntity friendlyURLEntity)
Sets the friendly URL entity which is referenced by this friendly URL.

Specified by:
setReference in interface FriendlyURLEntityMutator
Parameters:
friendlyURLEntity - The referenced friendly URL entity;

setLive

public final void setLive(boolean live)
Sets the is live bit.

Specified by:
setLive in interface FriendlyURLEntityMutator
Parameters:
live - The new is live bit for the friendly URL.

setActivated

public final void setActivated(boolean activated)
Sets the activated bit.

Specified by:
setActivated in interface FriendlyURLEntityMutator
Parameters:
activated - The new activated bit for the friendly URL.

setURLTitle

protected final void setURLTitle(java.lang.String urlTitle)
Sets the URL title for the friendly URL. The given URL title cannot have a sequence number.

Parameters:
urlTitle - The new URL title for the friendly URL.

getAlternativePath

public final java.lang.String getAlternativePath()
Returns the alternative path of the entity. If the entity does not have an alternative path, an empty string is returned.

Specified by:
getAlternativePath in interface FriendlyURLEntity
Returns:
The alternative path of the friendly URL.

getBaseIdentifier

public final java.lang.String getBaseIdentifier()
Returns the URL identifier without a potential sequence number. For example, if the URL identifier of a page is a/b/c 1, where 1 is the sequence number, then the result will be a/b/c.

Specified by:
getBaseIdentifier in interface FriendlyURLEntity
Returns:
The URL identifier without the sequence number.

getBaseEntityIdentifier

public final java.lang.String getBaseEntityIdentifier()
Returns the entity identifier without a potential sequence number. For example, if the entity identifier of a page is a 1, where 1 is the sequence number, then the result will be a.

Specified by:
getBaseEntityIdentifier in interface FriendlyURLEntity
Returns:
The entity identifier without the sequence number.

getBaseURLTitleEntityIdentifier

public final java.lang.String getBaseURLTitleEntityIdentifier()
Returns the URL title entity without a potential sequence number. For example, if the URL title of a page is a/b/c 1, where 1 is the sequence number, then the result will be c.

Specified by:
getBaseURLTitleEntityIdentifier in interface FriendlyURLEntity
Returns:
The URL title entity without the sequence number.

getURLTitleEntity

public final java.lang.String getURLTitleEntity()
Returns the last element of the URL title. For example, if the URL title of a page is a/b/c, the result will be c.

Specified by:
getURLTitleEntity in interface FriendlyURLEntity
Returns:
The last element of the URL title.

setURLTitleIdentifier

public final void setURLTitleIdentifier(java.lang.String urlTitleIdentifier)
Sets the URL title identifier.

Specified by:
setURLTitleIdentifier in interface FriendlyURLEntityMutator
Parameters:
urlTitleIdentifier - The URL title identifier.

isCurrent

@Deprecated
public final boolean isCurrent()
Deprecated. 

Tells whether the friendly URL is currently valid. The same as getReference() == null, as a friendly URL with a reference is one that redirects to a current one.

Specified by:
isCurrent in interface FriendlyURLEntity
Returns:
True when the friendly URL is currently valid, false otherwise.

equals

public final boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object


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