public class CmsSubscriptionDriver extends java.lang.Object implements I_CmsDriver, I_CmsSubscriptionDriver
Modifier and Type | Field and Description |
---|---|
protected CmsDriverManager |
m_driverManager
A reference to the driver manager used by this driver.
|
protected CmsSqlManager |
m_sqlManager
The SQL manager used by this driver.
|
AND_CONDITION, BEGIN_CONDITION, BEGIN_EXCLUDE_CONDITION, BEGIN_INCLUDE_CONDITION, END_CONDITION, OR_CONDITION
DRIVER_TYPE_ID
Constructor and Description |
---|
CmsSubscriptionDriver() |
Modifier and Type | Method and Description |
---|---|
protected void |
addVisit(CmsDbContext dbc,
java.lang.String poolName,
CmsVisitEntry visit)
Adds an entry to the table of visits.
|
void |
deleteVisits(CmsDbContext dbc,
java.lang.String poolName,
CmsVisitEntryFilter filter)
Deletes visit entries matching the given filter.
|
long |
getDateLastVisitedBy(CmsDbContext dbc,
java.lang.String poolName,
CmsUser user,
CmsResource resource)
Returns the date when the resource was last visited by the user.
|
CmsSqlManager |
getSqlManager()
Returns the SQL manager of this driver, if possible.
|
void |
init(CmsDbContext dbc,
CmsConfigurationManager configurationManager,
java.util.List<java.lang.String> successiveDrivers,
CmsDriverManager driverManager)
Initializes the driver.
|
CmsSqlManager |
initSqlManager(java.lang.String classname)
Initializes the SQL manager for this driver.
|
protected CmsVisitEntry |
internalReadVisitEntry(java.sql.ResultSet res)
Creates a new
CmsVisitEntry object from the given result set entry. |
void |
markResourceAsVisitedBy(CmsDbContext dbc,
java.lang.String poolName,
CmsResource resource,
CmsUser user)
Mark the given resource as visited by the user.
|
protected CmsPair<java.lang.String,java.util.List<I_CmsPreparedStatementParameter>> |
prepareVisitConditions(CmsVisitEntryFilter filter)
Build the whole WHERE SQL statement part for the given visit entry filter.
|
java.util.List<CmsResource> |
readAllSubscribedResources(CmsDbContext dbc,
java.lang.String poolName,
CmsPrincipal principal)
Returns all resources subscribed by the given user or group.
|
java.util.List<CmsResource> |
readResourcesVisitedBy(CmsDbContext dbc,
java.lang.String poolName,
CmsVisitedByFilter filter)
Returns the resources that were visited by a user set in the filter.
|
java.util.List<I_CmsHistoryResource> |
readSubscribedDeletedResources(CmsDbContext dbc,
java.lang.String poolName,
CmsUser user,
java.util.List<CmsGroup> groups,
CmsResource parent,
boolean includeSubFolders,
long deletedFrom)
Returns the subscribed history resources that were deleted.
|
java.util.List<CmsResource> |
readSubscribedResources(CmsDbContext dbc,
java.lang.String poolName,
CmsSubscriptionFilter filter)
Returns the resources that were subscribed by a user or group set in the filter.
|
java.util.List<CmsVisitEntry> |
readVisits(CmsDbContext dbc,
java.lang.String poolName,
CmsVisitEntryFilter filter)
Reads
CmsVisitEntry objects from the database. |
void |
setSubscribedResourceAsDeleted(CmsDbContext dbc,
java.lang.String poolName,
CmsResource resource)
Marks a subscribed resource as deleted.
|
void |
subscribeResourceFor(CmsDbContext dbc,
java.lang.String poolName,
CmsPrincipal principal,
CmsResource resource)
Subscribes the user or group to the resource.
|
void |
unsubscribeAllDeletedResources(CmsDbContext dbc,
java.lang.String poolName,
long deletedTo)
Unsubscribes all deleted resources that were deleted before the specified time stamp.
|
void |
unsubscribeAllResourcesFor(CmsDbContext dbc,
java.lang.String poolName,
CmsPrincipal principal)
Unsubscribes the principal from all resources.
|
void |
unsubscribeResourceFor(CmsDbContext dbc,
java.lang.String poolName,
CmsPrincipal principal,
CmsResource resource)
Unsubscribes the principal from the resource.
|
void |
unsubscribeResourceForAll(CmsDbContext dbc,
java.lang.String poolName,
CmsResource resource)
Unsubscribes all groups and users from the resource.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toString
protected CmsDriverManager m_driverManager
protected CmsSqlManager m_sqlManager
public CmsSubscriptionDriver()
public void deleteVisits(CmsDbContext dbc, java.lang.String poolName, CmsVisitEntryFilter filter) throws CmsDataAccessException
I_CmsSubscriptionDriver
deleteVisits
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to use, if null
, the default pool is usedfilter
- the log entry filterCmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.deleteVisits(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.db.CmsVisitEntryFilter)
public long getDateLastVisitedBy(CmsDbContext dbc, java.lang.String poolName, CmsUser user, CmsResource resource) throws CmsException
I_CmsSubscriptionDriver
getDateLastVisitedBy
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to useuser
- the user to check the dateresource
- the resource to check the dateCmsException
- if something goes wrongI_CmsSubscriptionDriver.getDateLastVisitedBy(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.file.CmsUser, org.opencms.file.CmsResource)
public CmsSqlManager getSqlManager()
I_CmsSubscriptionDriver
getSqlManager
in interface I_CmsSubscriptionDriver
I_CmsSubscriptionDriver.getSqlManager()
public void init(CmsDbContext dbc, CmsConfigurationManager configurationManager, java.util.List<java.lang.String> successiveDrivers, CmsDriverManager driverManager)
I_CmsDriver
init
in interface I_CmsDriver
dbc
- the current database contextconfigurationManager
- the configuration managersuccessiveDrivers
- a list of successive drivers to be initializeddriverManager
- the initialized OpenCms driver managerI_CmsDriver.init(org.opencms.db.CmsDbContext, org.opencms.configuration.CmsConfigurationManager, java.util.List, org.opencms.db.CmsDriverManager)
public CmsSqlManager initSqlManager(java.lang.String classname)
I_CmsSubscriptionDriver
To obtain JDBC connections from different pools, further {online|offline|history} pool Urls have to be specified.
initSqlManager
in interface I_CmsSubscriptionDriver
classname
- the classname of the SQL managerI_CmsSubscriptionDriver.initSqlManager(java.lang.String)
public void markResourceAsVisitedBy(CmsDbContext dbc, java.lang.String poolName, CmsResource resource, CmsUser user) throws CmsDataAccessException
I_CmsSubscriptionDriver
markResourceAsVisitedBy
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to useresource
- the resource to mark as visiteduser
- the user that visited the resourceCmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.markResourceAsVisitedBy(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.file.CmsResource, org.opencms.file.CmsUser)
public java.util.List<CmsResource> readAllSubscribedResources(CmsDbContext dbc, java.lang.String poolName, CmsPrincipal principal) throws CmsDataAccessException
I_CmsSubscriptionDriver
readAllSubscribedResources
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to useprincipal
- the principal to read the subscribed resourcesCmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.readAllSubscribedResources(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.security.CmsPrincipal)
public java.util.List<CmsResource> readResourcesVisitedBy(CmsDbContext dbc, java.lang.String poolName, CmsVisitedByFilter filter) throws CmsDataAccessException
I_CmsSubscriptionDriver
readResourcesVisitedBy
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to usefilter
- the filter that is used to get the visited resourcesCmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.readResourcesVisitedBy(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.db.CmsVisitedByFilter)
public java.util.List<I_CmsHistoryResource> readSubscribedDeletedResources(CmsDbContext dbc, java.lang.String poolName, CmsUser user, java.util.List<CmsGroup> groups, CmsResource parent, boolean includeSubFolders, long deletedFrom) throws CmsDataAccessException
I_CmsSubscriptionDriver
readSubscribedDeletedResources
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to useuser
- the user that subscribed to the resourcegroups
- the groups to check subscribed resources forparent
- the parent resource (folder) of the deleted resources, if null
all deleted resources will be returnedincludeSubFolders
- indicates if the sub folders of the specified folder path should be considered, toodeletedFrom
- the time stamp from which the resources should have been deletedCmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.readSubscribedDeletedResources(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.file.CmsUser, java.util.List, org.opencms.file.CmsResource, boolean, long)
public java.util.List<CmsResource> readSubscribedResources(CmsDbContext dbc, java.lang.String poolName, CmsSubscriptionFilter filter) throws CmsDataAccessException
I_CmsSubscriptionDriver
readSubscribedResources
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to usefilter
- the filter that is used to get the subscribed resourcesCmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.readSubscribedResources(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.db.CmsSubscriptionFilter)
public java.util.List<CmsVisitEntry> readVisits(CmsDbContext dbc, java.lang.String poolName, CmsVisitEntryFilter filter) throws CmsDataAccessException
CmsVisitEntry
objects from the database.dbc
- the database context to usepoolName
- the name of the pool which should be used for the database operationfilter
- a filter for constraining the list of resultsCmsDataAccessException
- if the database operation failspublic void setSubscribedResourceAsDeleted(CmsDbContext dbc, java.lang.String poolName, CmsResource resource) throws CmsDataAccessException
I_CmsSubscriptionDriver
setSubscribedResourceAsDeleted
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to useresource
- the subscribed resource to mark as deletedCmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.setSubscribedResourceAsDeleted(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.file.CmsResource)
public void subscribeResourceFor(CmsDbContext dbc, java.lang.String poolName, CmsPrincipal principal, CmsResource resource) throws CmsDataAccessException
I_CmsSubscriptionDriver
subscribeResourceFor
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to useprincipal
- the principal that subscribes to the resourceresource
- the resource to subscribe toCmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.subscribeResourceFor(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.security.CmsPrincipal, org.opencms.file.CmsResource)
public void unsubscribeAllDeletedResources(CmsDbContext dbc, java.lang.String poolName, long deletedTo) throws CmsDataAccessException
I_CmsSubscriptionDriver
unsubscribeAllDeletedResources
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to usedeletedTo
- the time stamp to which the resources have been deletedCmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.unsubscribeAllDeletedResources(org.opencms.db.CmsDbContext, java.lang.String, long)
public void unsubscribeAllResourcesFor(CmsDbContext dbc, java.lang.String poolName, CmsPrincipal principal) throws CmsDataAccessException
I_CmsSubscriptionDriver
unsubscribeAllResourcesFor
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to useprincipal
- the principal that unsubscribes from all resourcesCmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.unsubscribeAllResourcesFor(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.security.CmsPrincipal)
public void unsubscribeResourceFor(CmsDbContext dbc, java.lang.String poolName, CmsPrincipal principal, CmsResource resource) throws CmsDataAccessException
I_CmsSubscriptionDriver
unsubscribeResourceFor
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to useprincipal
- the principal that unsubscribes from the resourceresource
- the resource to unsubscribe fromCmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.unsubscribeResourceFor(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.security.CmsPrincipal, org.opencms.file.CmsResource)
public void unsubscribeResourceForAll(CmsDbContext dbc, java.lang.String poolName, CmsResource resource) throws CmsDataAccessException
I_CmsSubscriptionDriver
unsubscribeResourceForAll
in interface I_CmsSubscriptionDriver
dbc
- the database contextpoolName
- the name of the database pool to useresource
- the resource to unsubscribe all groups and users fromCmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.unsubscribeResourceForAll(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.file.CmsResource)
protected void addVisit(CmsDbContext dbc, java.lang.String poolName, CmsVisitEntry visit) throws CmsDbSqlException
dbc
- the database context to usepoolName
- the name of the database pool to usevisit
- the visit beanCmsDbSqlException
- if the database operation failsprotected CmsVisitEntry internalReadVisitEntry(java.sql.ResultSet res) throws java.sql.SQLException
CmsVisitEntry
object from the given result set entry.res
- the result setCmsVisitEntry
objectjava.sql.SQLException
- if something goes wrongprotected CmsPair<java.lang.String,java.util.List<I_CmsPreparedStatementParameter>> prepareVisitConditions(CmsVisitEntryFilter filter)
filter
- the filter