001/**
002 * Copyright 2005-2017 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    private final boolean supressRequestsNodePolicyErrors;
045
046    public OrchestrationConfig(EngineCapability capability) {
047        this(capability, Collections.<String>emptySet(), null, true, true);
048    }
049    
050    public OrchestrationConfig(EngineCapability capability, boolean isRunPostProcessorLogic) {
051        this(capability, Collections.<String>emptySet(), null, true, isRunPostProcessorLogic);
052    }
053    
054    public OrchestrationConfig(EngineCapability capability, Set<String> destinationNodeNames, ActionTakenValue cause) {
055        this(capability, destinationNodeNames, cause, true, true);
056    }
057
058    //KULRICE-12283: Added new constructors which set up the two new properties
059    public OrchestrationConfig(EngineCapability capability, Set<String> destinationNodeNames, ActionTakenValue cause,
060            boolean sendNotifications, boolean doRunPostProcessorLogic) {
061        this(capability, destinationNodeNames, cause, sendNotifications, doRunPostProcessorLogic, false, false, false);
062    }
063
064    public OrchestrationConfig(EngineCapability capability, Set<String> destinationNodeNames, ActionTakenValue cause,
065            boolean sendNotifications, boolean doRunPostProcessorLogic, boolean deactivateAcknowledgements,
066            boolean deactivateFYIs, boolean supressRequestsNodePolicyErrors) {
067        this.capability = capability;
068        this.destinationNodeNames = Collections.unmodifiableSet(new HashSet<String>(destinationNodeNames));
069        this.cause = cause;
070        this.sendNotifications = sendNotifications;
071        this.runPostProcessorLogic = doRunPostProcessorLogic;
072        this.deactivateAcknowledgements = deactivateAcknowledgements;
073        this.deactivateFYIs = deactivateFYIs;
074        this.supressRequestsNodePolicyErrors = supressRequestsNodePolicyErrors;
075    }
076
077    public boolean isSupressRequestsNodePolicyErrors() {
078        return supressRequestsNodePolicyErrors;
079    }
080
081    public Set<String> getDestinationNodeNames() {
082        return destinationNodeNames;
083    }
084
085    public String getNotificationType() {
086        return notificationType;
087    }
088
089    public boolean isSendNotifications() {
090        return sendNotifications;
091    }
092
093    public ActionTakenValue getCause() {
094        return cause;
095    }
096
097        public boolean isRunPostProcessorLogic() {
098                return this.runPostProcessorLogic;
099        }
100
101    /**
102     * @return the capability
103     */
104    public EngineCapability getCapability() {
105        return this.capability;
106    }
107
108    //KULRICE-12283: Added getters for two new properties
109    public boolean isDeactivateAcknowledgements() {
110        return deactivateAcknowledgements;
111    }
112
113    public boolean isDeactivateFYIs() {
114        return deactivateFYIs;
115    }
116
117}