public abstract class RepositoryViewImpl extends java.lang.Object implements NamedQueryView
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
protected atg.repository.query.QueryCacheable |
mCache
currently active query cache
|
static java.lang.String |
RESOURCE_BUNDLE_NAME |
Constructor and Description |
---|
RepositoryViewImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addNamedQuery(java.lang.String pQueryName,
atg.repository.QueryDescriptor pDescriptor)
Adds an entry to the named query map
|
void |
addQueryListener(atg.repository.QueryListener pListener)
Adds a query event listener from this view.
|
boolean |
canCacheQuery(java.util.List<atg.repository.query.QueryDependency> pDependencies)
You might override this method to try and deal with a subtle
synchronization issue.
|
boolean |
canEverCacheQuery(java.util.List<atg.repository.query.QueryDependency> pDependencies)
This method checks to make sure that the query is itself cacheable
based on what we found out from the nested query nodes.
|
atg.repository.query.QueryCacheable |
createCache()
For internal use only: create a QueryCache of the appropriate type,
depending on th setting of our RepositoryImpl's useConcurrentCaching.
|
void |
createNamedQuery(java.lang.String pQueryName,
Query pQuery)
Creates a named query.
|
abstract int |
executeCountQuery(Query pQuery)
Executes a query that returns the number of items that would be returned by
given query.
|
RepositoryItem[] |
executeQuery(Query pQuery)
Executes the given query and returns an array of the matching
RepositoryItems (not ids)
|
RepositoryItem[] |
executeQuery(Query pQuery,
int pStartingIndex)
Executes the given query and returns an array of matching RepositoryItems,
beginning at the starting index element.
|
RepositoryItem[] |
executeQuery(Query pQuery,
int pStartingIndex,
int pEndingIndex)
Executes the given query and returns an array of matching RepositoryItems,
which are contained within a total potential result set.
|
RepositoryItem[] |
executeQuery(Query pQuery,
int pStartingIndex,
int pEndingIndex,
SortDirectives pSortDirectives)
Executes the given query and returns an array of matching RepositoryItems,
which are contained within a total potential result set.
|
RepositoryItem[] |
executeQuery(Query pQuery,
int pStartingIndex,
SortDirectives pSortDirectives)
Executes the given query and returns an array of matching RepositoryItems,
beginning at the starting index element.
|
RepositoryItem[] |
executeQuery(Query pQuery,
QueryOptions pQueryOptions)
Executes the given query and returns an array of the matching
RepositoryItems (not ids)
|
RepositoryItem[] |
executeQuery(Query pQuery,
SortDirectives pSortDirectives)
Executes the given query and returns an array of the matching
RepositoryItems (not ids)
|
abstract RepositoryItem[] |
executeUncachedQuery(Query pQuery,
QueryOptions pOptions)
Subclasses determine how query requests are actually satisfied
|
RepositoryItem[] |
executeUncachedQuery(Query pQuery,
QueryOptions pOptions,
java.lang.Object[] pParameterValues)
This is a stub implementation so that the QueryCache doesn't have
to deal with specific RepositoryView implementations when it calls
executeUncachedQuery() with variables.
|
atg.repository.query.QueryCacheable |
getCache()
Get property
cache |
boolean |
getCacheQueries() |
RepositoryItemDescriptor |
getItemDescriptor()
Returns the RepositoryItemDescriptor property, which describes
the known properties for all the items in the view
|
Query |
getNamedQuery(java.lang.String pQueryName)
Gets the Repository Query corresponding to the given name
|
java.lang.String[] |
getNamedQueryNames()
Returns the names of all the named queries known by this view
|
abstract QueryBuilder |
getQueryBuilder()
Returns a QueryBuilder to use for creating Query objects
|
int |
getQueryCacheSize() |
atg.repository.QueryDescriptor |
getQueryDescriptor(java.lang.String pQueryName)
Gets the QueryDescriptor object associated with the given name.
|
long |
getQueryExpireTimeout() |
java.util.List |
getQueryListeners()
Returns the list of query listeners that are registered on this view.
|
java.lang.String |
getQueryName(Query pQuery)
Gets the name associated with the given Query, if any
|
Repository |
getRepository()
Get property Repository
|
java.lang.String |
getViewName()
Get property ViewName
|
void |
invalidateQueryCache()
Removes all entries from the query cache
|
void |
removeNamedQuery(java.lang.String pQueryName)
Removes an entry from the named query map
|
void |
removeQueryDependency(atg.repository.query.QueryDependency pList)
When a query cache entry is invalidated, we need to remove all cache
entries that depend on the same set of properties, the QueryDependency.
|
void |
removeQueryListener(atg.repository.QueryListener pListener)
Removes a query event listener from this view.
|
void |
sendQueryEvent(Query pQuery,
QueryOptions pQueryOptions,
RepositoryItem[] pResults)
Sends a QueryEvent
|
void |
setCache(atg.repository.query.QueryCacheable pQueryCache)
Set the query cache.
|
void |
setItemDescriptor(RepositoryItemDescriptor pItemDescriptor)
Sets the property ItemDescriptor.
|
void |
setQueryCacheSize(int pQueryCacheSize)
Sets the property queryCacheSize.
|
void |
setQueryExpireTimeout(long pQueryExpireTimeout)
Sets the property query expire timeout.
|
void |
setRepository(Repository pRepository)
Set property Repository
|
void |
setViewName(java.lang.String pViewName)
Set property ViewName
|
public static java.lang.String CLASS_VERSION
public static final java.lang.String RESOURCE_BUNDLE_NAME
protected atg.repository.query.QueryCacheable mCache
public atg.repository.query.QueryCacheable getCache()
cache
cache
public void setCache(atg.repository.query.QueryCacheable pQueryCache)
public void setViewName(java.lang.String pViewName)
pViewName
- new value to setpublic java.lang.String getViewName()
getViewName
in interface RepositoryView
public void setRepository(Repository pRepository)
pRepository
- new value to setpublic Repository getRepository()
public void setItemDescriptor(RepositoryItemDescriptor pItemDescriptor)
pItemDescriptor
- new value to setpublic RepositoryItemDescriptor getItemDescriptor()
RepositoryView
getItemDescriptor
in interface RepositoryView
public boolean getCacheQueries()
public void setQueryCacheSize(int pQueryCacheSize)
pQueryCacheSize
- new value to setpublic int getQueryCacheSize()
public void setQueryExpireTimeout(long pQueryExpireTimeout)
public long getQueryExpireTimeout()
public void addNamedQuery(java.lang.String pQueryName, atg.repository.QueryDescriptor pDescriptor)
pQueryName
- the name of the query to addpDescriptor
- the query descriptor describing the querypublic void removeNamedQuery(java.lang.String pQueryName)
pQueryName
- the name of the query to removepublic RepositoryItem[] executeQuery(Query pQuery) throws RepositoryException
executeQuery
in interface RepositoryView
pQuery
- the query to executeRepositoryException
- if there is an error while performing
the query operationpublic RepositoryItem[] executeQuery(Query pQuery, SortDirectives pSortDirectives) throws RepositoryException
executeQuery
in interface RepositoryView
pQuery
- the query to executepSortDirectives
- the directives to sort the result set withRepositoryException
- if there is an error while performing
the query operationpublic RepositoryItem[] executeQuery(Query pQuery, int pStartingIndex) throws RepositoryException
executeQuery
in interface RepositoryView
pQuery
- the query to executepStartingIndex
- the beginning index, inclusiveRepositoryException
- if there is an error while performing
the query operationpublic RepositoryItem[] executeQuery(Query pQuery, int pStartingIndex, SortDirectives pSortDirectives) throws RepositoryException
executeQuery
in interface RepositoryView
pQuery
- the query to executepStartingIndex
- the beginning index, inclusivepSortDirectives
- the directives to sort the result set withRepositoryException
- if there is an error while performing
the query operationpublic RepositoryItem[] executeQuery(Query pQuery, int pStartingIndex, int pEndingIndex) throws RepositoryException
executeQuery
in interface RepositoryView
pQuery
- the query to executepStartingIndex
- the beginning index, inclusivepEndingIndex
- the ending index, exclusive.RepositoryException
- if there is an error while performing
the query operationpublic abstract QueryBuilder getQueryBuilder()
getQueryBuilder
in interface RepositoryView
public RepositoryItem[] executeQuery(Query pQuery, int pStartingIndex, int pEndingIndex, SortDirectives pSortDirectives) throws RepositoryException
executeQuery
in interface RepositoryView
pQuery
- the query to executepStartingIndex
- the beginning index, inclusivepEndingIndex
- the ending index, exclusive.pSortDirectives
- the directives to sort the result set withRepositoryException
- if there is an error while performing
the query operationpublic RepositoryItem[] executeQuery(Query pQuery, QueryOptions pQueryOptions) throws RepositoryException
executeQuery
in interface RepositoryView
pQuery
- the query to executepQueryOptions
- A set of options that may modify the queryRepositoryException
- if there is an error while performing
the query operationpublic void createNamedQuery(java.lang.String pQueryName, Query pQuery)
createNamedQuery
in interface NamedQueryView
pQueryName
- the name of the querypQuery
- the Query object associated with the namepublic Query getNamedQuery(java.lang.String pQueryName)
getNamedQuery
in interface NamedQueryView
pQueryName
- the name of the query to retrievepQueryName
or null if no Query exists by that namepublic java.lang.String getQueryName(Query pQuery)
getQueryName
in interface NamedQueryView
pQuery
- the query to get the name forpublic java.lang.String[] getNamedQueryNames()
getNamedQueryNames
in interface NamedQueryView
public atg.repository.QueryDescriptor getQueryDescriptor(java.lang.String pQueryName)
getQueryDescriptor
in interface NamedQueryView
pQueryName
- the name of the named query to get the QueryDescriptor
forpublic abstract int executeCountQuery(Query pQuery) throws RepositoryException
executeCountQuery
in interface RepositoryView
pQuery
- the query to executeexecuteQuery(pQuery)
RepositoryException
- if there is an error while performing
the query operationpublic abstract RepositoryItem[] executeUncachedQuery(Query pQuery, QueryOptions pOptions) throws RepositoryException
RepositoryException
public RepositoryItem[] executeUncachedQuery(Query pQuery, QueryOptions pOptions, java.lang.Object[] pParameterValues) throws RepositoryException
pQuery
- the query to executepQueryOptions
- A set of options that may modify the querypParameterValues
- values of any parameter expressions that
are in the given query. Each expression is replaced in the order
that it is encountered with the corresponding parameter value e.g.
the first parameter is replaced with pParameterValues[0], the second
parameter is replaced with pParameterValues[1], etc.RepositoryException
public void invalidateQueryCache()
public boolean canEverCacheQuery(java.util.List<atg.repository.query.QueryDependency> pDependencies)
pDependencies
- the list of dependencies to check.public boolean canCacheQuery(java.util.List<atg.repository.query.QueryDependency> pDependencies)
This method also checks to make sure that the query is itself cacheable based on what we found out from the nested query nodes.
The default implementation invokes canEverCacheQuery.
public void removeQueryDependency(atg.repository.query.QueryDependency pList)
In some cases, it might make sense to leave the property list around so that we don't have to add the listeners, but I think it is simpler/safer to just clean up the mess.
pList
- dependencies to use in finding entries to invalidatepublic void addQueryListener(atg.repository.QueryListener pListener)
public void removeQueryListener(atg.repository.QueryListener pListener)
public java.util.List getQueryListeners()
public void sendQueryEvent(Query pQuery, QueryOptions pQueryOptions, RepositoryItem[] pResults)
public atg.repository.query.QueryCacheable createCache()