|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.db.generic.CmsSubscriptionDriver
public class CmsSubscriptionDriver
Generic implementation of the user tracking and subscription driver interface.
Field Summary | |
---|---|
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. |
Fields inherited from interface org.opencms.db.I_CmsDriver |
---|
AND_CONDITION, BEGIN_CONDITION, BEGIN_EXCLUDE_CONDITION, BEGIN_INCLUDE_CONDITION, END_CONDITION, OR_CONDITION |
Fields inherited from interface org.opencms.db.I_CmsSubscriptionDriver |
---|
DRIVER_TYPE_ID |
Constructor Summary | |
---|---|
CmsSubscriptionDriver()
|
Method Summary | |
---|---|
protected void |
addVisit(CmsDbContext dbc,
String poolName,
CmsVisitEntry visit)
Adds an entry to the table of visits. |
void |
deleteVisits(CmsDbContext dbc,
String poolName,
CmsVisitEntryFilter filter)
Deletes visit entries matching the given filter. |
long |
getDateLastVisitedBy(CmsDbContext dbc,
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,
List<String> successiveDrivers,
CmsDriverManager driverManager)
Initializes the driver. |
CmsSqlManager |
initSqlManager(String classname)
Initializes the SQL manager for this driver. |
protected CmsVisitEntry |
internalReadVisitEntry(ResultSet res)
Creates a new CmsVisitEntry object from the given result set entry. |
void |
markResourceAsVisitedBy(CmsDbContext dbc,
String poolName,
CmsResource resource,
CmsUser user)
Mark the given resource as visited by the user. |
protected CmsPair<String,List<I_CmsPreparedStatementParameter>> |
prepareVisitConditions(CmsVisitEntryFilter filter)
Build the whole WHERE SQL statement part for the given visit entry filter. |
List<CmsResource> |
readAllSubscribedResources(CmsDbContext dbc,
String poolName,
CmsPrincipal principal)
Returns all resources subscribed by the given user or group. |
List<CmsResource> |
readResourcesVisitedBy(CmsDbContext dbc,
String poolName,
CmsVisitedByFilter filter)
Returns the resources that were visited by a user set in the filter. |
List<I_CmsHistoryResource> |
readSubscribedDeletedResources(CmsDbContext dbc,
String poolName,
CmsUser user,
List<CmsGroup> groups,
CmsResource parent,
boolean includeSubFolders,
long deletedFrom)
Returns the subscribed history resources that were deleted. |
List<CmsResource> |
readSubscribedResources(CmsDbContext dbc,
String poolName,
CmsSubscriptionFilter filter)
Returns the resources that were subscribed by a user or group set in the filter. |
List<CmsVisitEntry> |
readVisits(CmsDbContext dbc,
String poolName,
CmsVisitEntryFilter filter)
Reads CmsVisitEntry objects from the database. |
void |
setSubscribedResourceAsDeleted(CmsDbContext dbc,
String poolName,
CmsResource resource)
Marks a subscribed resource as deleted. |
void |
subscribeResourceFor(CmsDbContext dbc,
String poolName,
CmsPrincipal principal,
CmsResource resource)
Subscribes the user or group to the resource. |
void |
unsubscribeAllDeletedResources(CmsDbContext dbc,
String poolName,
long deletedTo)
Unsubscribes all deleted resources that were deleted before the specified time stamp. |
void |
unsubscribeAllResourcesFor(CmsDbContext dbc,
String poolName,
CmsPrincipal principal)
Unsubscribes the principal from all resources. |
void |
unsubscribeResourceFor(CmsDbContext dbc,
String poolName,
CmsPrincipal principal,
CmsResource resource)
Unsubscribes the principal from the resource. |
void |
unsubscribeResourceForAll(CmsDbContext dbc,
String poolName,
CmsResource resource)
Unsubscribes all groups and users from the resource. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.opencms.db.I_CmsDriver |
---|
toString |
Field Detail |
---|
protected CmsDriverManager m_driverManager
protected CmsSqlManager m_sqlManager
Constructor Detail |
---|
public CmsSubscriptionDriver()
Method Detail |
---|
public void deleteVisits(CmsDbContext dbc, 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 filter
CmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.deleteVisits(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.db.CmsVisitEntryFilter)
public long getDateLastVisitedBy(CmsDbContext dbc, 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 date
CmsException
- 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, List<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(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 manager
I_CmsSubscriptionDriver.initSqlManager(java.lang.String)
public void markResourceAsVisitedBy(CmsDbContext dbc, 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 resource
CmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.markResourceAsVisitedBy(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.file.CmsResource, org.opencms.file.CmsUser)
public List<CmsResource> readAllSubscribedResources(CmsDbContext dbc, 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 resources
CmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.readAllSubscribedResources(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.security.CmsPrincipal)
public List<CmsResource> readResourcesVisitedBy(CmsDbContext dbc, 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 resources
CmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.readResourcesVisitedBy(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.db.CmsVisitedByFilter)
public List<I_CmsHistoryResource> readSubscribedDeletedResources(CmsDbContext dbc, String poolName, CmsUser user, 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 deleted
CmsDataAccessException
- 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 List<CmsResource> readSubscribedResources(CmsDbContext dbc, 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 resources
CmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.readSubscribedResources(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.db.CmsSubscriptionFilter)
public List<CmsVisitEntry> readVisits(CmsDbContext dbc, 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 results
CmsDataAccessException
- if the database operation failspublic void setSubscribedResourceAsDeleted(CmsDbContext dbc, 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 deleted
CmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.setSubscribedResourceAsDeleted(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.file.CmsResource)
public void subscribeResourceFor(CmsDbContext dbc, 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 to
CmsDataAccessException
- 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, 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 deleted
CmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.unsubscribeAllDeletedResources(org.opencms.db.CmsDbContext, java.lang.String, long)
public void unsubscribeAllResourcesFor(CmsDbContext dbc, 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 resources
CmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.unsubscribeAllResourcesFor(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.security.CmsPrincipal)
public void unsubscribeResourceFor(CmsDbContext dbc, 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 from
CmsDataAccessException
- 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, 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 from
CmsDataAccessException
- if something goes wrongI_CmsSubscriptionDriver.unsubscribeResourceForAll(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.file.CmsResource)
protected void addVisit(CmsDbContext dbc, String poolName, CmsVisitEntry visit) throws CmsDbSqlException
dbc
- the database context to usepoolName
- the name of the database pool to usevisit
- the visit bean
CmsDbSqlException
- if the database operation failsprotected CmsVisitEntry internalReadVisitEntry(ResultSet res) throws SQLException
CmsVisitEntry
object from the given result set entry.
res
- the result set
CmsVisitEntry
object
SQLException
- if something goes wrongprotected CmsPair<String,List<I_CmsPreparedStatementParameter>> prepareVisitConditions(CmsVisitEntryFilter filter)
filter
- the filter
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |