|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.gx.webmanager.services.seo.dao.impl.FriendlyURLEntityDAOImpl
public abstract class FriendlyURLEntityDAOImpl
Data access methods for friendly URLs.
| Constructor Summary | |
|---|---|
protected |
FriendlyURLEntityDAOImpl(SEODatabaseUtil seoDatabaseUtil)
Constructor. |
| 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. |
protected void |
determineSequenceNumber(java.sql.Connection connection,
FriendlyURLEntity entity,
java.util.List<FriendlyURLEntity> entities)
Determines the sequence number for the given entity for ensuring URL uniqueness. |
protected boolean |
genericIdentifierConflicts(FriendlyURLEntity sourceEntity,
java.util.List<FriendlyURLEntity> targetEntities)
Checks whether the source entity is in conflict with one of the target entities. |
protected abstract java.util.List<java.lang.Object> |
getAvailabilityArguments(FriendlyURLEntity entity)
Returns the SQL arguments for checking the availability of a friendly URL. |
protected abstract java.lang.String |
getAvailabilityQuery()
Returns SQL query that confirms a given friendly URL is unique. |
protected static java.lang.String |
getCreateFields()
Returns comma separated string of table fields needed to create a generic friendly URL. |
protected abstract java.lang.String |
getDeleteQuery()
Returns SQL delete query used for deleting friendly URLs. |
abstract 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. |
protected java.util.List<java.lang.Object> |
getGenericInsertArguments(FriendlyURLEntity entity)
Returns the SQL arguments for the insertion of the given friendly URL entity. |
protected abstract java.util.List<java.lang.Object> |
getInsertArguments(FriendlyURLEntity entity)
Returns the SQL arguments for the insertion of the given friendly URL entity. |
protected abstract java.lang.String |
getInsertQuery()
Returns SQL insert query used for creating friendly URLs. |
protected abstract java.lang.String |
getMatchQuery()
Returns SQL query that returns a matching friendly URL. |
protected abstract java.lang.String |
getMatchQueryNullSequence()
Returns SQL query that returns a matching friendly URL. |
protected FriendlyURLEntity |
getReferencedEntity(int referenceId)
Turns the database value for a entity reference into a friendly URL entity. |
protected abstract java.lang.String |
getReferringQuery()
Returns SQL select query used for returning referring friendly URLs. |
protected abstract java.lang.String |
getSelectByIdQuery()
Returns SQL select query for retrieving friendly URL by id. |
protected static java.lang.String |
getSelectFields()
Returns comma separated string of table fields needed to select a generic friendly URL. |
protected SEODatabaseUtil |
getSEODatabaseUtil()
Returns reference to the SEO database utility class. |
protected java.lang.Integer |
getSequenceNumber(int sequenceField)
Turns the database value for a sequence number into a real sequence number. |
java.lang.String |
getURLTitle(java.lang.String queryString)
Returns the URL title of the friendly URL entity backed by the given querystring. |
protected boolean |
identifierConflicts(java.sql.Connection connection,
FriendlyURLEntity entity,
java.util.List<FriendlyURLEntity> entities)
Determines the sequence number the given entity should get in order to make its URL identifier unique. |
protected abstract boolean |
identifierConflictsWithInMemEntities(FriendlyURLEntity sourceEntity,
java.util.List<FriendlyURLEntity> targetEntities)
Checks whether the source entity is in conflict with one of the target entities. |
protected int |
insertFriendlyURL(FriendlyURLEntity entity)
Inserts the friendly URL into the database. |
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. |
protected abstract java.util.List<FriendlyURLEntity> |
selectFriendlyURLs(java.lang.String query,
java.util.List<java.lang.Object> arguments)
Selects friendly URL entities. |
void |
updateIdentifiers(java.util.List<FriendlyURLEntity> entities)
Updates the URL identifying columns for the given entities. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected FriendlyURLEntityDAOImpl(SEODatabaseUtil seoDatabaseUtil)
seoDatabaseUtil - Reference to the friendly URL database util class.| Method Detail |
|---|
public abstract FriendlyURLEntity getEntity(int versionId)
throws FriendlyURLException
getEntity in interface FriendlyURLEntityDAOversionId - The version identifier of the page or media item version for which its friendly URL
entity is returned.
FriendlyURLException - If any database access fails.
public final FriendlyURLEntity getEntityById(int id)
throws FriendlyURLException
getEntityById in interface FriendlyURLEntityDAOid - The ID of the friendly URL entity.
FriendlyURLException - If any database access fails.
public final void delete(FriendlyURLEntity entity)
throws FriendlyURLException
delete in interface FriendlyURLEntityDAOentity - Remove this friendly URL entity from the database.
FriendlyURLException - If removing the friendly URL fails.
public final void deleteAll(FriendlyURLEntity entity)
throws FriendlyURLException
deleteAll in interface FriendlyURLEntityDAOentity - Remove this friendly URL entity and other entities with the same query string from the
database.
FriendlyURLException - If removing the friendly URL fails.
public final void deleteById(FriendlyURLEntity entity)
throws FriendlyURLException
deleteById in interface FriendlyURLEntityDAOentity - Remove this friendly URL entity from the database.
FriendlyURLException - If any database access fails.
public final java.lang.String getURLTitle(java.lang.String queryString)
throws FriendlyURLException
getURLTitle in interface FriendlyURLEntityDAOqueryString - Returns the URL title identified by this querystring.
FriendlyURLException - If any database access fails.
public final void create(FriendlyURLEntity entity)
throws FriendlyURLException
create in interface FriendlyURLEntityDAOentity - Write this friendly URL entity to the database.
FriendlyURLException - If storing the friendly URL fails.
public final void refer(FriendlyURLEntity entity)
throws FriendlyURLException
refer in interface FriendlyURLEntityDAOentity - Updates this entity's referential structure.
FriendlyURLException - If any database access fails.
public final void refer(FriendlyURLEntity sourceEntity,
FriendlyURLEntity targetEntity)
throws FriendlyURLException
refer in interface FriendlyURLEntityDAOsourceEntity - Source entity that will refer to the target.targetEntity - Target entity that will be referenced by the source entity.
FriendlyURLException - If any database access fails.
public final void activate(FriendlyURLEntity entity)
throws FriendlyURLException
activate in interface FriendlyURLEntityDAOentity - Activate this friendly URL entity.
FriendlyURLException - If any database access fails.
public final void lastCurrent(FriendlyURLEntity entity,
boolean isCurrent)
throws FriendlyURLException
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.
lastCurrent in interface FriendlyURLEntityDAOentity - Set live bit of this friendly URL entity.isCurrent - Whether the content backed by this entity is publicly available.
FriendlyURLException - If any database access fails.
public final java.lang.Integer makeIdentifierUnique(FriendlyURLEntity entity,
java.util.List<FriendlyURLEntity> entities)
throws FriendlyURLException
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.
makeIdentifierUnique in interface FriendlyURLEntityDAOentity - 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.
null if already unique.
FriendlyURLException - If any database access fails.
public final void updateIdentifiers(java.util.List<FriendlyURLEntity> entities)
throws FriendlyURLException
updateIdentifiers in interface FriendlyURLEntityDAOentities - Update these entities.
FriendlyURLException - If any database access fails.protected final SEODatabaseUtil getSEODatabaseUtil()
protected abstract java.util.List<FriendlyURLEntity> selectFriendlyURLs(java.lang.String query,
java.util.List<java.lang.Object> arguments)
throws java.sql.SQLException
query - Execute this select query, which must retrieve all friendly URL select fields.arguments - The arguments for the given query.
java.sql.SQLException - If a database access error occurs.
protected final boolean identifierConflicts(java.sql.Connection connection,
FriendlyURLEntity entity,
java.util.List<FriendlyURLEntity> entities)
throws FriendlyURLException
PageFriendlyURLEntityDAOImpl to allow page specific rules, and the class
DBPageFriendlyURLEntityDAOImpl to allow resource instance specific rules.
connection - TODOentity - Friendly URL entity to find sequence number for.entities - Entity must also be unique against this in memory list of entities.
null if already unique.
FriendlyURLException - If any database access fails.
protected abstract boolean identifierConflictsWithInMemEntities(FriendlyURLEntity sourceEntity,
java.util.List<FriendlyURLEntity> targetEntities)
sourceEntity - Source friendly URL entity.targetEntities - Target friendly URL entities.
true if URL identifier is not unique, false otherwise.
protected final boolean genericIdentifierConflicts(FriendlyURLEntity sourceEntity,
java.util.List<FriendlyURLEntity> targetEntities)
sourceEntity - Source friendly URL entity.targetEntities - Source friendly URL entity.
true if URL identifier is not unique, false otherwise.
protected final void determineSequenceNumber(java.sql.Connection connection,
FriendlyURLEntity entity,
java.util.List<FriendlyURLEntity> entities)
throws FriendlyURLException
connection - TODOentity - Calculate sequence number for this entity.entities - Entity must also be unique against this in memory list of entities.
FriendlyURLException - If any data access fails.protected static final java.lang.String getCreateFields()
protected static final java.lang.String getSelectFields()
protected abstract java.lang.String getSelectByIdQuery()
protected abstract java.lang.String getInsertQuery()
protected abstract java.lang.String getReferringQuery()
protected abstract java.lang.String getDeleteQuery()
protected abstract java.lang.String getMatchQuery()
findMatchFromHistory(FriendlyURLEntity).
protected abstract java.lang.String getMatchQueryNullSequence()
findMatchFromHistory(FriendlyURLEntity). Difference with getMatchQuery() is that the
sequence is checked for being null.
protected abstract java.util.List<java.lang.Object> getAvailabilityArguments(FriendlyURLEntity entity)
entity - Friendly URL entity to return its arguments for.
protected abstract java.lang.String getAvailabilityQuery()
protected final java.util.List<java.lang.Object> getGenericInsertArguments(FriendlyURLEntity entity)
entity - Friendly URL entity to return its arguments for.
protected abstract java.util.List<java.lang.Object> getInsertArguments(FriendlyURLEntity entity)
entity - Friendly URL entity to return its arguments for.
protected final int insertFriendlyURL(FriendlyURLEntity entity)
throws FriendlyURLException
entity - The friendly URL to insert.
FriendlyURLException - If storing the friendly URL fails.protected final FriendlyURLEntity getReferencedEntity(int referenceId)
referenceId - Referenced friendly URL entity ID.
protected final java.lang.Integer getSequenceNumber(int sequenceField)
sequenceField - Sequence value.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||