Subscriptions

Teamspace members can elect to automatically receive email notifications whenever specified events occur, such as changes to a specific document, or the creation or modification of meetings, polls, or discussion forums. This feature is modeled on the Content Engine's event subscription capabilities.

The Collaboration API contains elements that developers can use to create, modify, and manage user subscriptions from within FileNet P8 applications. Key user subscription elements are:

Subscription Fundamentals

A subscription comprises the following elements:

A UserSubscription object is created when items from the list above are added to a SubscribeInfo object and passed to the SubscriptionManager's updateSubscriptions method, as described below. The same method may be used to update or remove subscriptions.

Creating a User Subscription

In a standard teamspace structure, user subscriptions are created and maintained within the _subscriptions folder, a subfolder of the teamspace's _internal folder.

The following code describes how a UserSubscription object might be created in a known object store and teamspace. For information on teamspace objects, see Teamspaces; for information on creating and managing object stores, see the Content Java API topic, Working With Object Stores.

    // create a new SubscribeInfo object
    SubscribeInfo subscribeInfo = new SubscribeInfo(ownerID, title, description, leaderID);
    UserSubscriptionManager subscriptionManager = teamSpace.getSubscriptionManager();
    UserSubscription subscriptionObject = subscriptionManager.updateSubscriptions(subscribeInfo);

Applying Subscriptions

Subscription definitions are contained in the Collaboration Store file, Subscription Definitions.xml, which is accessed through the SubscriptionsStore and SubscriptionDefinition interfaces. New subscriptions may be created or existing definitions modified through the updateSubscription method of the UserSubscriptionManager interface.

The following example describes how to retrieve a subscription definition:

    SubscriptionsStore subscriptionsStore = CollaborationStore.getSubscriptionsStore(objectStore);
    SubscriptionDefinition subDefinition_CHANGE_IN_TASK_COMPLETION_STATUS_SUBTYPE =
      subscriptionsStore.getSubscriptionDefinitionByType(SubscriptionsStore.CHANGE_IN_TASK_COMPLETION_STATUS_SUBTYPE);
    String containerDefID_CHANGE_IN_TASK_COMPLETION_STATUS_SUBTYPE =
      subDefinition_CHANGE_IN_TASK_COMPLETION_STATUS_SUBTYPE.getContainerDefinitionID();

The following examples illustrate how to create subscriptions for a number of events defined in the default Subscription Definitions.xml file:

For the subscription Discussion Topic Added to Forum:

  1. Get the subscriptionType (100) and containerDefID ({GUID}) data from the SubscriptionDefinition object.
  2. Since this is a teampspace-level subscription, pass nulls in for the subscribedObjID and subscribeObjType.

For the subscription Reply Posted to Discussion Topic:

  1. Get the subscriptionType (101) and containerDefID (null) data from the SubscriptionDefinition object.
  2. Pass the GUID of the specific Topic Posting object for the subscribedObjID and an object type of TYPE_DOCUMENT for subscribeObjType.

For the subscription Any Change To Document:

  1. Get the subscriptionType (200) and containerDefID (null) data from the SubscriptionDefinition object.
  2. Pass the GUID of the specific document object for the subscribedObjID and an object type of TYPE_DOCUMENT for subscribeObjType.

For the subscription Change To Folder:

  1. Get the subscriptionType (300) and containerDefID (null) data from the SubscriptionDefinition object.
  2. Pass the GUID of the specific folder object for the subscribedObjID and an object type of TYPE_FOLDER for subscribeObjType.

For the subscription Document Added To Folder:

  1. Get the subscriptionType (301) and containerDefID (null) data from the SubscriptionDefinition object.
  2. Pass the GUID of the specific folder object for the subscribedObjID and an object type of TYPE_FOLDER for subscribeObjType.

For the subscription Folder Added To Folder:

  1. Get the subscriptionType (302) and containerDefID (null) data from the SubscriptionDefinition object.
  2. Pass the GUID of the specific folder object where folders are to be added for the subscribedObjID and an object type of TYPE_FOLDER for subscribeObjType.

For the subscription Change in Task Completion Status:

  1. Get the subscriptionType (400) and containerDefID (null) data from the SubscriptionDefinition object.
  2. Pass the GUID of the specific Task object for the subscribedObjID and an object type of TYPE_DOCUMENT for subscribeObjType.

For the subscription Task Completed:

  1. Get the subscriptionType (401) and containerDefID (null) data from the SubscriptionDefinition object.
  2. Pass the GUID of the specific Task object for the subscribedObjID and an object type of TYPE_DOCUMENT for subscribeObjType.

For the subscription Task Reopened:

  1. Get the subscriptionType (402) and containerDefID (null) data from the SubscriptionDefinition object.
  2. Pass the GUID of the specific Task object for the subscribedObjID and an object type of TYPE_DOCUMENT for subscribeObjType.

For the subscription Task Expired:

  1. Get the subscriptionType (403) and containerDefID (null) data from the SubscriptionDefinition object.
  2. Pass the GUID of the specific Task object for the subscribedObjID and an object type of TYPE_DOCUMENT for subscribeObjType.

Additional Information

For information on how subscriptions are created and managed within the FileNet P8 TCM application, see Overview of Subscriptions.