Managing Oracle WebCenter Collaboration Subscriptions Using
Oracle WebCenter Interaction Development Kit (IDK) Remote APIs
To provide users with e-mail notifications when an activity
occurs in Collaboration, use a subscription. The IProjectManager interface allows you to query current subscriptions, and subscribe
and unsubscribe users to Collaboration projects. You can also subscribe
users to individual project components.
The
IProjectManager allows you to manage
subscriptions for a project. To manage subscriptions for individual
project components (folders, documents, task lists and discussions),
use the associated component manager:
- The ITaskListManager interface allows you to
query current subscriptions, and subscribe and unsubscribe users to
collaboration task lists.
- The IDocumentManager interface allows you to
query current subscriptions, and subscribe and unsubscribe users to
collaboration folders and documents.
- The IDiscussionManager interface allows you
to query current subscriptions, and subscribe and unsubscribe users
to collaboration discussions.
The subscription methods within each interface are identical
aside from the type of object passed into the method as a parameter.
The sample code below uses the
ITaskListManager subscription methods as an example.
To subscribe a user to a project
or project component, follow the steps below.
- Create a PRC session. For details, see Initiating a PRC Session to Use Oracle WebCenter Interaction Development Kit (IDK) Remote APIs.
- Get the project or project component ID and retrieve the
associated object manager.
- Get the IDs of any users to be subscribed. (To retrieve
the users that are currently subscribed, use the getSubscribedUserIDs method.)
- Add users to a role if they are not already assigned one.
Note: The users to be subscribed must be in at least GUEST role,
and the calling user has to have ADMIN access to the project, or else
an exception will be thrown.
- Subscribe the users to the project or project component..
Java
...
//userID1 and userID2 are both valid int user IDs that have not been added to any project roles
int[] validUserIDs = new int(userID1, userID2);
IRole guestRole = project.getRole(RoleType.GUEST);
//Add the two users to the GUEST role.
guestRole.addMember(userID1, MemberType.USER);
guestRole.addMember(userID2, MemberType.USER);
guestRole.store();
//Subscribe the two users to the task list.
//No store() needs to be called after the call to subscribeUsers.
tasklistManager.subscribeUsers(tasklist, validUserIDs);
...
.NET (C#)
...
//userID1 and userID2 are both valid int user IDs that have not been added to any project roles
int[] validUserIDs = new int(userID1, userID2);
IRole guestRole = project.GetRole(RoleTypes.Guest);
//Add the two users to the GUEST role
guestRole.AddMember(userID1, MemberTypes.User);
guestRole.AddMember(userID2, MemberTypes.User);
guestRole.Store();
//Subscribe the two users to the project, set notifyForAllCreation setting to true,
//so the two subscribed users will get notified upon all new object creations in this project.
//No Store needs to be called on the project after the call to SubscribeUsers.
projectManager.SubscribeUsers(project, validUserIDs, true);
...