gt:         IacucProtocolForm protocolForm = (IacucProtocolForm) form;
context: /*
   * Kuali Coeus, a comprehensive research administration system for higher education.
   * 
   * Copyright 2005-2015 Kuali, Inc.
   * 
   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the GNU Affero General Public License as
   * published by the Free Software Foundation, either version 3 of the
   * License, or (at your option) any later version.
   * 
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU Affero General Public License for more details.
   * 
   * You should have received a copy of the GNU Affero General Public License
   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
   */
  package org.kuali.kra.iacuc.actions;
  
  import org.apache.commons.lang3.StringUtils;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionForward;
  import org.apache.struts.action.ActionMapping;
  import org.kuali.coeus.common.committee.impl.meeting.CommitteeScheduleMinuteBase;
  import org.kuali.coeus.common.committee.impl.meeting.MinuteEntryType;
  import org.kuali.coeus.common.framework.attachment.AttachmentFile;
  import org.kuali.coeus.common.framework.print.Printable;
  import org.kuali.coeus.common.framework.print.PrintableAttachment;
  import org.kuali.coeus.common.framework.print.PrintingException;
  import org.kuali.coeus.common.framework.print.util.PrintingUtils;
  import org.kuali.coeus.common.framework.print.watermark.WatermarkConstants;
  import org.kuali.coeus.common.framework.print.watermark.WatermarkService;
  import org.kuali.coeus.common.notification.impl.bo.NotificationType;
  import org.kuali.coeus.common.notification.impl.service.KcNotificationService;
  import org.kuali.coeus.common.framework.auth.task.ApplicationTask;
  import org.kuali.coeus.common.framework.auth.task.TaskAuthorizationService;
  import org.kuali.coeus.sys.framework.validation.AuditHelper;
  import org.kuali.coeus.sys.framework.controller.StrutsConfirmation;
  import org.kuali.coeus.sys.framework.service.KcServiceLocator;
  import org.kuali.kra.iacuc.IacucProtocol;
  import org.kuali.kra.iacuc.IacucProtocolAction;
  import org.kuali.kra.iacuc.IacucProtocolDocument;
  import org.kuali.kra.iacuc.IacucProtocolForm;
  import org.kuali.kra.iacuc.actions.amendrenew.IacucProtocolAmendRenewService;
  import org.kuali.kra.iacuc.actions.amendrenew.ModifyIacucAmendmentSectionsEvent;
  import org.kuali.kra.iacuc.actions.copy.IacucProtocolCopyService;
  import org.kuali.kra.iacuc.actions.decision.IacucCommitteeDecision;
  import org.kuali.kra.iacuc.actions.decision.IacucCommitteeDecisionAbstainerEvent;
  import org.kuali.kra.iacuc.actions.decision.IacucCommitteeDecisionRecuserEvent;
  import org.kuali.kra.iacuc.actions.decision.IacucCommitteePerson;
  import org.kuali.kra.iacuc.actions.delete.IacucProtocolDeleteService;
  import org.kuali.kra.iacuc.actions.followup.IacucFollowupActionService;
  import org.kuali.kra.iacuc.actions.genericactions.IacucProtocolGenericActionBean;
  import org.kuali.kra.iacuc.actions.print.IacucProtocolPrintingService;
  import org.kuali.kra.iacuc.actions.request.IacucProtocolRequestBean;
  import org.kuali.kra.iacuc.actions.reviewcomments.*;
  import org.kuali.kra.iacuc.actions.submit.*;
  import org.kuali.kra.iacuc.actions.undo.IacucProtocolUndoLastActionService;
  import org.kuali.kra.iacuc.auth.IacucProtocolTask;
  import org.kuali.kra.iacuc.committee.meeting.IacucCommitteeScheduleMinute;
  import org.kuali.kra.iacuc.correspondence.IacucProtocolActionCorrespondenceGenerationService;
  import org.kuali.kra.iacuc.correspondence.IacucProtocolActionsCorrespondence;
  import org.kuali.kra.iacuc.infrastructure.IacucConstants;
  import org.kuali.kra.iacuc.noteattachment.IacucProtocolAttachmentPersonnel;
  import org.kuali.kra.iacuc.noteattachment.IacucProtocolAttachmentProtocol;
  import org.kuali.kra.iacuc.noteattachment.IacucProtocolAttachmentService;
  import org.kuali.kra.iacuc.notification.IacucProtocolNotificationContext;
  import org.kuali.kra.iacuc.notification.IacucProtocolNotificationRenderer;
  import org.kuali.kra.iacuc.notification.IacucProtocolNotificationRequestBean;
  import org.kuali.kra.iacuc.onlinereview.IacucProtocolReviewAttachment;
  import org.kuali.kra.iacuc.questionnaire.print.IacucCorrespondencePrintingService;
  import org.kuali.kra.iacuc.questionnaire.print.IacucQuestionnairePrintingService;
  import org.kuali.kra.infrastructure.Constants;
  import org.kuali.kra.infrastructure.KeyConstants;
  import org.kuali.kra.infrastructure.TaskName;
  import org.kuali.kra.irb.actions.history.ProtocolHistoryFilterDatesEvent;
  import org.kuali.coeus.common.framework.print.AttachmentDataSource;
  import org.kuali.kra.protocol.ProtocolBase;
  import org.kuali.kra.protocol.ProtocolDocumentBase;
  import org.kuali.kra.protocol.ProtocolFormBase;
  import org.kuali.kra.protocol.actions.ProtocolActionBase;
  import org.kuali.kra.protocol.actions.ProtocolActionBean;
  import org.kuali.kra.protocol.actions.ProtocolOnlineReviewCommentable;
  import org.kuali.kra.protocol.actions.ProtocolSubmissionDocBase;
  import org.kuali.kra.protocol.actions.notify.ProtocolActionAttachment;
  import org.kuali.kra.protocol.actions.print.ProtocolActionPrintEvent;
  import org.kuali.kra.protocol.actions.submit.ProtocolReviewerBeanBase;
  import org.kuali.kra.protocol.actions.undo.UndoLastActionBean;
  import org.kuali.kra.protocol.correspondence.ProtocolCorrespondence;
  import org.kuali.kra.protocol.noteattachment.ProtocolAttachmentBase;
  import org.kuali.kra.protocol.noteattachment.ProtocolAttachmentProtocolBase;
  import org.kuali.kra.protocol.summary.AttachmentSummary;
  import org.kuali.kra.protocol.summary.ProtocolSummary;
  import org.kuali.rice.core.api.datetime.DateTimeService;
  import org.kuali.rice.kns.document.authorization.DocumentAuthorizerBase;
  import org.kuali.rice.kns.util.KNSGlobalVariables;
  import org.kuali.rice.krad.util.GlobalVariables;
  import org.kuali.rice.krad.util.KRADConstants;
  import org.kuali.rice.krad.util.ObjectUtils;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import java.sql.Date;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  public class IacucProtocolActionsAction extends IacucProtocolAction {
  
      private static final Log LOG = LogFactory.getLog(IacucProtocolActionsAction.class);
      private static final String CONFIRM_NO_ACTION = "";
      private static final String CONFIRM_DELETE_ACTION_ATT = "confirmDeleteActionAttachment";
      private static final String CONFIRM_FOLLOWUP_ACTION = "confirmAddFollowupAction";
  
      private static final String CONFIRM_SUBMIT_FOR_REVIEW_KEY = "confirmSubmitForReview";
      
      private static final String NOT_FOUND_SELECTION = "The attachment was not found for selection ";
  
      private static final String CONFIRM_DELETE_PROTOCOL_KEY = "confirmDeleteProtocol";
      private static final String INVALID_ATTACHMENT = "this attachment version is invalid ";
  
      /** signifies that a response has already be handled therefore forwarding to obtain a response is not needed. */
      private static final ActionForward RESPONSE_ALREADY_HANDLED = null;
      private static final String SUBMISSION_ID = "submissionId";
      private static final String CORRESPONDENCE = "correspondence";
      public static final String ACTION_HELPER = "actionHelper.";
      public static final String REVIEWER_ATTRIBUTE = ".reviewer[";
      public static final String NUMBER_OF_REVIEWERS_ATTRIBUTE = ".numberOfReviewers";
      public static final String REVIEWER_TYPE_CODE_ATTRIBUTE = "].reviewerTypeCode";
      public static final String PERSON_ID_ATTRIBUTE = "].personId";
      public static final String FULL_NAME_ATTRIBUTE = "].fullName";
      public static final String NON_EMPLOYEE_FLAG_ATTRIBUTE = "].nonEmployeeFlag";
      public static final String TRUE_FLAG = "Y";
  
  
      public ActionForward assignCommitteeSchedule(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ProtocolFormBase protocolForm = (ProtocolFormBase) form;
          IacucProtocol protocol = (IacucProtocol) protocolForm.getProtocolDocument().getProtocol();
          final String callerString = "assignCommitteeSchedule";
   
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
  
      @Override
      public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
              throws Exception {
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if (request.getParameterMap().containsKey("doCopy")) {
              String docId  = request.getParameter("docId");
              IacucProtocolDocument ipd = (IacucProtocolDocument) this.getDocumentService().getByDocumentHeaderId(docId);
              protocolForm.setDocument(ipd);
              protocolForm.setDefaultOpenCopyTab(true);
          }
          
          // set the current task name on the action helper before the requested method is dispatched
          // so that beans etc can access it when preparing view after/during the requested method's execution
          String currentTaskName = getTaskName(request);
          if(currentTaskName != null) {
              protocolForm.getActionHelper().setCurrentTask(currentTaskName);
          }
          else {
              protocolForm.getActionHelper().setCurrentTask("");
          }
          ActionForward actionForward = super.execute(mapping, form, request, response);
  
          if ("close".equals(protocolForm.getMethodToCall()) || protocolForm.getMethodToCall() == null) {
              // If we're closing, we can just leave right here.
              return mapping.findForward(KRADConstants.MAPPING_PORTAL);
          }
  
          protocolForm.getActionHelper().prepareView();
          protocolForm.getActionHelper().initFilterDatesView();
          // submit action may change "submission details", so re-initialize it
          // TODO do we really need this? the above call to prepareView() will invoke it anyway, so the below call seems redundant and wasteful.
          ((IacucActionHelper)protocolForm.getActionHelper()).initSubmissionDetails();
          
          return actionForward;
      }
  
      
      
      /**
       * Invoked when the "copy protocol" button is clicked.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward copyProtocol(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
  
  
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
  
          ApplicationTask task = new ApplicationTask(TaskName.CREATE_IACUC_PROTOCOL);
          if (isAuthorized(task)) {
              String newDocId = getIacucProtocolCopyService().copyProtocol(protocolForm.getIacucProtocolDocument()).getDocumentNumber();
  
              // Switch over to the new protocol document and
              // go to the ProtocolBase tab web page.
  
              protocolForm.setDocId(newDocId);
              protocolForm.setViewOnly(false);
              loadDocument(protocolForm);
              protocolForm.getIacucProtocolDocument().setViewOnly(protocolForm.isViewOnly());
              protocolForm.getActionHelper().setCurrentSubmissionNumber(-1);
              protocolForm.getProtocolHelper().prepareView();
              
              return mapping.findForward(IacucConstants.PROTOCOL_TAB);
          }
  
          return mapping.findForward(Constants.MAPPING_BASIC);
      }    
  
      public ActionForward activate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
              throws Exception {
          return KcServiceLocator.getService(AuditHelper.class).setAuditMode(mapping, (ProtocolFormBase) form, true);
      }
  
      public ActionForward deactivate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
              throws Exception {
          return KcServiceLocator.getService(AuditHelper.class).setAuditMode(mapping, (ProtocolFormBase) form, false);
      }
  
      /**
       * Refreshes the page. We only need to redraw the page. This method is used when JavaScript is disabled. During a review
       * submission action, the user will have to refresh the page. For example, after a committee is selected, the page needs to be
       * refreshed so that the available scheduled dates for that committee can be displayed in the drop-down menu for the scheduled
       * dates. Please see ProtocolSubmitAction.prepareView() for how the Submit for Review works on a refresh.
       * 
       * @param mapping the mapping associated with this action.
       * @param form the ProtocolBase form.
       * @param request the HTTP request
       * @param response the HTTP response
       * @return the name of the HTML page to display
       * @throws Exception doesn't ever really happen
       */
      public ActionForward refreshPage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
  
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
  
      
      /**
       * Submit a protocol for review.
       * 
       * @param mapping the mapping associated with this action.
       * @param form the ProtocolBase form.
       * @param request the HTTP request
       * @param response the HTTP response
       * @return the name of the HTML page to display
       * @throws Exception
       */
      public ActionForward submitForReview(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
  
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          IacucProtocolDocument protocolDocument = (IacucProtocolDocument)protocolForm.getProtocolDocument();
          protocolForm.setAuditActivated(true);
          IacucProtocolTask task = new IacucProtocolTask(TaskName.SUBMIT_IACUC_PROTOCOL, protocolDocument.getIacucProtocol());
          if (isAuthorized(task)) {
              IacucProtocolSubmitAction submitAction = (IacucProtocolSubmitAction) protocolForm.getActionHelper().getProtocolSubmitAction();            
              if (applyRules(protocolForm,new IacucProtocolSubmitActionEvent(protocolDocument, submitAction))) {
                  AuditHelper auditHelper = KcServiceLocator.getService(AuditHelper.class);
                  if (auditHelper.auditUnconditionally(protocolDocument)) {
                      
                      if (isCommitteeMeetingAssignedMaxProtocols(submitAction.getNewCommitteeId(), submitAction.getNewScheduleId())) {
                          forward = confirm(buildSubmitForReviewConfirmationQuestion(mapping, form, request, response), CONFIRM_SUBMIT_FOR_REVIEW_KEY, "");
                      } else {
                          forward = submitForReviewAndRedirect(mapping, form, request, response);
                      }
                  } else {
                      GlobalVariables.getMessageMap().clearErrorMessages();
                      GlobalVariables.getMessageMap().putError("datavalidation", KeyConstants.ERROR_WORKFLOW_SUBMISSION,  new String[] {});
                  }
              }
          }
  
          return forward;
      }
      
  
      public ActionForward assignCommittee(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isAssignCommitteeAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().assignCommittee(protocolForm);
              forward = mapping.findForward(forwardTo);
          }
          return forward;
      }
        
      private boolean isCommitteeMeetingAssignedMaxProtocols(String committeeId, String scheduleId) {
          boolean isMax = false;
          
          return isMax;
      }
  
      /*
       * Builds the confirmation question to verify if the user wants to submit the protocol for review.
       */
      private StrutsConfirmation buildSubmitForReviewConfirmationQuestion(ActionMapping mapping, ActionForm form,
              HttpServletRequest request, HttpServletResponse response) throws Exception {
          return buildParameterizedConfirmationQuestion(mapping, form, request, response, CONFIRM_SUBMIT_FOR_REVIEW_KEY,
                  KeyConstants.QUESTION_PROTOCOL_CONFIRM_SUBMIT_FOR_REVIEW);
      }
  
      /**
       * Method dispatched from <code>{@link org.kuali.coeus.sys.framework.controller.KcTransactionalDocumentActionBase#confirm(StrutsQuestion, String, String)}</code> for
       * when a "yes" condition is met.
       * 
       * @param mapping The mapping associated with this action.
       * @param form The ProtocolBase form.
       * @param request the HTTP request
       * @param response the HTTP response
       * @return the destination
       * @throws Exception
       * @see org.kuali.coeus.sys.framework.controller.KcTransactionalDocumentActionBase#confirm(StrutsQuestion, String, String)
       */
      public ActionForward confirmSubmitForReview(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 
          throws Exception {
          
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          
          Object question = request.getParameter(KRADConstants.QUESTION_INST_ATTRIBUTE_NAME);
          if (CONFIRM_SUBMIT_FOR_REVIEW_KEY.equals(question)) {
              forward = submitForReviewAndRedirect(mapping, form, request, response);
          }
  
          return forward;
      }
  
      
      /**
       * Submits the ProtocolBase for review and calculates the redirect back to the portal page, adding in the proper parameters for displaying a message to the
       * user upon successful submission.
       * 
       * @param mapping The mapping associated with this action.
       * @param form The ProtocolBase form.
       * @param request the HTTP request
       * @param response the HTTP response
       * @return the destination
       * @throws Exception
       */
      private ActionForward submitForReviewAndRedirect(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 
      throws Exception {
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          List<ProtocolReviewerBeanBase> reviewers = getReviewers(request, "iacucProtocolSubmitAction");
          super.route(mapping, protocolForm, request, response);
          getProtocolActionRequestService().submitForReview(protocolForm, reviewers);
          return routeProtocolToHoldingPage(mapping, protocolForm);
      }
      
          
      private ActionForward routeProtocolToHoldingPage(ActionMapping mapping, ProtocolFormBase protocolForm) {
          String routeHeaderId = protocolForm.getProtocolDocument().getDocumentNumber();
          String returnLocation = buildActionUrl(routeHeaderId, Constants.MAPPING_PROTOCOL_ACTIONS, "IacucProtocolDocument");
          
          ActionForward basicForward = mapping.findForward(KRADConstants.MAPPING_PORTAL);
          ActionForward holdingPageForward = mapping.findForward(Constants.MAPPING_HOLDING_PAGE);
          return routeToHoldingPage(basicForward, basicForward, holdingPageForward, returnLocation);
      }
      
      
      
      /**
       * Administratively mark incomplete a previously submitted protocol.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward administrativelyMarkIncompleteProtocol(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isAdministrativelyMarkIncompleteProtocolAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().administrativelyMarkIncompleteProtocol(protocolForm);
              loadDocument(protocolForm);
              protocolForm.getProtocolHelper().prepareView();
              forward = mapping.findForward(forwardTo);
          }
          return forward;
      }
      
      
      
      /**
       * Administratively withdraw a previously submitted protocol.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward administrativelyWithdrawProtocol(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isAdministrativelyWithdrawProtocolAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().administrativelyWithdrawProtocol(protocolForm);
              loadDocument(protocolForm);
              protocolForm.getProtocolHelper().prepareView();
              forward = mapping.findForward(forwardTo);
          }
          return forward;
      }
      
      
      
      /**
       * Withdraw a previously submitted protocol.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward withdrawProtocol(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isWithdrawProtocolAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().withdrawProtocol(protocolForm);
              loadDocument(protocolForm);
              protocolForm.getProtocolHelper().prepareView();
              forward = mapping.findForward(forwardTo);
          }
          return forward;
      }
      
  
      /**
       * Notify the IACUC office.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward notifyIacucProtocol(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          String forwardTo = getProtocolActionRequestService().notifyProtocol(protocolForm);
          forward = mapping.findForward(forwardTo);
          return forward;
      }
  
      /**
       * Create an Amendment.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward createAmendment(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isCreateAmendmentAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().createAmendment(protocolForm);
              forward = mapping.findForward(forwardTo);
              // Switch over to the new protocol document and
              // go to the Protocol tab web page.
              loadDocument(protocolForm);
              protocolForm.getProtocolHelper().prepareView();
          }
          return forward;
      }
      
  
      /**
       * Modify an Amendment.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward modifyAmendmentSections(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          IacucProtocolDocument protocolDocument = protocolForm.getIacucProtocolDocument();
          IacucProtocol protocol = protocolDocument.getIacucProtocol();
          protocolForm.getActionHelper().setCurrentTask(TaskName.MODIFY_PROTOCOL_AMMENDMENT_SECTIONS);
          IacucProtocolTask task = new IacucProtocolTask(TaskName.MODIFY_PROTOCOL_AMMENDMENT_SECTIONS, protocol);
          if (isAuthorized(task)) {
              if (!applyRules(new ModifyIacucAmendmentSectionsEvent(protocolDocument, Constants.PROTOCOL_MODIFY_AMENDMENT_KEY,
                  protocolForm.getActionHelper().getProtocolAmendmentBean()))) {
                  return mapping.findForward(Constants.MAPPING_BASIC);
              }
          
              getProtocolAmendRenewService().updateAmendmentRenewal(protocolForm.getProtocolDocument(), 
                      protocolForm.getActionHelper().getProtocolAmendmentBean());
              
              return save(mapping, protocolForm, request, response);
          }
              
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
      
      
      /**
       * Create a Renewal without an Amendment.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward createRenewal(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isCreateRenewalAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().createRenewal(protocolForm);
              forward = mapping.findForward(forwardTo);
              // Switch over to the new protocol document and
              // go to the Protocol tab web page.
              loadDocument(protocolForm);
              protocolForm.getProtocolHelper().prepareView();
          }
          return forward;
      }
  
      /**
       * Create a Renewal with an Amendment.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward createRenewalWithAmendment(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isCreateRenewalWithAmendmentAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().createRenewalWithAmendment(protocolForm);
              forward = mapping.findForward(forwardTo);
              // Switch over to the new protocol document and
              // go to the Protocol tab web page.
              loadDocument(protocolForm);
              protocolForm.getProtocolHelper().prepareView();
          }
          return forward;
      }
      
      /**
       * Create a Continuation without an Amendment.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward createContinuation(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isCreateContinuationAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().createContinuation(protocolForm);
              forward = mapping.findForward(forwardTo);
              // Switch over to the new protocol document and
              // go to the Protocol tab web page.
              loadDocument(protocolForm);
              protocolForm.getProtocolHelper().prepareView();
          }
          return forward;
      }
      
      /**
       * Create a Continuation with an Amendment.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward createContinuationWithAmendment(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isCreateContinuationWithAmendmentAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().createContinuationWithAmendment(protocolForm);
              forward = mapping.findForward(forwardTo);
              // Switch over to the new protocol document and
              // go to the Protocol tab web page.
              loadDocument(protocolForm);
              protocolForm.getProtocolHelper().prepareView();
          }
          return forward;
      }
      
      /**
       * Delete a ProtocolBase/Amendment/Renewal. Remember that amendments and renewals are simply protocol documents that were copied
       * from a protocol.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward deleteProtocol(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
  
          ProtocolFormBase protocolForm = (ProtocolFormBase) form;
          IacucProtocolTask task = new IacucProtocolTask(TaskName.PROTOCOL_AMEND_RENEW_DELETE, (IacucProtocol) protocolForm.getProtocolDocument().getProtocol());
          if (isAuthorized(task)) {
              return confirm(buildDeleteProtocolConfirmationQuestion(mapping, form, request, response), 
                             CONFIRM_DELETE_PROTOCOL_KEY,
                             "");
          }
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
  
      /**
       * If the user confirms the deletion, then delete the protocol.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward confirmDeleteProtocol(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          Object question = request.getParameter(KRADConstants.QUESTION_INST_ATTRIBUTE_NAME);
          if (CONFIRM_DELETE_PROTOCOL_KEY.equals(question)) {
              ProtocolFormBase protocolForm = (ProtocolFormBase) form;
              IacucProtocol protocol = (IacucProtocol)protocolForm.getProtocolDocument().getProtocol();
              getProtocolDeleteService().delete(protocol, protocolForm.getActionHelper().getProtocolDeleteBean());
              
              // send out notification that protocol has been deleted and record success
              IacucProtocolNotificationRequestBean newNotificationBean = new IacucProtocolNotificationRequestBean(protocol, IacucProtocolActionType.IACUC_DELETED, "Deleted");
              ProtocolCorrespondence newProtocolCorrespondence = getProtocolCorrespondence(protocolForm, IacucConstants.PROTOCOL_ACTIONS_TAB, newNotificationBean, false);
              protocolForm.getActionHelper().setProtocolCorrespondence(newProtocolCorrespondence);
              recordProtocolActionSuccess("Delete ProtocolBase, Amendment, or Renewal");
              
              if (newProtocolCorrespondence != null) {
                  return mapping.findForward(CORRESPONDENCE);
              } else {
                  return checkToSendNotification(mapping, IacucConstants.PROTOCOL_TAB, (IacucProtocolForm)protocolForm, newNotificationBean);
              }
          }
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
  
      /**
       * Build the question to ask the user. Ask if they really want to delete the protocol.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      private StrutsConfirmation buildDeleteProtocolConfirmationQuestion(ActionMapping mapping, ActionForm form,
              HttpServletRequest request, HttpServletResponse response) throws Exception {
          ProtocolDocumentBase doc = ((ProtocolFormBase) form).getProtocolDocument();
          String protocolNumber = doc.getProtocol().getProtocolNumber();
          return buildParameterizedConfirmationQuestion(mapping, form, request, response, CONFIRM_DELETE_PROTOCOL_KEY,
                  KeyConstants.QUESTION_DELETE_PROTOCOL_CONFIRMATION, protocolNumber);
      }
  
  
      /**
       * 
       * This method is to view protocol attachment at protocol actions/print
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward viewProtocolAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, 
              HttpServletResponse response) throws Exception {
          
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          IacucProtocol protocol = protocolForm.getIacucProtocolDocument().getIacucProtocol();
          int selected = getSelectedLine(request);
          IacucProtocolAttachmentProtocol attachment = (IacucProtocolAttachmentProtocol)protocol.getActiveAttachmentProtocolsNoDelete().get(selected);
          return printAttachmentProtocol(mapping, response, attachment,protocolForm);
      }
      
      /**
       * 
       * This method is for 'view' personnel attachment. lost when merging from 3.0 to trunk
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward viewProtocolPersonnelAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, 
              HttpServletResponse response) throws Exception {
          
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          int selected = getSelectedLine(request);
          IacucProtocolAttachmentPersonnel personAttach = (IacucProtocolAttachmentPersonnel)protocolForm.getProtocolDocument().getProtocol().getAttachmentPersonnels().get(selected);
          return printPersonnelAttachmentProtocol(mapping, response, personAttach,protocolForm);
  
      }
  
      public ActionForward printProtocolQuestionnaires(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          IacucProtocol protocol = protocolForm.getIacucProtocolDocument().getIacucProtocol();
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          String fileName = "Protocol_questionnaire_Report.pdf";
          String reportName = protocol.getProtocolNumber() + "-" + "ProtocolQuestionnaires";
          AttachmentDataSource dataStream = getProtocolPrintingService().print(reportName, getIacucQuestionnairePrintingService().getQuestionnairePrintable(protocol, protocolForm.getActionHelper().getQuestionnairesToPrints()));
          if (dataStream.getData() != null) {
              dataStream.setName(fileName.toString());
              PrintingUtils.streamToResponse(dataStream, response);
              forward = null;
          }
          return forward;
      }
      
      public ActionForward printProtocolCorrespondences(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          IacucProtocol protocol = protocolForm.getIacucProtocolDocument().getIacucProtocol();
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          String fileName = "IACUC_Protocol_Correspondence_Report.pdf";
          String reportName = protocol.getProtocolNumber() + "-" + "ProtocolCorrespondences";
          AttachmentDataSource dataStream = getProtocolPrintingService().print(reportName, getIacucCorrespondencePrintingService().getCorrespondencePrintable(protocol, protocolForm.getActionHelper().getCorrespondencesToPrint()));
          if (dataStream.getData() != null) {
              dataStream.setName(fileName.toString());
              PrintingUtils.streamToResponse(dataStream, response);
              forward = null;
          }
          return forward;
      }
      
      private IacucCorrespondencePrintingService getIacucCorrespondencePrintingService() {
          return KcServiceLocator.getService(IacucCorrespondencePrintingService.class);
      }
  
      protected IacucQuestionnairePrintingService getIacucQuestionnairePrintingService() {
          return KcServiceLocator.getService(IacucQuestionnairePrintingService.class);
      }
      
      /*
       * This is to view attachment if attachment is selected in print panel.
       */
      private ActionForward printAttachmentProtocol(ActionMapping mapping, HttpServletResponse response, IacucProtocolAttachmentProtocol attachment,ProtocolFormBase form) throws Exception {
          if (attachment == null) {
              return mapping.findForward(Constants.MAPPING_BASIC);
          }
          final AttachmentFile file = attachment.getFile();
          byte[] attachmentFile =null;
          String attachmentFileType=file.getType().replace("\"", "");
          attachmentFileType=attachmentFileType.replace("\\", "");           
          if(attachmentFileType.equalsIgnoreCase(WatermarkConstants.ATTACHMENT_TYPE_PDF)){
              attachmentFile=getProtocolAttachmentFile(form,attachment);
              if(attachmentFile!=null) {          
                  this.streamToResponse(attachmentFile, getValidHeaderString(file.getName()), getValidHeaderString(file.getType()), response);    
              } else {
                  this.streamToResponse(file.getData(), getValidHeaderString(file.getName()), getValidHeaderString(file.getType()), response);    
              }
              return RESPONSE_ALREADY_HANDLED;
          }
          this.streamToResponse(file.getData(), getValidHeaderString(file.getName()), getValidHeaderString(file.getType()), response);
          return RESPONSE_ALREADY_HANDLED;
      }
  
      /*
       * This is to view Personnel attachment if attachment is selected in print &amp; summary panel.
       */
      private ActionForward printPersonnelAttachmentProtocol(ActionMapping mapping, HttpServletResponse response, ProtocolAttachmentBase attachment,IacucProtocolForm form) throws Exception {
  
          if (attachment == null) {
              return mapping.findForward(Constants.MAPPING_BASIC);
          }
          final AttachmentFile file = attachment.getFile();
          this.streamToResponse(file.getData(), getValidHeaderString(file.getName()), getValidHeaderString(file.getType()), response);
          return RESPONSE_ALREADY_HANDLED;
      }
      
      /**
       * 
       * This method for applying the selected watermark to the attachment 
       * @param protocolForm form
       * @param protocolAttachmentBase attachment
       * @return attachment file
       */
      private byte[] getProtocolAttachmentFile(ProtocolFormBase form,ProtocolAttachmentProtocolBase attachment) {
          
          byte[] attachmentFile =null;
          final AttachmentFile file = attachment.getFile();
          Printable printableArtifacts= getProtocolPrintingService().getProtocolPrintArtifacts(form.getProtocolDocument().getProtocol());
          ProtocolBase protocolCurrent = form.getProtocolDocument().getProtocol();
          int currentProtoSeqNumber= protocolCurrent.getSequenceNumber();
          try {
              if(printableArtifacts.isWatermarkEnabled()){
                  int currentAttachmentSequence=attachment.getSequenceNumber();
                  String docStatusCode=attachment.getDocumentStatusCode();
                  String statusCode=attachment.getStatusCode();
                  // TODO perhaps the check for equality of protocol and attachment sequence numbers, below, is now redundant
                  if(((getProtocolAttachmentService().isAttachmentActive(attachment))&&(currentProtoSeqNumber == currentAttachmentSequence))||(docStatusCode.equals("1"))){
                      if (ProtocolAttachmentProtocolBase.COMPLETE_STATUS_CODE.equals(statusCode)) {
                          attachmentFile = getWatermarkService().applyWatermark(file.getData(),printableArtifacts.getWatermarkable().getWatermark());
                      }
                  }else{
                      attachmentFile = getWatermarkService().applyWatermark(file.getData(),printableArtifacts.getWatermarkable().getInvalidWatermark());
                      LOG.info(INVALID_ATTACHMENT + attachment.getDocumentId());
                  }
              }
          }catch (Exception e) {
              LOG.error("Exception Occured in ProtocolNoteAndAttachmentAction. : ",e);    
          }        
          return attachmentFile;
      }
      
      
      
      /**
       * Filters the actions shown in the History sub-panel, first validating the dates before filtering and refreshing the page.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward filterHistory(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          Date startDate = protocolForm.getActionHelper().getFilteredHistoryStartDate();
          Date endDate = protocolForm.getActionHelper().getFilteredHistoryEndDate();
          
          if (applyRules(new ProtocolHistoryFilterDatesEvent(protocolForm.getProtocolDocument(), startDate, endDate))) {
              protocolForm.getActionHelper().initFilterDatesView();
          }
          
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
      
      /**
       * Shows all of the actions in the History sub-panel.
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       */
      public ActionForward resetHistory(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
          ProtocolFormBase protocolForm = (ProtocolFormBase) form;
          protocolForm.getActionHelper().setFilteredHistoryStartDate(null);
          protocolForm.getActionHelper().setFilteredHistoryEndDate(null);
          protocolForm.getActionHelper().initFilterDatesView();
          
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
  
      /**
       * Load a ProtocolBase summary into the summary sub-panel. The protocol summary to load corresponds to the currently selected
       * protocol action in the History sub-panel.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward loadProtocolSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ProtocolFormBase protocolForm = (ProtocolFormBase) form;
          org.kuali.kra.iacuc.actions.IacucProtocolAction action = (org.kuali.kra.iacuc.actions.IacucProtocolAction)protocolForm.getActionHelper().getSelectedProtocolAction();
          if (action != null) {
              protocolForm.getActionHelper().setCurrentSequenceNumber(action.getSequenceNumber());
          }
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
      
      public ActionForward viewAttachmentProtocol(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          return this.viewAttachment(mapping, (ProtocolFormBase) form, request, response);
      }
      
      private ActionForward viewAttachment(ActionMapping mapping, ProtocolFormBase form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          
          final int selection = this.getSelectedLine(request);
          
          ProtocolSummary protocolSummary = form.getActionHelper().getProtocolSummary();
          
          int selectedIndex = getSelectedLine(request);
          AttachmentSummary attachmentSummary = protocolSummary.getAttachments().get(selectedIndex);
          
          if (attachmentSummary.getAttachmentType().startsWith(Constants.PROTOCOL_ATTACHMENT_PREFIX)) {
              IacucProtocolAttachmentProtocol attachment = getProtocolAttachmentService().getAttachment(IacucProtocolAttachmentProtocol.class, attachmentSummary.getAttachmentId());
              return printAttachmentProtocol(mapping, response, attachment, form);
          } 
          else {
              IacucProtocolAttachmentPersonnel personnelAttachment = getProtocolAttachmentService().getAttachment(IacucProtocolAttachmentPersonnel.class, attachmentSummary.getAttachmentId());
              return printPersonnelAttachmentProtocol(mapping, response, personnelAttachment, (IacucProtocolForm)form);
          }
  
      }  
         
  
      /**
       * Go to the previous summary.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward viewPreviousProtocolSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
  
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          IacucActionHelper actionHelper = (IacucActionHelper) protocolForm.getActionHelper();
          actionHelper.setCurrentSequenceNumber(actionHelper.getCurrentSequenceNumber() - 1);
          ((ProtocolFormBase) form).getActionHelper().initSummaryDetails();
  
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
  
      /**
       * Go to the next summary.
       * 
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward viewNextProtocolSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
  
          ProtocolFormBase protocolForm = (ProtocolFormBase) form;
          IacucActionHelper actionHelper = (IacucActionHelper) protocolForm.getActionHelper();
          actionHelper.setCurrentSequenceNumber(actionHelper.getCurrentSequenceNumber() + 1);
          ((ProtocolFormBase) form).getActionHelper().initSummaryDetails();
          
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
  
      /**
       * 
       * This method to load previous submission for display
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward viewPreviousSubmission (ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
  
          ProtocolFormBase protocolForm = (ProtocolFormBase) form;
          IacucActionHelper actionHelper = (IacucActionHelper) protocolForm.getActionHelper();
          actionHelper.setCurrentSubmissionNumber(actionHelper.getPrevSubmissionNumber());
          actionHelper.setAmendmentDetails();
          protocolForm.getActionHelper().initSubmissionDetails();
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
      
      /**
       * 
       * This method is to load next submission for display
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward viewNextSubmission(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
  
          ProtocolFormBase protocolForm = (ProtocolFormBase) form;
          IacucActionHelper actionHelper = (IacucActionHelper) protocolForm.getActionHelper();
          actionHelper.setCurrentSubmissionNumber(actionHelper.getNextSubmissionNumber());
          actionHelper.setAmendmentDetails();
          protocolForm.getActionHelper().initSubmissionDetails();
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
  
      /**
       * 
       * This method is to render protocol action page when 'view' is clicked in meeting page, ProtocolBase submitted panel.
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
              throws Exception {
          Map<String, String> fieldValues = new HashMap<String, String>();
          fieldValues.put(SUBMISSION_ID, request.getParameter(SUBMISSION_ID));
          IacucProtocolSubmission protocolSubmission = (IacucProtocolSubmission) getBusinessObjectService().findByPrimaryKey(IacucProtocolSubmission.class, fieldValues);
          protocolSubmission.getProtocol().setProtocolSubmission(protocolSubmission);
          
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          protocolForm.setDocId(protocolSubmission.getProtocol().getProtocolDocument().getDocumentNumber());
          loadDocument(protocolForm);
          protocolForm.initialize();
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
      
      
  
      public ActionForward assignToAgenda(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isAssignToAgendaAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().assignToAgenda(protocolForm);
              forward = mapping.findForward(forwardTo);
          }
          return forward;
      }
      
      public ActionForward removeFromAgenda(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isRemoveFromAgendaAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().removeFromAgenda(protocolForm);
              forward = mapping.findForward(forwardTo);
          }
          return forward;
      }
  
      
      
      public ActionForward protocolReviewNotRequired(ActionMapping mapping, ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isProtocolReviewNotRequiredAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().protocolReviewNotRequired(protocolForm);
              forward = mapping.findForward(forwardTo);
          }
          return forward;
      }
      
      /**
       * Perform Full Approve Action - maps to IACUCReview RouteNode.
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      @SuppressWarnings("deprecation")
      public ActionForward grantFullApproval(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 
          throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isFullApprovalAuthorized(protocolForm)) {
              forward = super.approve(mapping, protocolForm, request, response);
              getProtocolActionRequestService().grantFullApproval(protocolForm);
              if (protocolForm.getActionHelper().getProtocolCorrespondence() != null) {
                  return mapping.findForward(CORRESPONDENCE);
              }else {
                  forward = routeProtocolToHoldingPage(mapping, protocolForm);                                    
              }
          }
          return forward;
      }
      
      /**
       * Perform Response Approve Action.
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward grantAdminApproval(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 
          throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isGrantAdminApprovalAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().grantAdminApproval(protocolForm);
              forward = mapping.findForward(forwardTo);
          }
          return forward;
      }
  
      /**
       * Requests an action to be performed by an administrator.  The user can request the following actions:
       * 
       *   Close
       *   Close Enrollment
       *   Data Analysis Only
       *   Deactivate
       *   Reopen Enrollment
       *   Suspension
       *   Termination
       *   Lift Hold
       * 
       * Uses the enumeration <code>IacucProtocolRequestAction</code> to encapsulate the unique properties on each action.
       * @param mapping The mapping associated with this action.
       * @param form The ProtocolBase form.
       * @param request The HTTP request
       * @param response The HTTP response
       * @return the forward to the current page
       * @throws Exception
       */
      public ActionForward requestAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 
          throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          String taskName = getTaskName(request);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isRequestActionAuthorized(protocolForm, taskName)) {
              String forwardTo = getProtocolActionRequestService().performRequestAction(protocolForm, taskName);
              forward = mapping.findForward(forwardTo);
          }
          return forward;
      }
      
      /**
       * Withdraws a previously submitted request action.
       * 
       * @param mapping The mapping associated with this action.
       * @param form The Protocol form.
       * @param request The HTTP request
       * @param response The HTTP response
       * @return the forward to the current page
       * @throws Exception
       */
      public ActionForward withdrawRequestAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 
              throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isWithdrawRequestActionAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().withdrawRequestAction(protocolForm);
              forward = mapping.findForward(forwardTo);
          }
          return forward;
      }
      
  
      public ActionForward addRequestAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 
              throws Exception {
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          IacucProtocolDocument document = protocolForm.getIacucProtocolDocument();
          IacucProtocol protocol = document.getIacucProtocol();
          String taskName = getTaskName(request);
          
          if (StringUtils.isNotBlank(taskName) && isAuthorized(new IacucProtocolTask(taskName, protocol))) {
              IacucProtocolRequestBean requestBean = getProtocolRequestBean(form, request);
              if (requestBean.getNewActionAttachment().getFile() != null && requestBean.getNewActionAttachment().getFile().getFileData().length > 0) {
                  requestBean.getNewActionAttachment().setFileName(requestBean.getNewActionAttachment().getFile().getFileName());
                  requestBean.getActionAttachments().add(requestBean.getNewActionAttachment());
                  requestBean.setNewActionAttachment(new ProtocolActionAttachment());
              } else {
                  GlobalVariables.getMessageMap().putError("actionHelper.iacucProtocolSuspendRequestBean.newActionAttachment.file", 
                          KeyConstants.AWARD_ATTACHMENT_FILE_REQUIRED);
              }
          }
          
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
      
      public ActionForward viewRequestAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 
              throws Exception {
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          IacucProtocolDocument document = protocolForm.getIacucProtocolDocument();
          IacucProtocol protocol = document.getIacucProtocol();
          String taskName = getTaskName(request);
          if (StringUtils.isNotBlank(taskName) && isAuthorized(new IacucProtocolTask(taskName, protocol))) {
              IacucProtocolRequestBean requestBean = getProtocolRequestBean(form, request);
              int lineNumber = getSelectedLine(request);
              ProtocolActionAttachment actionAttachment = requestBean.getActionAttachments().get(lineNumber);
              if (actionAttachment.getFile() != null) {
                  this.streamToResponse(actionAttachment.getFile().getFileData(), actionAttachment.getFileName(), actionAttachment.getFile().getContentType(), response);
                  return RESPONSE_ALREADY_HANDLED;
              }
          }
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
      
      public ActionForward deleteRequestAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 
              throws Exception {
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          IacucProtocolDocument document = protocolForm.getIacucProtocolDocument();
          IacucProtocol protocol = document.getIacucProtocol();
          String taskName = getTaskName(request);
          if (StringUtils.isNotBlank(taskName) && isAuthorized(new IacucProtocolTask(taskName, protocol))) {
              IacucProtocolRequestAction requestAction = IacucProtocolRequestAction.valueOfTaskName(taskName);
              IacucProtocolRequestBean requestBean = getProtocolRequestBean(form, request);
              int lineNumber = getSelectedLine(request);
              requestBean.getActionAttachments().remove(lineNumber);
          }
          return mapping.findForward(Constants.MAPPING_BASIC);
      }
      
      private IacucProtocolRequestBean getProtocolRequestBean(ActionForm form, HttpServletRequest request) {
          IacucProtocolRequestBean protocolRequestBean = null;
          
          IacucProtocolActionBean protocolActionBean = getActionBean(form, request);
          if (protocolActionBean != null && protocolActionBean instanceof IacucProtocolRequestBean) {
              protocolRequestBean = (IacucProtocolRequestBean) protocolActionBean;
          }
          
          return protocolRequestBean;
      }
  
      /**
       * Disapproves this ProtocolBase.
       * @param mapping
       * @param form
       * @param request
       * @param response
       * @return
       * @throws Exception
       */
      public ActionForward disapproveProtocol(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
          IacucProtocolForm protocolForm = (IacucProtocolForm) form;
          if(getProtocolActionRequestService().isDisapproveProtocolAuthorized(protocolForm)) {
              String forwardTo = getProtocolActionRequestService().disapproveProtocol(protocolForm);
              forward = mapping.findForward(forwardTo);
          }
          return forward;
      }
      
      
      public ActionForward expire(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
          ActionForward forward = mapping.findForward(Constants.MAPPING_BASIC);
  