001/**
002 * Copyright 2005-2015 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;
017
018import org.kuali.rice.kew.actiontaken.ActionTakenValue;
019import org.kuali.rice.kew.api.KewApiConstants;
020
021import java.util.Collections;
022import java.util.HashSet;
023import java.util.Set;
024
025
026/**
027 * Specifies configuration for orchestration through the engine.
028 * 
029 * @author Kuali Rice Team (rice.collab@kuali.org)
030 */
031public class OrchestrationConfig {
032
033    public enum EngineCapability { STANDARD, BLANKET_APPROVAL, SIMULATION }
034    
035    private final EngineCapability capability;
036    private final boolean sendNotifications;
037    private final String notificationType = KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ;
038    private final Set<String> destinationNodeNames;
039    private final ActionTakenValue cause;
040    private final boolean runPostProcessorLogic;
041    //KULRICE-12283: Added two new flags to indicate if acknowledgements and FYIs should be deactivated
042    private final boolean deactivateAcknowledgements;
043    private final boolean deactivateFYIs;
044    
045    public OrchestrationConfig(EngineCapability capability) {
046        this(capability, Collections.<String>emptySet(), null, true, true);
047    }
048    
049    public OrchestrationConfig(EngineCapability capability, boolean isRunPostProcessorLogic) {
050        this(capability, Collections.<String>emptySet(), null, true, isRunPostProcessorLogic);
051    }
052    
053    public OrchestrationConfig(EngineCapability capability, Set<String> destinationNodeNames, ActionTakenValue cause) {
054        this(capability, destinationNodeNames, cause, true, true);
055    }
056
057    //KULRICE-12283: Added new constructors which set up the two new properties
058    public OrchestrationConfig(EngineCapability capability, Set<String> destinationNodeNames, ActionTakenValue cause, boolean sendNotifications, boolean doRunPostProcessorLogic) {
059        this(capability, destinationNodeNames, cause, sendNotifications, doRunPostProcessorLogic, false, false);
060    }
061
062    public OrchestrationConfig(EngineCapability capability, Set<String> destinationNodeNames, ActionTakenValue cause, boolean sendNotifications, boolean doRunPostProcessorLogic, boolean deactivateAcknowledgements, boolean deactivateFYIs) {
063        this.capability = capability;
064        this.destinationNodeNames = Collections.unmodifiableSet(new HashSet<String>(destinationNodeNames));
065        this.cause = cause;
066        this.sendNotifications = sendNotifications;
067        this.runPostProcessorLogic = doRunPostProcessorLogic;
068        this.deactivateAcknowledgements = deactivateAcknowledgements;
069        this.deactivateFYIs = deactivateFYIs;
070    }
071
072    public Set<String> getDestinationNodeNames() {
073        return destinationNodeNames;
074    }
075
076    public String getNotificationType() {
077        return notificationType;
078    }
079
080    public boolean isSendNotifications() {
081        return sendNotifications;
082    }
083
084    public ActionTakenValue getCause() {
085        return cause;
086    }
087
088        public boolean isRunPostProcessorLogic() {
089                return this.runPostProcessorLogic;
090        }
091
092    /**
093     * @return the capability
094     */
095    public EngineCapability getCapability() {
096        return this.capability;
097    }
098
099    //KULRICE-12283: Added getters for two new properties
100    public boolean isDeactivateAcknowledgements() {
101        return deactivateAcknowledgements;
102    }
103
104    public boolean isDeactivateFYIs() {
105        return deactivateFYIs;
106    }
107    
108}