001: /*
002: * Copyright 2004 Outerthought bvba and Schaubroeck nv
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.outerj.daisy.emailnotifier;
017:
018: import org.outerj.daisy.repository.RepositoryException;
019: import org.outerj.daisy.repository.VariantKey;
020:
021: /**
022: * Management of email notification subscriptions.
023: *
024: * <p>This is an optional repository extension component.
025: *
026: * <p>The EmailSubscriptionManager extension is obtained from the
027: * {@link org.outerj.daisy.repository.Repository Repository} as follows:
028: *
029: * <pre>
030: * subscriptionManager = (EmailSubscriptionManager)repository.getExtension("EmailSubscriptionManager");
031: * </pre>
032: *
033: * <p>In the remote repository API, the EmailSubscriptionManager extension can be registered as follows:
034: *
035: * <pre>
036: * RemoteRepositoryManager repositoryManager = ...;
037: * repositoryManager.registerExtension("EmailSubscriptionManager",
038: * new Packages.org.outerj.daisy.emailnotifier.clientimpl.RemoteEmailSubscriptionManagerProvider());
039: * </pre>
040: *
041: */
042: public interface EmailSubscriptionManager {
043:
044: static final String DOCUMENT_ID_WILDCARD = "*";
045:
046: /**
047: * Gets subscription information for the current user. If the user doesn't have
048: * a subscription yet, this also returns a Subscription object.
049: */
050: public Subscription getSubscription() throws RepositoryException;
051:
052: /**
053: * Retrieves the subscription of another user. Only users acting as administrator
054: * can do this.
055: */
056: public Subscription getSubscription(long userId)
057: throws RepositoryException;
058:
059: /**
060: * Removes the subscription for the current user. If the user does not have a
061: * subscription, this method should silently return.
062: */
063: public void deleteSubscription() throws RepositoryException;
064:
065: /**
066: * Deletes the subscription of another user. Only users acting as administrator can
067: * do this. If the user does not have a subscription, this method should silently return.
068: */
069: public void deleteSubscription(long userId)
070: throws RepositoryException;
071:
072: /**
073: * Get all available subscriptions. Only users acting as administrator can do this.
074: */
075: public Subscriptions getSubscriptions() throws RepositoryException;
076:
077: /**
078: * @param variantKey documentId can be {@link #DOCUMENT_ID_WILDCARD} (*), and
079: * the branchId and languageId components can be -1 to indicate "any document/branch/language".
080: */
081: public void addDocumentSubscription(VariantKey variantKey)
082: throws RepositoryException;
083:
084: public void addDocumentSubscription(long userId,
085: VariantKey variantKey) throws RepositoryException;
086:
087: /**
088: * Checks if the user is subscribed to the specified document variant.
089: * This will only return true if an exact match for the subscription
090: * is found, thus -1 for branchId and/or languageId doesn't work as
091: * a wildcard.
092: */
093: public boolean isSubsribed(VariantKey variantKey)
094: throws RepositoryException;
095:
096: public boolean isSubsribed(long userId, VariantKey variantKey)
097: throws RepositoryException;
098:
099: public void deleteDocumentSubscription(VariantKey variantKey)
100: throws RepositoryException;
101:
102: public void deleteDocumentSubscription(long userId,
103: VariantKey variantKey) throws RepositoryException;
104:
105: /**
106: * Deletes subscriptions for the specified document variant for all users (useful if eg the
107: * document variant has been deleted). Can only be done by users acting in the Administrator role.
108: */
109: public void deleteAllSubscriptionsForDocumentVariant(
110: VariantKey variantKey) throws RepositoryException;
111:
112: /**
113: * Deletes subscriptions for the specified document for all users (useful if eg the
114: * document variant has been deleted). Can only be done by users acting in the Administrator role.
115: */
116: public void deleteAllSubscriptionsForDocument(String documentId)
117: throws RepositoryException;
118:
119: public void deleteAllSubscriptionsForCollection(long collectionId)
120: throws RepositoryException;
121:
122: /**
123: * Returns the users subscribed to changes for documents.
124: *
125: * @param documentId the id of the document
126: * @param branchId can be -1 to specify 'whatever branch the subscription applies to'
127: * @param languageId can be -1 to specify 'whatever language the subscription applies to'
128: * @param collections the collections the document belongs to.
129: */
130: public Subscribers getAllDocumentEventSubscribers(
131: String documentId, long branchId, long languageId,
132: long[] collections) throws RepositoryException;
133:
134: public Subscribers getAllUserEventSubscribers()
135: throws RepositoryException;
136:
137: public Subscribers getAllCollectionEventSubscribers()
138: throws RepositoryException;
139:
140: public Subscribers getAllSchemaEventSubscribers()
141: throws RepositoryException;
142:
143: public Subscribers getAllAclEventSubscribers()
144: throws RepositoryException;
145:
146: public Subscribers getAllCommentEventSubscribers(String documentId,
147: long branchId, long languageId, long[] collections)
148: throws RepositoryException;
149: }
|