nl.gx.webmanager.services.seo.dao
Interface FriendlyURLEntityDAO

All Known Subinterfaces:
DBPageFriendlyURLEntityDAO, MediaItemFriendlyURLEntityDAO, PageFriendlyURLEntityDAO
All Known Implementing Classes:
DBPageFriendlyURLEntityDAOImpl, FriendlyURLEntityDAOImpl, MediaItemFriendlyURLEntityDAOImpl, PageFriendlyURLEntityDAOImpl

public interface FriendlyURLEntityDAO

Data access methods for friendly URLs.

Author:
Sander Dahlberg

Method Summary
 void activate(FriendlyURLEntity entity)
          Activates the given entity.
 void create(FriendlyURLEntity entity)
          Inserts a new record for the given entity.
 void delete(FriendlyURLEntity entity)
          Deletes the given entity and its history.
 void deleteAll(FriendlyURLEntity entity)
          Deletes the given entity and all other related entities.
 void deleteById(FriendlyURLEntity entity)
          Deletes the given entity using its id.
 FriendlyURLEntity getEntity(int versionId)
          Returns a friendly URL entity given its version ID.
 FriendlyURLEntity getEntityById(int id)
          Returns a friendly URL entity given its ID.
 java.lang.String getURLTitle(java.lang.String queryString)
          Returns the URL title of the friendly URL entity backed by the given querystring.
 void lastCurrent(FriendlyURLEntity entity, boolean isCurrent)
          Sets the live bit of the given entity.
 java.lang.Integer makeIdentifierUnique(FriendlyURLEntity entity, java.util.List<FriendlyURLEntity> entities)
          Resolves potential URL identifier conflict by setting a sequence number for the given friendly URL entity.
 void refer(FriendlyURLEntity entity)
          Refers referenced entity to this entity.
 void refer(FriendlyURLEntity sourceEntity, FriendlyURLEntity targetEntity)
          Refers one entity to the other.
 void updateIdentifiers(java.util.List<FriendlyURLEntity> entities)
          Updates the URL identifying columns for the given entities.
 

Method Detail

getURLTitle

java.lang.String getURLTitle(java.lang.String queryString)
                             throws FriendlyURLException
Returns the URL title of the friendly URL entity backed by the given querystring. If no friendly URL entity exists for the given querystring, the querystring itself is returned. Used for translating internal URLs to friendly URLs.

Parameters:
queryString - Returns the URL title identified by this querystring.
Returns:
The URL title of the friendly URL entity identified by its querystring.
Throws:
FriendlyURLException - If any database access fails.

getEntity

FriendlyURLEntity getEntity(int versionId)
                            throws FriendlyURLException
Returns a friendly URL entity given its version ID.

Parameters:
versionId - The version identifier of the page or media item version for which its friendly URL entity is returned.
Returns:
Friendly URL entity object.
Throws:
FriendlyURLException - If any database access fails.

getEntityById

FriendlyURLEntity getEntityById(int id)
                                throws FriendlyURLException
Returns a friendly URL entity given its ID.

Parameters:
id - The ID of the friendly URL entity.
Returns:
Friendly URL entity object.
Throws:
FriendlyURLException - If any database access fails.

create

void create(FriendlyURLEntity entity)
            throws FriendlyURLException
Inserts a new record for the given entity. Resolves potential URL clashes by generating a sequence number before inserting. The newly generated id is set on the entity bean.

Parameters:
entity - Write this friendly URL entity to the database.
Throws:
FriendlyURLException - If storing the friendly URL fails.

delete

void delete(FriendlyURLEntity entity)
            throws FriendlyURLException
Deletes the given entity and its history. In case of versions makes sure that other entities referring this entity will refer to the next current or planned entity.

Parameters:
entity - Remove this friendly URL entity from the database.
Throws:
FriendlyURLException - If removing the friendly URL fails.

deleteAll

void deleteAll(FriendlyURLEntity entity)
               throws FriendlyURLException
Deletes the given entity and all other related entities. Technically, related entities are all entities with the same query string as the given entity.

Parameters:
entity - Remove this friendly URL entity and other entities with the same query string from the database.
Throws:
FriendlyURLException - If removing the friendly URL fails.

deleteById

void deleteById(FriendlyURLEntity entity)
                throws FriendlyURLException
Deletes the given entity using its id.

Parameters:
entity - Remove this friendly URL entity from the database.
Throws:
FriendlyURLException - If any database access fails.

activate

void activate(FriendlyURLEntity entity)
              throws FriendlyURLException
Activates the given entity. This means that the friendly URL entity is considered live now. Any subsequent update on this entity actually duplicates the entity. The interpretation is that this entity after it is activated should never be deleted automatically, only manually. Remembering historic URLs enables redirecting requests to these old URLs to their current ones.

Parameters:
entity - Activate this friendly URL entity.
Throws:
FriendlyURLException - If any database access fails.

lastCurrent

void lastCurrent(FriendlyURLEntity entity,
                 boolean isCurrent)
                 throws FriendlyURLException
Sets the live bit of the given entity. If set to true content backed by the entity is considered publicly available. Used to determine a current roll-over by comparing this field with the real current state.

Parameters:
entity - Set live bit of this friendly URL entity.
isCurrent - Whether the content backed by this entity is publicly available.
Throws:
FriendlyURLException - If any database access fails.

refer

void refer(FriendlyURLEntity entity)
           throws FriendlyURLException
Refers referenced entity to this entity. References to the reference entity are also updated to refer to this entity. At last, if this entity itself is referring to another entity, clears that reference. After this call this entity is considered the current entity.

Parameters:
entity - Updates this entity's referential structure.
Throws:
FriendlyURLException - If any database access fails.

refer

void refer(FriendlyURLEntity sourceEntity,
           FriendlyURLEntity targetEntity)
           throws FriendlyURLException
Refers one entity to the other. If a website visitor requests an URL specifying the source friendly URL entity, the visitor is redirected to an URL including the target friendly URL entity.

Parameters:
sourceEntity - Source entity that will refer to the target.
targetEntity - Target entity that will be referenced by the source entity.
Throws:
FriendlyURLException - If any database access fails.

makeIdentifierUnique

java.lang.Integer makeIdentifierUnique(FriendlyURLEntity entity,
                                       java.util.List<FriendlyURLEntity> entities)
                                       throws FriendlyURLException
Resolves potential URL identifier conflict by setting a sequence number for the given friendly URL entity. Only makes sense for given friendly URL entity which is not persisted yet. If an URL identifier is already used by another friendly URL entity a sequence number is generated, which appended to the URL identifier makes to combination uniquely identify the internal resource backed by the friendly URL entity.

Note that a sequence number is not needed for two friendly URL entities with the same URL identifier if they both point to the same internal resource (that is, the same query string). This is the case for two page versions of the same page, which have the same URL identifier. There is always only one page version which is public within a language context.

Parameters:
entity - Friendly URL entity to find sequence number for.
entities - List of uncommitted friendly URL entities. The friendly URL entity's URL identifier is first matched against the URL identifiers of these friendly URL entities. Cannot be null, but instead pass an empty list.
Returns:
Sequence number to make identifier unique, null if already unique.
Throws:
FriendlyURLException - If any database access fails.

updateIdentifiers

void updateIdentifiers(java.util.List<FriendlyURLEntity> entities)
                       throws FriendlyURLException
Updates the URL identifying columns for the given entities. Entities that are activated are duplicated and their references are handled.

Parameters:
entities - Update these entities.
Throws:
FriendlyURLException - If any database access fails.


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