Package org.opencms.db
Interface I_CmsSubscriptionDriver
-
- All Known Implementing Classes:
CmsSubscriptionDriver
,CmsSubscriptionDriver
,CmsSubscriptionDriver
,CmsSubscriptionDriver
,CmsSubscriptionDriver
,CmsSubscriptionDriver
,CmsSubscriptionDriver
,CmsSubscriptionDriver
public interface I_CmsSubscriptionDriver
The interface for drivers handling subscriptions and user tracking.- Since:
- 8.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static int
DRIVER_TYPE_ID
The type ID to identify subscription driver implementations.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.CmsSqlManager
initSqlManager(java.lang.String classname)
Initializes the SQL manager for this driver.void
markResourceAsVisitedBy(CmsDbContext dbc, java.lang.String poolName, CmsResource resource, CmsUser user)
Mark the given resource as visited by the user.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.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.
-
-
-
Field Detail
-
DRIVER_TYPE_ID
static final int DRIVER_TYPE_ID
The type ID to identify subscription driver implementations.- See Also:
- Constant Field Values
-
-
Method Detail
-
deleteVisits
void deleteVisits(CmsDbContext dbc, java.lang.String poolName, CmsVisitEntryFilter filter) throws CmsDataAccessException
Deletes visit entries matching the given filter.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to use, ifnull
, the default pool is usedfilter
- the log entry filter- Throws:
CmsDataAccessException
- if something goes wrong
-
getDateLastVisitedBy
long getDateLastVisitedBy(CmsDbContext dbc, java.lang.String poolName, CmsUser user, CmsResource resource) throws CmsException
Returns the date when the resource was last visited by the user.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useuser
- the user to check the dateresource
- the resource to check the date- Returns:
- the date when the resource was last visited by the user
- Throws:
CmsException
- if something goes wrong
-
getSqlManager
CmsSqlManager getSqlManager()
Returns the SQL manager of this driver, if possible.- Returns:
- an SQL manager
-
initSqlManager
CmsSqlManager initSqlManager(java.lang.String classname)
Initializes the SQL manager for this driver.To obtain JDBC connections from different pools, further {online|offline|history} pool Urls have to be specified.
- Parameters:
classname
- the classname of the SQL manager- Returns:
- the SQL manager for this driver
-
markResourceAsVisitedBy
void markResourceAsVisitedBy(CmsDbContext dbc, java.lang.String poolName, CmsResource resource, CmsUser user) throws CmsDataAccessException
Mark the given resource as visited by the user.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useresource
- the resource to mark as visiteduser
- the user that visited the resource- Throws:
CmsDataAccessException
- if something goes wrong
-
readAllSubscribedResources
java.util.List<CmsResource> readAllSubscribedResources(CmsDbContext dbc, java.lang.String poolName, CmsPrincipal principal) throws CmsDataAccessException
Returns all resources subscribed by the given user or group.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useprincipal
- the principal to read the subscribed resources- Returns:
- all resources subscribed by the given user or group
- Throws:
CmsDataAccessException
- if something goes wrong
-
readResourcesVisitedBy
java.util.List<CmsResource> readResourcesVisitedBy(CmsDbContext dbc, java.lang.String poolName, CmsVisitedByFilter filter) throws CmsDataAccessException
Returns the resources that were visited by a user set in the filter.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to usefilter
- the filter that is used to get the visited resources- Returns:
- the resources that were visited by a user set in the filter
- Throws:
CmsDataAccessException
- if something goes wrong
-
readSubscribedDeletedResources
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
Returns the subscribed history resources that were deleted.- Parameters:
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, ifnull
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- Returns:
- the subscribed history resources that were deleted
- Throws:
CmsDataAccessException
- if something goes wrong
-
readSubscribedResources
java.util.List<CmsResource> readSubscribedResources(CmsDbContext dbc, java.lang.String poolName, CmsSubscriptionFilter filter) throws CmsDataAccessException
Returns the resources that were subscribed by a user or group set in the filter.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to usefilter
- the filter that is used to get the subscribed resources- Returns:
- the resources that were subscribed by a user or group set in the filter
- Throws:
CmsDataAccessException
- if something goes wrong
-
setSubscribedResourceAsDeleted
void setSubscribedResourceAsDeleted(CmsDbContext dbc, java.lang.String poolName, CmsResource resource) throws CmsDataAccessException
Marks a subscribed resource as deleted.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useresource
- the subscribed resource to mark as deleted- Throws:
CmsDataAccessException
- if something goes wrong
-
subscribeResourceFor
void subscribeResourceFor(CmsDbContext dbc, java.lang.String poolName, CmsPrincipal principal, CmsResource resource) throws CmsDataAccessException
Subscribes the user or group to the resource.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useprincipal
- the principal that subscribes to the resourceresource
- the resource to subscribe to- Throws:
CmsDataAccessException
- if something goes wrong
-
unsubscribeAllDeletedResources
void unsubscribeAllDeletedResources(CmsDbContext dbc, java.lang.String poolName, long deletedTo) throws CmsDataAccessException
Unsubscribes all deleted resources that were deleted before the specified time stamp.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to usedeletedTo
- the time stamp to which the resources have been deleted- Throws:
CmsDataAccessException
- if something goes wrong
-
unsubscribeAllResourcesFor
void unsubscribeAllResourcesFor(CmsDbContext dbc, java.lang.String poolName, CmsPrincipal principal) throws CmsDataAccessException
Unsubscribes the principal from all resources.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useprincipal
- the principal that unsubscribes from all resources- Throws:
CmsDataAccessException
- if something goes wrong
-
unsubscribeResourceFor
void unsubscribeResourceFor(CmsDbContext dbc, java.lang.String poolName, CmsPrincipal principal, CmsResource resource) throws CmsDataAccessException
Unsubscribes the principal from the resource.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useprincipal
- the principal that unsubscribes from the resourceresource
- the resource to unsubscribe from- Throws:
CmsDataAccessException
- if something goes wrong
-
unsubscribeResourceForAll
void unsubscribeResourceForAll(CmsDbContext dbc, java.lang.String poolName, CmsResource resource) throws CmsDataAccessException
Unsubscribes all groups and users from the resource.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useresource
- the resource to unsubscribe all groups and users from- Throws:
CmsDataAccessException
- if something goes wrong
-
-