org.opencms.db
Interface I_CmsSubscriptionDriver

All Known Implementing Classes:
CmsSubscriptionDriver, 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
static int DRIVER_TYPE_ID
          The type ID to identify subscription driver implementations.
 
Method Summary
 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.
 CmsSqlManager initSqlManager(String classname)
          Initializes the SQL manager for this driver.
 void markResourceAsVisitedBy(CmsDbContext dbc, String poolName, CmsResource resource, CmsUser user)
          Mark the given resource as visited by the user.
 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.
 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.
 

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,
                  String poolName,
                  CmsVisitEntryFilter filter)
                  throws CmsDataAccessException
Deletes visit entries matching the given filter.

Parameters:
dbc - the database context
poolName - the name of the database pool to use, if null, the default pool is used
filter - the log entry filter
Throws:
CmsDataAccessException - if something goes wrong

getDateLastVisitedBy

long getDateLastVisitedBy(CmsDbContext dbc,
                          String poolName,
                          CmsUser user,
                          CmsResource resource)
                          throws CmsException
Returns the date when the resource was last visited by the user.

Parameters:
dbc - the database context
poolName - the name of the database pool to use
user - the user to check the date
resource - 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(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,
                             String poolName,
                             CmsResource resource,
                             CmsUser user)
                             throws CmsDataAccessException
Mark the given resource as visited by the user.

Parameters:
dbc - the database context
poolName - the name of the database pool to use
resource - the resource to mark as visited
user - the user that visited the resource
Throws:
CmsDataAccessException - if something goes wrong

readAllSubscribedResources

List<CmsResource> readAllSubscribedResources(CmsDbContext dbc,
                                             String poolName,
                                             CmsPrincipal principal)
                                             throws CmsDataAccessException
Returns all resources subscribed by the given user or group.

Parameters:
dbc - the database context
poolName - the name of the database pool to use
principal - the principal to read the subscribed resources
Returns:
all resources subscribed by the given user or group
Throws:
CmsDataAccessException - if something goes wrong

readResourcesVisitedBy

List<CmsResource> readResourcesVisitedBy(CmsDbContext dbc,
                                         String poolName,
                                         CmsVisitedByFilter filter)
                                         throws CmsDataAccessException
Returns the resources that were visited by a user set in the filter.

Parameters:
dbc - the database context
poolName - the name of the database pool to use
filter - 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

List<I_CmsHistoryResource> readSubscribedDeletedResources(CmsDbContext dbc,
                                                          String poolName,
                                                          CmsUser user,
                                                          List<CmsGroup> groups,
                                                          CmsResource parent,
                                                          boolean includeSubFolders,
                                                          long deletedFrom)
                                                          throws CmsDataAccessException
Returns the subscribed history resources that were deleted.

Parameters:
dbc - the database context
poolName - the name of the database pool to use
user - the user that subscribed to the resource
groups - the groups to check subscribed resources for
parent - the parent resource (folder) of the deleted resources, if null all deleted resources will be returned
includeSubFolders - indicates if the sub folders of the specified folder path should be considered, too
deletedFrom - 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

List<CmsResource> readSubscribedResources(CmsDbContext dbc,
                                          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 context
poolName - the name of the database pool to use
filter - 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,
                                    String poolName,
                                    CmsResource resource)
                                    throws CmsDataAccessException
Marks a subscribed resource as deleted.

Parameters:
dbc - the database context
poolName - the name of the database pool to use
resource - the subscribed resource to mark as deleted
Throws:
CmsDataAccessException - if something goes wrong

subscribeResourceFor

void subscribeResourceFor(CmsDbContext dbc,
                          String poolName,
                          CmsPrincipal principal,
                          CmsResource resource)
                          throws CmsDataAccessException
Subscribes the user or group to the resource.

Parameters:
dbc - the database context
poolName - the name of the database pool to use
principal - the principal that subscribes to the resource
resource - the resource to subscribe to
Throws:
CmsDataAccessException - if something goes wrong

unsubscribeAllDeletedResources

void unsubscribeAllDeletedResources(CmsDbContext dbc,
                                    String poolName,
                                    long deletedTo)
                                    throws CmsDataAccessException
Unsubscribes all deleted resources that were deleted before the specified time stamp.

Parameters:
dbc - the database context
poolName - the name of the database pool to use
deletedTo - the time stamp to which the resources have been deleted
Throws:
CmsDataAccessException - if something goes wrong

unsubscribeAllResourcesFor

void unsubscribeAllResourcesFor(CmsDbContext dbc,
                                String poolName,
                                CmsPrincipal principal)
                                throws CmsDataAccessException
Unsubscribes the principal from all resources.

Parameters:
dbc - the database context
poolName - the name of the database pool to use
principal - the principal that unsubscribes from all resources
Throws:
CmsDataAccessException - if something goes wrong

unsubscribeResourceFor

void unsubscribeResourceFor(CmsDbContext dbc,
                            String poolName,
                            CmsPrincipal principal,
                            CmsResource resource)
                            throws CmsDataAccessException
Unsubscribes the principal from the resource.

Parameters:
dbc - the database context
poolName - the name of the database pool to use
principal - the principal that unsubscribes from the resource
resource - the resource to unsubscribe from
Throws:
CmsDataAccessException - if something goes wrong

unsubscribeResourceForAll

void unsubscribeResourceForAll(CmsDbContext dbc,
                               String poolName,
                               CmsResource resource)
                               throws CmsDataAccessException
Unsubscribes all groups and users from the resource.

Parameters:
dbc - the database context
poolName - the name of the database pool to use
resource - the resource to unsubscribe all groups and users from
Throws:
CmsDataAccessException - if something goes wrong