Interface ISubscribableMechanics

All Superinterfaces:
IComponent, IInitializable, IMechanics, ISystemHandler, IViewableMechanics
All Known Subinterfaces:
IBasicMechanics, IClipboardMechanics, IContainerContentConstraintMechanics, IContainerMechanics, IContentMechanics, IFolderMechanics, ILinkMechanics, ILocalePortletMechanics, IPortalRulesMechanics, IPortletMechanics, IRuleMechanics, IScheduleMechanics, ISkinMechanics, ITaskMechanics, ITaskScheduleMechanics, ITemplateMechanics, ITopicMechanics, IVersionableMechanics, IXTypeMechanics

public interface ISubscribableMechanics extends IViewableMechanics
Mechanics for a subsbcribable item.
  • Field Details

  • Method Details

    • canViewSubscription

      boolean canViewSubscription(IURI itemId, IThingID userId, Map<?,?> capabilities, IThingID subscriberId) throws PortalException
      Returns true if the specified user can view specified principal's subscription to the specified resource.
      Parameters:
      itemId - IURI of the resource
      userId - ThingID of the viewer
      capabilities - reserved
      subscriberId - ThingID of the subscriber
      Returns:
      boolean
      Throws:
      PortalException
    • checkViewSubscription

      @Deprecated void checkViewSubscription(IThingID pageId, IThingID userId, Map<?,?> capabilities, IThingID subscriberId) throws PortalException, PortalAccessException
      Throws a PortalAccessException if the specified user cannot view specified principal's subscription to the specified resource.
      Parameters:
      pageId - reserved
      userId - ThingID of the viewer
      capabilities - reserved
      subscriberId - ThingID of the subscriber
      Throws:
      PortalException
      PortalAccessException
    • checkViewSubscription

      void checkViewSubscription(IURI itemId, IThingID userId, Map<?,?> capabilities, IThingID subscriberId) throws PortalException, PortalAccessException
      Throws a PortalAccessException if the specified user cannot view specified principal's subscription to the specified resource.
      Parameters:
      itemId - IURI of the resource
      userId - ThingID of the viewer
      capabilities - reserved
      subscriberId - ThingID of the subscriber
      Throws:
      PortalException
      PortalAccessException
    • canListSubscriptions

      boolean canListSubscriptions(IURI itemId, IThingID userId, Map<?,?> capabilities) throws PortalException
      Returns true if the specified user can list the subscriptions to the specified resource.
      Parameters:
      itemId - IURI of the resource
      userId - ThingID of user to list subscriptions
      capabilities - reserved
      Returns:
      boolean
      Throws:
      PortalException
    • checkListSubscriptions

      void checkListSubscriptions(IURI itemId, IThingID userId, Map<?,?> capabilities) throws PortalException, PortalAccessException
      Throws a PortalAccessException if the specified user cannot list the subscriptions to the specified resource.
      Parameters:
      itemId - IURI of the resource
      userId - ThingID of the user
      capabilities - reserved
      Throws:
      PortalException
      PortalAccessException
    • canEditSubscription

      boolean canEditSubscription(IURI itemId, IThingID userId) throws PortalException
      Returns true if the specified user can add, edit, or remove a subscription the the specified resource.
      Parameters:
      itemId - IURI of the resource
      userId - ThingID of the user
      Throws:
      PortalException
    • checkEditSubscription

      void checkEditSubscription(IURI itemId, IThingID userId) throws PortalException, PortalAccessException
      Throws a PortalAccessException if the specified user cannot add, edit, or remove a subscription the the specified resource.
      Parameters:
      itemId - IURI of the resource
      userId - ThingID of the user
      Throws:
      PortalException
      PortalAccessException
    • fireGetSubscriptionEvent

      void fireGetSubscriptionEvent(IThingID subscriptionId, IThingID userId, int status) throws PortalException
      Fires a getsubscription event.
      Parameters:
      subscriptionId - Resource whose subscription was viewed.
      userId - User who viewed the subscription.
      status - Status of the event (sucessful, denied, error).
      Throws:
      PortalException
    • fireViewSubscriptionEvent

      void fireViewSubscriptionEvent(IThingID subscriptionId, IThingID userId, int status) throws PortalException
      Fires a view subscription event.
      Parameters:
      subscriptionId - Resource whose subscription was viewed.
      userId - User who viewed the subscription.
      status - Status of the event (sucessful, denied, error).
      Throws:
      PortalException
    • fireSetSubscriptionEvent

      void fireSetSubscriptionEvent(IThingID subscriptionId, IThingID userId, int status) throws PortalException
      Fires a set subscribe event.
      Parameters:
      subscriptionId -
      userId - User adding or modifing the subscription.
      status - Status of the event (sucessful, denied, error).
      Throws:
      PortalException
    • fireUnsubscribeEvent

      void fireUnsubscribeEvent(IThingID subscriptionId, IThingID userId, int status) throws PortalException
      Fires a unsubscribe event.
      Parameters:
      subscriptionId - Resource to which the subscription was removed.
      userId - User removing the subscription.
      status - Status of the event (sucessful, denied, error).
      Throws:
      PortalException
    • fireGetAppCriteriaEvent

      void fireGetAppCriteriaEvent(String criteriaFolderName, IThingID userId, int status) throws PortalException
      Fires a get criterion event
      Parameters:
      criteriaFolderName - The folder name that contains the criteria
      userId -
      status -
      Throws:
      PortalException
    • createPortletSubscription

      IThingID createPortletSubscription(IThingID subscriberPortlet, IThingID source, ICriterion crit) throws PortalException
      Create a subscription for a portlet subscriber
      Parameters:
      subscriberPortlet -
      source -
      crit -
      Returns:
      The subscription thingID
      Throws:
      PortalException
    • createPortletSubscription

      IThingID createPortletSubscription(IThingID subscriberPortlet, IThingID source, List<ICriterion> criteria) throws PortalException
      Create a subscription for a portlet subscriber
      Parameters:
      subscriberPortlet -
      source -
      criteria - list of ICriterion
      Returns:
      The subscription thingID
      Throws:
      PortalException
    • getSubscription

      IThingID getSubscription(IThingID itemId, IThingID subscriberID) throws PortalException
      Get a subscription for the specified subscriber on the specified resource
      Parameters:
      itemId - The resource thingID
      subscriberID - The subscriber's thingID
      Returns:
      IThingID of the subscriber's subscription, or null if nothing found.
      Throws:
      PortalException
    • getGroupSubscription

      IThingID getGroupSubscription(IThingID itemId, IThingID subscriberID, IThingID ownerID) throws PortalException
      Get a subscription for the specified subscriber on the specified resource
      Parameters:
      itemId - The resource thingID
      subscriberID - The subscriber's thingID
      ownerID - The owner's thingID
      Returns:
      IThingID of the subscriber's subscription, or null if nothing found.
      Throws:
      PortalException
    • setSubscription

      IThingID setSubscription(IThingID itemId, IThingID userId, int deliveryMethods, IThingIDList criteria) throws PortalException
      Throws a PortalAccessException if the specified user cannot set a subscription the the specified resource.
      Parameters:
      itemId - The resource to monitor
      userId - The user thingID to receive notifications
      deliveryMethods - email or portalinbox
      criteria - A list of specified criteria thingID
      Returns:
      subscription thingID
      Throws:
      PortalException
    • setSubscription

      IThingID setSubscription(IThingID itemId, IThingID userId, int deliveryMethods, IThingIDList criteria, boolean recursive) throws PortalException
      Creates a subscription for a thing
      Parameters:
      itemId - source thing ID
      userId - subscriber thing ID
      deliveryMethods - what is delivery method for subscription. See ISubscription
      criteria - list of subscription criterias
      recursive - whether this is a recursive subscription
      Returns:
      subscription thing ID
      Throws:
      PortalException
    • setGroupSubscription

      IThingID setGroupSubscription(IThingID itemId, IThingID ownerId, IThingID groupId, int deliveryMethods, IThingIDList criteria) throws PortalException
      Set group subscription
      Parameters:
      itemId - The resource to monitor
      ownerId - The owner of the subscription
      groupId - The group to receive the notifications
      deliveryMethods - Notification delivery methods
      criteria - criteria to match
      Returns:
      subscription thingID
      Throws:
      PortalException
    • setGroupSubscription

      IThingID setGroupSubscription(IThingID itemId, IThingID ownerId, IThingID groupId, int deliveryMethods, IThingIDList criteria, boolean isRecursive) throws PortalException
      Set group subscription
      Parameters:
      itemId - The resource to monitor
      ownerId - The owner of the subscription
      groupId - The group to receive the notifications
      deliveryMethods - Notification delivery methods
      criteria - criteria to match
      Returns:
      subscription thingID
      Throws:
      PortalException
    • enable

      void enable(IThingID itemId, IThingID subscriberId) throws PortalException
      Enables the subscription for the specified resource to the specified principal.
      Parameters:
      itemId - Resource.
      subscriberId - Principal.
      Throws:
      PortalException
    • enable

      void enable(IThingID subscriptionId) throws PortalException
      Enables the specified subscription.
      Parameters:
      subscriptionId - Subscription to enable.
      Throws:
      PortalException
    • disable

      void disable(IThingID itemId, IThingID subscriberId) throws PortalException
      Disables the subscription for the specified resource to the specified principal.
      Parameters:
      itemId - Resource.
      subscriberId - Principal.
      Throws:
      PortalException
    • disable

      void disable(IThingID subscriptionId) throws PortalException
      Disables the specified subscription.
      Parameters:
      subscriptionId - Subscription to disable.
      Throws:
      PortalException
    • disableBySystem

      void disableBySystem(IThingID itemId, IThingID subscriberId) throws PortalException
      Disables the subscription for the specified resource to the specified principal, and marks it as disabled by the system (rather than by the principal).
      Parameters:
      itemId - Resource.
      subscriberId - Principal.
      Throws:
      PortalException
    • disableBySystem

      void disableBySystem(IThingID subscriptionId) throws PortalException
      Disables the specified subscription, and marks it as disabled by the system (rather than by the principal).
      Parameters:
      subscriptionId - Subscription to disable.
      Throws:
      PortalException
    • unsubscribe

      void unsubscribe(IThingID itemId, IThingID subscriberId) throws PortalException
      Unsubscribes the specified principal from the specified resource for the specified rule.
      Parameters:
      itemId - The resource to unsubscribe.
      subscriberId - Principal to unsubscribe.
      Throws:
      PortalException
    • unsubscribe

      void unsubscribe(IThingID subscriptionId) throws PortalException
      Unsubscribes the specified subscription ID
      Parameters:
      subscriptionId - The subscription thingID to unsubscribe.
      Throws:
      PortalException
    • viewSubscription

      IView viewSubscription(IURI itemId, IThingID subscriberId) throws PortalException
      Returns the standard view of a subscription for the specified subscriber to the specified resource.
      Parameters:
      itemId - Subsbcribed resource.
      subscriberId - Principal whose subscription to view.
      Returns:
      View of subscription or null if the subscriber does not have a subscription to the resource.
      Throws:
      PortalException
    • listSubscriptions

      IListView<IView> listSubscriptions(IThingID pageId, int start, int length) throws PortalException
      Returns a page of subscriptions to the specified resource.
      Parameters:
      pageId - page id.
      start - List starting index (0 for first item).
      length - List length (<1 for all items).
      Returns:
      List of IView items, or an empty list.
      Throws:
      PortalException
    • listSubscriptions

      IListView<IView> listSubscriptions(IThingID pageId, IThingID userId, int start, int length) throws PortalException
      Returns a page of subscriptions to the specified resource, filtered for the specified user.
      Parameters:
      pageId - page id.
      userId - User for which to filter.
      start - List starting index (0 for first item).
      length - List length (<1 for all items).
      Returns:
      List of IView items, or an empty list.
      Throws:
      PortalException
    • createAppCriteriaFolder

      IThingID createAppCriteriaFolder(String folderName, String layout, String description) throws PortalException
      Create a folder to contain a list of application criteria
      Parameters:
      folderName - The name of the criteria folder
      layout - The rendering layout template
      description - The description of the criteria folder
      Returns:
      The folder thingID
      Throws:
      PortalException
    • createAppCriteria

      IThingID createAppCriteria(IThingID appCriteriaFolderID, String criterionName, String criterionInfo, String operationName, int operationCode, String property) throws PortalException
      Create a criterion within the specified folder
      Parameters:
      appCriteriaFolderID - The application criteria folder thingID
      criterionName - The name of the criterion
      criterionInfo - The information field of the criterion
      operationName - The name of the criterion operation
      operationCode - The code of the criterion operation
      property - The property of the criterion operation
      Returns:
      The thingID of the created criterion
      Throws:
      PortalException
    • getAppCriteria

      IThingIDList getAppCriteria(String criteriaFolderName) throws PortalException
      Get application criteria based on the name of the criteria folder
      Parameters:
      criteriaFolderName - The name of the criteria folder
      Returns:
      A list of criteria thingID
      Throws:
      PortalException
    • canDeliverToPrincipal

      boolean canDeliverToPrincipal(IURI principalURI, IURI targetURI, IThingID criteriaID, INotificationSourceEvent event) throws PortalException
      Determines if the notification could be delivered to the end user. The default implementation just checks user permissions on the sources and other notification objects
      Parameters:
      principalURI - user to deliver notification to
      targetURI - target resource being notified about
      criteriaID - criteria ID being notified about
      event - notification source event
      Returns:
      Throws:
      PortalException
    • generateNotificationContent

      void generateNotificationContent(Writer content, String contentFormat, String contentType, IURI targetId, IThingID criteriaID, INotificationSourceEvent event, Locale locale) throws PortalException
      Generates notification content for the specified target resource, user, subscription, and event.
      Parameters:
      content - Output stream to which to write notification content.
      contentType - Content media type. May include charset.
      targetId - Resource about which to notify (ie notification generated because user subscribed to this resource).
      criteriaID - ID of the criteria that matched for this subscription e.g. "item is added" or "item is updated" or "item is deleted"
      event - about which to notify user.
      Throws:
      PortalException
    • generateNotificationHeaders

      Map<String,String> generateNotificationHeaders(String contentFormat, IURI targetId, IThingID criteriaID, INotificationSourceEvent event, Locale locale) throws PortalException
      Generates MIME headers for notification. For example, may generate Subject, From, Reply-To, and Message-ID. Does not need to generate content headers (ie Content-Type, etc.). Headers names should be in canonical form (capitalized, with hyphens). Header values should not be encoded.
      Parameters:
      targetId - Resource about which to notify (ie notification generated because user subscribed to this resource).
      criteriaID - ID of the criteria that matched for this subscription e.g. "item is added" or "item is updated" or "item is deleted"
      event - Event about which to notify user.
      Throws:
      PortalException