public class CmsSubscriptionManager
extends java.lang.Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected CmsSecurityManager |
m_securityManager
The security manager to access the cms.
|
| 构造器和说明 |
|---|
CmsSubscriptionManager()
Initializes a new CmsSubscriptionManager, called from the configuration.
|
| 限定符和类型 | 方法和说明 |
|---|---|
long |
getDateLastVisitedBy(CmsObject cms,
CmsUser user,
CmsResource resource)
Returns the date when the resource was last visited by the user.
|
long |
getDateLastVisitedBy(CmsObject cms,
CmsUser user,
java.lang.String resourcePath)
Returns the date when the resource was last visited by the user.
|
int |
getMaxVisitedCount()
Returns the maximum number of visited resources to store per user.
|
java.lang.String |
getPoolName()
Returns the name of the database pool to use.
|
void |
initialize(CmsObject cms)
Initializes this subscription manager with the OpenCms system configuration.
|
boolean |
isEnabled()
Returns if the subscription functionality is enabled.
|
void |
markResourceAsVisitedBy(CmsObject cms,
CmsResource resource,
CmsUser user)
Mark the given resource as visited by the user.
|
void |
markResourceAsVisitedBy(CmsObject cms,
java.lang.String resourcePath,
CmsUser user)
Mark the given resource as visited by the user.
|
java.util.List<CmsResource> |
readAllSubscribedResources(CmsObject cms,
CmsPrincipal principal)
Returns all resources subscribed by the given user or group.
|
java.util.List<CmsResource> |
readResourcesVisitedBy(CmsObject cms,
CmsVisitedByFilter filter)
Returns the resources that were visited by a user set in the filter.
|
java.util.List<I_CmsHistoryResource> |
readSubscribedDeletedResources(CmsObject cms,
CmsUser user,
boolean includeGroups,
java.lang.String folderPath,
boolean includeSubFolders,
long deletedFrom)
Returns the subscribed history resources that were deleted.
|
java.util.List<CmsResource> |
readSubscribedResources(CmsObject cms,
CmsSubscriptionFilter filter)
Returns the resources that were subscribed by a user or group set in the filter.
|
void |
setEnabled(boolean enabled)
Sets if the subscription functionality is enabled.
|
void |
setEnabled(java.lang.String enabled)
Sets if the subscription functionality is enabled.
|
void |
setMaxVisitedCount(java.lang.String maxVisitedCount)
Sets the maximum number of visited resources to store per user.
|
void |
setPoolName(java.lang.String poolName)
Sets the name of the database pool to use.
|
void |
setSecurityManager(CmsSecurityManager securityManager)
Sets the security manager during initialization.
|
void |
setSubscribedResourceAsDeleted(CmsObject cms,
CmsResource resource)
Marks a subscribed resource as deleted.
|
void |
subscribeResourceFor(CmsObject cms,
CmsPrincipal principal,
CmsResource resource)
Subscribes the user or group to the resource.
|
void |
subscribeResourceFor(CmsObject cms,
CmsPrincipal principal,
java.lang.String resourcePath)
Subscribes the user or group to the resource.
|
void |
unsubscribeAllDeletedResources(CmsObject cms,
long deletedTo)
Unsubscribes all deleted resources that were deleted before the specified time stamp.
|
void |
unsubscribeAllResourcesFor(CmsObject cms,
CmsPrincipal principal)
Unsubscribes the user or group from all resources.
|
void |
unsubscribeResourceFor(CmsObject cms,
CmsPrincipal principal,
CmsResource resource)
Unsubscribes the principal from the resource.
|
void |
unsubscribeResourceFor(CmsObject cms,
CmsPrincipal principal,
java.lang.String resourcePath)
Unsubscribes the principal from the resource.
|
void |
unsubscribeResourceForAll(CmsObject cms,
CmsResource resource)
Unsubscribes all groups and users from the resource.
|
void |
unsubscribeResourceForAll(CmsObject cms,
java.lang.String resourcePath)
Unsubscribes all groups and users from the resource.
|
protected CmsSecurityManager m_securityManager
public CmsSubscriptionManager()
public long getDateLastVisitedBy(CmsObject cms, CmsUser user, CmsResource resource) throws CmsException
cms - the current users contextuser - the user to check the dateresource - the resource to check the dateCmsException - if something goes wrongpublic long getDateLastVisitedBy(CmsObject cms, CmsUser user, java.lang.String resourcePath) throws CmsException
cms - the current users contextuser - the user to check the dateresourcePath - the name of the resource to check the dateCmsException - if something goes wrongpublic int getMaxVisitedCount()
public java.lang.String getPoolName()
public void initialize(CmsObject cms) throws CmsRoleViolationException
cms - an OpenCms context object that must have been initialized with "Admin" permissionsCmsRoleViolationException - in case the given opencms object does not have CmsRole.ROOT_ADMIN permissionspublic boolean isEnabled()
true if the subscription functionality is enabled, otherwise falsepublic void markResourceAsVisitedBy(CmsObject cms, CmsResource resource, CmsUser user) throws CmsException
cms - the current users contextresource - the resource to mark as visiteduser - the user that visited the resourceCmsException - if something goes wrongpublic void markResourceAsVisitedBy(CmsObject cms, java.lang.String resourcePath, CmsUser user) throws CmsException
cms - the current users contextresourcePath - the name of the resource to mark as visiteduser - the user that visited the resourceCmsException - if something goes wrongpublic java.util.List<CmsResource> readAllSubscribedResources(CmsObject cms, CmsPrincipal principal) throws CmsException
cms - the current users contextprincipal - the principal to read the subscribed resourcesCmsException - if something goes wrongpublic java.util.List<CmsResource> readResourcesVisitedBy(CmsObject cms, CmsVisitedByFilter filter) throws CmsException
cms - the current users contextfilter - the filter that is used to get the visited resourcesCmsException - if something goes wrongpublic java.util.List<I_CmsHistoryResource> readSubscribedDeletedResources(CmsObject cms, CmsUser user, boolean includeGroups, java.lang.String folderPath, boolean includeSubFolders, long deletedFrom) throws CmsException
cms - the current users contextuser - the user that subscribed to the resourceincludeGroups - indicates if the users groups should also be checked for subscribed deleted resourcesfolderPath - the folder path 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 deletedCmsException - if something goes wrongpublic java.util.List<CmsResource> readSubscribedResources(CmsObject cms, CmsSubscriptionFilter filter) throws CmsException
cms - the current users contextfilter - the filter that is used to get the subscribed resourcesCmsException - if something goes wrongpublic void setEnabled(boolean enabled)
enabled - the flag indicating if the subscription functionality is enabledpublic void setEnabled(java.lang.String enabled)
enabled - the flag indicating if the subscription functionality is enabledpublic void setMaxVisitedCount(java.lang.String maxVisitedCount)
maxVisitedCount - the maximum number of visited resources to store per userpublic void setPoolName(java.lang.String poolName)
poolName - the name of the database pool to usepublic void setSecurityManager(CmsSecurityManager securityManager)
securityManager - the security managerpublic void setSubscribedResourceAsDeleted(CmsObject cms, CmsResource resource) throws CmsException
cms - the current users contextresource - the subscribed resource to mark as deletedCmsException - if something goes wrongpublic void subscribeResourceFor(CmsObject cms, CmsPrincipal principal, CmsResource resource) throws CmsException
cms - the current users contextprincipal - the principal that subscribes to the resourceresource - the resource to subscribe toCmsException - if something goes wrongpublic void subscribeResourceFor(CmsObject cms, CmsPrincipal principal, java.lang.String resourcePath) throws CmsException
cms - the current users contextprincipal - the principal that subscribes to the resourceresourcePath - the name of the resource to subscribe toCmsException - if something goes wrongpublic void unsubscribeAllDeletedResources(CmsObject cms, long deletedTo) throws CmsException
cms - the current users contextdeletedTo - the time stamp to which the resources have been deletedCmsException - if something goes wrongpublic void unsubscribeAllResourcesFor(CmsObject cms, CmsPrincipal principal) throws CmsException
cms - the current users contextprincipal - the principal that unsubscribes from all resourcesCmsException - if something goes wrongpublic void unsubscribeResourceFor(CmsObject cms, CmsPrincipal principal, CmsResource resource) throws CmsException
cms - the current users contextprincipal - the principal that unsubscribes from the resourceresource - the resource to unsubscribe fromCmsException - if something goes wrongpublic void unsubscribeResourceFor(CmsObject cms, CmsPrincipal principal, java.lang.String resourcePath) throws CmsException
cms - the current users contextprincipal - the principal that unsubscribes from the resourceresourcePath - the name of the resource to unsubscribe fromCmsException - if something goes wrongpublic void unsubscribeResourceForAll(CmsObject cms, CmsResource resource) throws CmsException
cms - the current users contextresource - the resource to unsubscribe all groups and users fromCmsException - if something goes wrongpublic void unsubscribeResourceForAll(CmsObject cms, java.lang.String resourcePath) throws CmsException
cms - the current users contextresourcePath - the name of the resource to unsubscribe all groups and users fromCmsException - if something goes wrong