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.actions;
017
018import org.kuali.rice.kew.actiontaken.ActionTakenValue;
019import org.kuali.rice.kew.api.exception.InvalidActionTakenException;
020import org.kuali.rice.kew.api.exception.WorkflowException;
021import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
022import org.kuali.rice.kew.api.KewApiConstants;
023import org.kuali.rice.kim.api.identity.principal.PrincipalContract;
024
025
026
027/**
028 * Does a return to previous as a superuser
029 * 
030 * @author Kuali Rice Team (rice.collab@kuali.org)
031 */
032public class SuperUserReturnToPreviousNodeAction extends SuperUserActionTakenEvent {
033    
034    private String nodeName;
035    
036    public SuperUserReturnToPreviousNodeAction(DocumentRouteHeaderValue routeHeader, PrincipalContract principal) {
037        super(KewApiConstants.ACTION_TAKEN_SU_RETURNED_TO_PREVIOUS_CD, KewApiConstants.SUPER_USER_RETURN_TO_PREVIOUS_ROUTE_LEVEL, routeHeader, principal);
038    }
039    
040    public SuperUserReturnToPreviousNodeAction(DocumentRouteHeaderValue routeHeader, PrincipalContract principal, String annotation, boolean runPostProcessor, String nodeName) {
041        super(KewApiConstants.ACTION_TAKEN_SU_RETURNED_TO_PREVIOUS_CD, KewApiConstants.SUPER_USER_RETURN_TO_PREVIOUS_ROUTE_LEVEL, routeHeader, principal, annotation, runPostProcessor);
042        this.nodeName = nodeName;
043    }
044    
045    protected void markDocument() throws WorkflowException {
046        if (getRouteHeader().isInException()) {
047            //this.event = new DocumentRouteStatusChange(this.documentId, this.getRouteHeader().getAppDocId(), this.getRouteHeader().getDocRouteStatus(), KewApiConstants.ROUTE_HEADER_ENROUTE_CD);
048            getRouteHeader().markDocumentEnroute();
049        }
050        ReturnToPreviousNodeAction returnAction = new ReturnToPreviousNodeAction(this.getActionTakenCode(), getRouteHeader(), getPrincipal(), annotation, nodeName, true, isRunPostProcessorLogic());
051        returnAction.setSuperUserUsage(true);
052        returnAction.performAction();
053    }
054    
055    protected ActionTakenValue processActionRequests() throws InvalidActionTakenException {
056        //do nothing
057        return null;
058    }
059
060}