Copyright© 2008-2022 Sitevision AB, all rights reserved.
@Requireable(value="SubscriptionUtil") public interface SubscriptionUtil
Subscription utility interface.
An instance of the Sitevision class implementing this interface can be obtained via
Utils.getSubscriptionUtil()
.
See Utils
for how to obtain an instance of the Utils
interface.
Modifier and Type | Method and Description |
---|---|
void |
activateSubscription(Node aNode,
boolean subtreeScope,
String title,
String description)
Activates a subscription for the given
Node . |
void |
configureSubscriptionEmail(Node aNode,
String from,
String fromAddress,
String subject,
String footer)
Configures email properties for the subscription on the given node.
|
void |
deactivateSubscription(Node aNode)
Deactivates the subscription for the given
Node . |
Node |
getActiveSubscription(Node aNode)
Returns the active subscription
Node of a Node . |
boolean |
notifySubscribersOf(Node aNode,
String aNotificationText)
Notifies the subscribers of a given node with an active subscription.
|
Node getActiveSubscription(Node aNode)
Returns the active subscription Node
of a Node
. An active subscription
is a sv:site
, sv:page
, sv:article
or sv:archive
that has activated
the subscription functionality. More information about subscriptions can be found in the Sitevision help pages.
ex: from the sitevision navigator
- server
---site A (subscription activated, including all children)
-----page 1
-------archive X (subscription activated, including all children)
---------article V
-----page 2 (subscription activated)
-------page 21
getActiveSubscription(site A) -> site A
getActiveSubscription(page 1) -> site A
getActiveSubscription(archive X) -> archive X
getActiveSubscription(article V) -> archive X
getActiveSubscription(page 2) -> page 2
getActiveSubscription(page 21) -> null
To find out if a Node
has active subscription use the property isActiveSubscription
. This
method is simply convenience to find the active Node
.
This method will never throw exceptions
aNode
- a Node
in the navigation (e.g. a sv:page or an sv:article)Node
with activated subscription or null
if not availablevoid activateSubscription(Node aNode, boolean subtreeScope, String title, String description) throws ConstraintViolationException, IllegalArgumentException, RepositoryException
Activates a subscription for the given Node
.
The current user must have write subscription permission to activate subscriptions.
aNode
- the Node
to activate a subscription for.subtreeScope
- true if activation should include subnodes, false otherwise.title
- the subscription title.description
- the subscription description.ConstraintViolationException
- if the current user isn't allowed to modify subscriptions.IllegalArgumentException
- if the given node aNode
is null or if the given node isn't a
subscriptionable node.RepositoryException
- if something else goes wrong.PermissionUtil.hasWriteSubscriptionPermission(javax.jcr.Node, javax.jcr.Node)
void deactivateSubscription(Node aNode) throws RepositoryException, IllegalArgumentException
Deactivates the subscription for the given Node
.
The current user must have write subscription permission to deactivate subscriptions.
aNode
- the Node
to deactivate the subscription for.RepositoryException
- if the current user isn't allowed to modify subscriptions.IllegalArgumentException
- if the given node aNode
is null or if the given node isn't
a subscriptionable node.PermissionUtil.hasWriteSubscriptionPermission(javax.jcr.Node, javax.jcr.Node)
void configureSubscriptionEmail(Node aNode, String from, String fromAddress, String subject, String footer) throws ConstraintViolationException, IllegalArgumentException, RepositoryException
Configures email properties for the subscription on the given node.
The current user must have write subscription permission to configure subscription email.
aNode
- the Node
to configure.from
- name of the sender.fromAddress
- email address of the sender.subject
- the email subject.footer
- the email footerConstraintViolationException
- if the current user isn't allowed to modify subscriptions.IllegalArgumentException
- if the given node aNode
is null, if the given node isn't
a subscriptionable node, if fromAddress
is null or not a
valid email adress.RepositoryException
- if something else goes wrong.PermissionUtil.hasWriteSubscriptionPermission(javax.jcr.Node, javax.jcr.Node)
boolean notifySubscribersOf(Node aNode, String aNotificationText)
This method will use the settings of the active subscription to send mail notifications to all subscribers. A properly configured active subscription has mail settings that specifies from, from address, subject and a footer. The active subscription also has a mail template that is used to create the actual body of the notification. The mail template for an active subscription will typically include something like this:
The aNotificationText
parameter of this method will be used as notification text in the mail template.
In other words - if aNotificationText
is null
, the notification mail body will typically
contain the URL and the footer only.
aNode
- a Node
that has an active subscription, typically a sv:page or sv:articleaNotificationText
- the notification texttrue
if a notification could be scheduled, false
otherwise
(e.g. if aNode
is null
or has no active subscription, see getActiveSubscription(javax.jcr.Node)
)Sitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2022 Sitevision AB, all rights reserved.