KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > emailnotifier > EmailSubscriptionManager


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.outerj.daisy.emailnotifier;
17
18 import org.outerj.daisy.repository.RepositoryException;
19 import org.outerj.daisy.repository.VariantKey;
20
21 public interface EmailSubscriptionManager {
22     /**
23      * Gets subscription information for the current user. If the user doesn't have
24      * a subscription yet, this also returns a Subscription object.
25      */

26     public Subscription getSubscription() throws RepositoryException;
27
28     /**
29      * Retrieves the subscription of another user. Only users acting as administrator
30      * can do this.
31      */

32     public Subscription getSubscription(long userId) throws RepositoryException;
33
34     /**
35      * Removes the subscription for the current user. If the user does not have a
36      * subscription, this method should silently return.
37      */

38     public void deleteSubscription() throws RepositoryException;
39
40     /**
41      * Deletes the subscription of another user. Only users acting as administrator can
42      * do this. If the user does not have a subscription, this method should silently return.
43      */

44     public void deleteSubscription(long userId) throws RepositoryException;
45
46     /**
47      * Get all available subscriptions. Only users acting as administrator can do this.
48      */

49     public Subscriptions getSubscriptions() throws RepositoryException;
50
51     /**
52      * @param variantKey documentId, branchId and languageId components can be -1 to indicate "any document/branch/language".
53      */

54     public void addDocumentSubscription(VariantKey variantKey) throws RepositoryException;
55
56     public void addDocumentSubscription(long userId, VariantKey variantKey) throws RepositoryException;
57
58     /**
59      * Checks if the user is subscribed to the specified document variant.
60      * This will only return true if an exact match for the subscription
61      * is found, thus -1 for branchId and/or languageId doesn't work as
62      * a wildcard.
63      */

64     public boolean isSubsribed(VariantKey variantKey) throws RepositoryException;
65
66     public boolean isSubsribed(long userId, VariantKey variantKey) throws RepositoryException;
67
68     public void deleteDocumentSubscription(VariantKey variantKey) throws RepositoryException;
69
70     public void deleteDocumentSubscription(long userId, VariantKey variantKey) throws RepositoryException;
71
72     /**
73      * Deletes subscriptions for the specified document variant for all users (useful if eg the
74      * document variant has been deleted). Can only be done by users acting in the Administrator role.
75      */

76     public void deleteAllSubscriptionsForDocumentVariant(VariantKey variantKey) throws RepositoryException;
77
78     /**
79      * Deletes subscriptions for the specified document for all users (useful if eg the
80      * document variant has been deleted). Can only be done by users acting in the Administrator role.
81      */

82     public void deleteAllSubscriptionsForDocument(long documentId) throws RepositoryException;
83
84     public void deleteAllSubscriptionsForCollection(long collectionId) throws RepositoryException;
85
86     /**
87      * Returns the users subscribed to changes for documents.
88      *
89      * @param documentId the id of the document
90      * @param branchId can be -1 to specify 'whatever branch the subscription applies to'
91      * @param languageId can be -1 to specify 'whatever language the subscription applies to'
92      * @param collections the collections the document belongs to.
93      */

94     public Subscribers getAllDocumentEventSubscribers(long documentId, long branchId, long languageId, long[] collections) throws RepositoryException;
95
96     public Subscribers getAllUserEventSubscribers() throws RepositoryException;
97
98     public Subscribers getAllCollectionEventSubscribers() throws RepositoryException;
99
100     public Subscribers getAllSchemaEventSubscribers() throws RepositoryException;
101
102     public Subscribers getAllAclEventSubscribers() throws RepositoryException;
103
104     public Subscribers getAllCommentEventSubscribers(long documentId, long branchId, long languageId, long[] collections) throws RepositoryException;
105 }
106
Popular Tags