001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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 */
016package org.kuali.rice.kew.engine.node;
017
018import org.kuali.rice.kew.actionitem.ActionItem;
019import org.kuali.rice.kew.actionrequest.service.impl.NotificationSuppression;
020import org.kuali.rice.kew.engine.RouteContext;
021
022import java.util.List;
023
024/**
025 * Abstract superclass for request activation node types.
026 * 
027 * @author Kuali Rice Team (rice.collab@kuali.org)
028 */
029public abstract class RequestActivationNodeBase implements SimpleNode {
030
031        /**
032         * This method takes care of notification for ActionItems.
033     *
034     * <p>It has logic for suppressing notifications a)
035         * during simulations, and b) when the RouteNodeInstance has NodeState specifically hinting for notification
036         * suppression for a given ActionItem.</p>
037         * 
038         * <p>A side effect during non-simulation calls is that any notification suppression NodeStates will be removed
039         * from the RouteNodeInstance after notifications are sent.</p>
040         * 
041         * @param context the routing context in which to perform the notification
042         * @param actionItems the list of action items for which to dispatch notifications
043         * @param routeNodeInstance the node instance at which the notifications are being sent
044         */
045        protected void notify(RouteContext context, List<ActionItem> actionItems, RouteNodeInstance routeNodeInstance) {
046                if (!context.isSimulation()) {
047                        new NotificationSuppression().notify(actionItems, routeNodeInstance);
048                }
049        }
050
051}