All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.day.cq.wcm.notification.NotificationManager Maven / Gradle / Ivy

/*
 * Copyright 1997-2009 Day Management AG
 * Barfuesserplatz 6, 4001 Basel, Switzerland
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * Day Management AG, ("Confidential Information"). You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Day.
 */
package com.day.cq.wcm.notification;

import java.util.Iterator;
import java.util.Map;

import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;

import org.apache.sling.api.resource.PersistableValueMap;
import org.apache.sling.api.resource.ValueMap;

import org.apache.jackrabbit.api.security.user.Authorizable;

/**
 * The notification manager manages the notification and subscription
 * configurations.
 * It can be used to query the configurations for a given authorizable
 * update and create them.
 */
public interface NotificationManager {

    /**
     * Return all subscriptions for a given authorizable.
     * @param authorizable The authorizable.
     * @return An iterator for the subscription configurations.
     */
    Iterator getSubscriptionConfigurations(Authorizable authorizable, Session session);

    /**
     * Return all channel configurations for a given authorizable.
     * @param authorizable The authorizable.
     * @return An iterator for the channel configurations.
     */
    Iterator getChannelConfigurations(Authorizable authorizable, Session session);

    /**
     * Return the channel.
     * @param type The channel type.
     * @return The channel or null
     */
    Channel getChannel(String type);

    /**
     * Return the subscription.
     * @param type The subscription type.
     * @return The subscription or null
     */
    Subscription getSubscription(String type);
    
    /**
     * Return the channel configuration for the subscription.
     * @param authorizable The authorizable.
     * @param subscriptionConfig The subscription configuration.
     * @return The channel configuration or null
     */
    PersistableValueMap getChannelConfiguration(Authorizable authorizable, Map subscriptionConfig, Session session);
    
    /**
     * Create a new subscription for the authorizable.
     *
     * @param authorizable  The authorizable.
     * @param configuration The configuration.
     * @param session User's session.
     *
     * @return true if the configuration could be created, false otherwise.
     */
    boolean subscribe(Authorizable authorizable, Map configuration, Session session);
    
    /**
     * Remove all subscriptions matching the given path. The path denotes the item
     * the user originally subscribed for.
     *
     * @param authorizable The authorizable.
     * @param path         The path of the subscription to remove.
     * @param session User's session.
     *
     * @return true if the configuration could be removed, false otherwise.
     */
    boolean unsubscribe(Authorizable authorizable, String path, Session s);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy