|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
     | 
  |  17 |     | 
   package org.kuali.rice.kew.superuser.web;  | 
  |  18 |     | 
     | 
  |  19 |     | 
   import java.util.ArrayList;  | 
  |  20 |     | 
   import java.util.Arrays;  | 
  |  21 |     | 
   import java.util.HashSet;  | 
  |  22 |     | 
   import java.util.List;  | 
  |  23 |     | 
   import java.util.Set;  | 
  |  24 |     | 
     | 
  |  25 |     | 
   import javax.servlet.http.HttpServletRequest;  | 
  |  26 |     | 
     | 
  |  27 |     | 
   import org.apache.commons.lang.ArrayUtils;  | 
  |  28 |     | 
   import org.apache.struts.action.ActionMapping;  | 
  |  29 |     | 
   import org.kuali.rice.kew.doctype.bo.DocumentType;  | 
  |  30 |     | 
   import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;  | 
  |  31 |     | 
   import org.kuali.rice.kew.service.WorkflowInfo;  | 
  |  32 |     | 
   import org.kuali.rice.kew.web.KewRoutingKualiForm;  | 
  |  33 |     | 
   import org.kuali.rice.kew.web.KeyValue;  | 
  |  34 |     | 
     | 
  |  35 |     | 
     | 
  |  36 |     | 
     | 
  |  37 |     | 
     | 
  |  38 |     | 
     | 
  |  39 |     | 
     | 
  |  40 |     | 
     | 
  |  41 |    0 |    public class SuperUserForm extends KewRoutingKualiForm { | 
  |  42 |     | 
     | 
  |  43 |     | 
       private static final long serialVersionUID = 982228198266403397L;  | 
  |  44 |     | 
       private Long routeHeaderId;  | 
  |  45 |     | 
       private String docHandlerUrl;  | 
  |  46 |     | 
       private Integer routeLevel;  | 
  |  47 |    0 |        private List<String> futureNodeNames = new ArrayList<String>();  | 
  |  48 |     | 
       private String destNodeName;  | 
  |  49 |     | 
       private String returnDestNodeName;  | 
  |  50 |     | 
       private String action;  | 
  |  51 |    0 |        private List actionRequests = new ArrayList();  | 
  |  52 |     | 
       private String actionTakenActionRequestId;  | 
  |  53 |     | 
       private String actionTakenNetworkId;  | 
  |  54 |     | 
       private String actionTakenWorkGroupId;  | 
  |  55 |     | 
       private String actionTakenRecipientCode;  | 
  |  56 |     | 
       private boolean authorized;  | 
  |  57 |     | 
       private boolean blanketApprove;  | 
  |  58 |    0 |        private String methodToCall = "";  | 
  |  59 |    0 |        private boolean runPostProcessorLogic = true;  | 
  |  60 |     | 
       private String[] actionRequestRunPostProcessorCheck;  | 
  |  61 |     | 
     | 
  |  62 |     | 
       private String lookupableImplServiceName;  | 
  |  63 |     | 
       private String lookupType;  | 
  |  64 |     | 
     | 
  |  65 |     | 
       private DocumentRouteHeaderValue routeHeader;  | 
  |  66 |     | 
     | 
  |  67 |     | 
         | 
  |  68 |     | 
       private String returnLocation;  | 
  |  69 |     | 
         | 
  |  70 |     | 
       public String getMethodToCall() { | 
  |  71 |    0 |            return methodToCall;  | 
  |  72 |     | 
       }  | 
  |  73 |     | 
       public void setMethodToCall(String methodToCall) { | 
  |  74 |    0 |            this.methodToCall = methodToCall;  | 
  |  75 |    0 |        }  | 
  |  76 |     | 
     | 
  |  77 |     | 
       public boolean isBlanketApprove() { | 
  |  78 |    0 |            return blanketApprove;  | 
  |  79 |     | 
       }  | 
  |  80 |     | 
     | 
  |  81 |     | 
       public void setBlanketApprove(boolean blanketApprove) { | 
  |  82 |    0 |            this.blanketApprove = blanketApprove;  | 
  |  83 |    0 |        }  | 
  |  84 |     | 
     | 
  |  85 |     | 
       public DocumentRouteHeaderValue getRouteHeader() { | 
  |  86 |    0 |            return routeHeader;  | 
  |  87 |     | 
       }  | 
  |  88 |     | 
     | 
  |  89 |     | 
       public void setRouteHeader(DocumentRouteHeaderValue routeHeader) { | 
  |  90 |    0 |            this.routeHeader = routeHeader;  | 
  |  91 |    0 |        }  | 
  |  92 |     | 
     | 
  |  93 |     | 
       public Long getRouteHeaderId() { | 
  |  94 |    0 |            return routeHeaderId;  | 
  |  95 |     | 
       }  | 
  |  96 |     | 
     | 
  |  97 |     | 
       public void setRouteHeaderId(Long routeHeaderId) { | 
  |  98 |    0 |            this.routeHeaderId = routeHeaderId;  | 
  |  99 |    0 |        }  | 
  |  100 |     | 
     | 
  |  101 |     | 
       public String getDocHandlerUrl() { | 
  |  102 |    0 |            return docHandlerUrl;  | 
  |  103 |     | 
       }  | 
  |  104 |     | 
     | 
  |  105 |     | 
       public void setDocHandlerUrl(String docHandlerUrl) { | 
  |  106 |    0 |            this.docHandlerUrl = docHandlerUrl;  | 
  |  107 |    0 |        }  | 
  |  108 |     | 
     | 
  |  109 |     | 
       public String getRouteHeaderIdString() { | 
  |  110 |    0 |            return routeHeaderId.toString();  | 
  |  111 |     | 
       }  | 
  |  112 |     | 
     | 
  |  113 |     | 
       public Integer getRouteLevel() { | 
  |  114 |    0 |            return routeLevel;  | 
  |  115 |     | 
       }  | 
  |  116 |     | 
     | 
  |  117 |     | 
       public void setRouteLevel(Integer routeLevel) { | 
  |  118 |    0 |            this.routeLevel = routeLevel;  | 
  |  119 |    0 |        }  | 
  |  120 |     | 
     | 
  |  121 |     | 
       public String getAction() { | 
  |  122 |    0 |            return action;  | 
  |  123 |     | 
       }  | 
  |  124 |     | 
     | 
  |  125 |     | 
       public void setAction(String action) { | 
  |  126 |    0 |            this.action = action;  | 
  |  127 |    0 |        }  | 
  |  128 |     | 
     | 
  |  129 |     | 
       public List getActionRequests() { | 
  |  130 |    0 |            return actionRequests;  | 
  |  131 |     | 
       }  | 
  |  132 |     | 
     | 
  |  133 |     | 
       public void setActionRequests(List actionRequests) { | 
  |  134 |    0 |            this.actionRequests = actionRequests;  | 
  |  135 |    0 |        }  | 
  |  136 |     | 
     | 
  |  137 |     | 
       public String getActionTakenActionRequestId() { | 
  |  138 |    0 |            return actionTakenActionRequestId;  | 
  |  139 |     | 
       }  | 
  |  140 |     | 
     | 
  |  141 |     | 
       public void setActionTakenActionRequestId(String actionTakenActionRequestId) { | 
  |  142 |    0 |            this.actionTakenActionRequestId = actionTakenActionRequestId;  | 
  |  143 |    0 |        }  | 
  |  144 |     | 
     | 
  |  145 |     | 
       public String getActionTakenNetworkId() { | 
  |  146 |    0 |            return actionTakenNetworkId;  | 
  |  147 |     | 
       }  | 
  |  148 |     | 
     | 
  |  149 |     | 
       public void setActionTakenNetworkId(String actionTakenNetworkId) { | 
  |  150 |    0 |            this.actionTakenNetworkId = actionTakenNetworkId;  | 
  |  151 |    0 |        }  | 
  |  152 |     | 
     | 
  |  153 |     | 
       public String getActionTakenWorkGroupId() { | 
  |  154 |    0 |            return actionTakenWorkGroupId;  | 
  |  155 |     | 
       }  | 
  |  156 |     | 
     | 
  |  157 |     | 
       public void setActionTakenWorkGroupId(String actionTakenWorkGroupId) { | 
  |  158 |    0 |            this.actionTakenWorkGroupId = actionTakenWorkGroupId;  | 
  |  159 |    0 |        }  | 
  |  160 |     | 
     | 
  |  161 |     | 
         | 
  |  162 |     | 
     | 
  |  163 |     | 
     | 
  |  164 |     | 
     | 
  |  165 |     | 
     | 
  |  166 |     | 
     | 
  |  167 |     | 
     | 
  |  168 |     | 
     | 
  |  169 |     | 
       public boolean isAuthorized() { | 
  |  170 |    0 |            return authorized;  | 
  |  171 |     | 
       }  | 
  |  172 |     | 
     | 
  |  173 |     | 
       public void setAuthorized(boolean authorized) { | 
  |  174 |    0 |            this.authorized = authorized;  | 
  |  175 |    0 |        }  | 
  |  176 |     | 
     | 
  |  177 |     | 
       public void reset(ActionMapping mapping, HttpServletRequest request){ | 
  |  178 |    0 |            this.futureNodeNames = new ArrayList<String>();  | 
  |  179 |    0 |        }  | 
  |  180 |     | 
     | 
  |  181 |     | 
       public String getActionTakenRecipientCode() { | 
  |  182 |    0 |            return actionTakenRecipientCode;  | 
  |  183 |     | 
       }  | 
  |  184 |     | 
     | 
  |  185 |     | 
       public void setActionTakenRecipientCode(String actionTakenRecipientCode) { | 
  |  186 |    0 |            this.actionTakenRecipientCode = actionTakenRecipientCode;  | 
  |  187 |    0 |        }  | 
  |  188 |     | 
     | 
  |  189 |     | 
       public boolean isSUDocument() { | 
  |  190 |    0 |            if (routeHeader.isStateInitiated() || routeHeader.isStateSaved()) { | 
  |  191 |    0 |                return false;  | 
  |  192 |     | 
           }  | 
  |  193 |    0 |            return true;  | 
  |  194 |     | 
       }  | 
  |  195 |     | 
     | 
  |  196 |     | 
       public boolean isStateAllowsAction() { | 
  |  197 |    0 |            if ( routeHeader.isApproved() || routeHeader.isProcessed() || routeHeader.isDisaproved() ) { | 
  |  198 |    0 |                return false;  | 
  |  199 |     | 
           }  | 
  |  200 |    0 |            return true;  | 
  |  201 |     | 
       }  | 
  |  202 |     | 
     | 
  |  203 |     | 
       public DocumentType getDocumentType() { | 
  |  204 |    0 |            return getRouteHeader().getDocumentType();  | 
  |  205 |     | 
       }  | 
  |  206 |     | 
     | 
  |  207 |     | 
       public Set getPreviousNodes() throws Exception { | 
  |  208 |    0 |                String[] nodeNames = new WorkflowInfo().getPreviousRouteNodeNames(routeHeader.getRouteHeaderId());  | 
  |  209 |    0 |            Set previousNodes = new HashSet();  | 
  |  210 |    0 |            for (int i = 0; i < nodeNames.length; i++) { | 
  |  211 |    0 |                            String nodeName = nodeNames[i];  | 
  |  212 |    0 |                            previousNodes.add(new KeyValue(nodeName, nodeName));  | 
  |  213 |     | 
                   }  | 
  |  214 |    0 |            return previousNodes;  | 
  |  215 |     | 
       }  | 
  |  216 |     | 
     | 
  |  217 |     | 
       public String getDestNodeName() { | 
  |  218 |    0 |            return destNodeName;  | 
  |  219 |     | 
       }  | 
  |  220 |     | 
       public void setDestNodeName(String previousNodeName) { | 
  |  221 |    0 |            this.destNodeName = previousNodeName;  | 
  |  222 |    0 |        }  | 
  |  223 |     | 
       public List<String> getFutureNodeNames() { | 
  |  224 |    0 |            return futureNodeNames;  | 
  |  225 |     | 
       }  | 
  |  226 |     | 
       public void setFutureNodeNames(List<String> futureNodeNames) { | 
  |  227 |    0 |            this.futureNodeNames = futureNodeNames;  | 
  |  228 |    0 |        }  | 
  |  229 |     | 
       public String getReturnDestNodeName() { | 
  |  230 |    0 |            return returnDestNodeName;  | 
  |  231 |     | 
       }  | 
  |  232 |     | 
       public void setReturnDestNodeName(String returnDestNodeName) { | 
  |  233 |    0 |            this.returnDestNodeName = returnDestNodeName;  | 
  |  234 |    0 |        }  | 
  |  235 |     | 
       public String getLookupableImplServiceName() { | 
  |  236 |    0 |            return lookupableImplServiceName;  | 
  |  237 |     | 
       }  | 
  |  238 |     | 
       public void setLookupableImplServiceName(String lookupableImplServiceName) { | 
  |  239 |    0 |            this.lookupableImplServiceName = lookupableImplServiceName;  | 
  |  240 |    0 |        }  | 
  |  241 |     | 
       public String getLookupType() { | 
  |  242 |    0 |            return lookupType;  | 
  |  243 |     | 
       }  | 
  |  244 |     | 
       public void setLookupType(String lookupType) { | 
  |  245 |    0 |            this.lookupType = lookupType;  | 
  |  246 |    0 |        }  | 
  |  247 |     | 
       public boolean isRunPostProcessorLogic() { | 
  |  248 |    0 |            return this.runPostProcessorLogic;  | 
  |  249 |     | 
       }  | 
  |  250 |     | 
       public void setRunPostProcessorLogic(boolean runPostProcessorLogic) { | 
  |  251 |    0 |            this.runPostProcessorLogic = runPostProcessorLogic;  | 
  |  252 |    0 |        }  | 
  |  253 |     | 
       public String[] getActionRequestRunPostProcessorCheck() { | 
  |  254 |    0 |            return this.actionRequestRunPostProcessorCheck;  | 
  |  255 |     | 
       }  | 
  |  256 |     | 
       public void setActionRequestRunPostProcessorCheck(String[] actionRequestRunPostProcessorCheck) { | 
  |  257 |    0 |            this.actionRequestRunPostProcessorCheck = actionRequestRunPostProcessorCheck;  | 
  |  258 |    0 |        }  | 
  |  259 |     | 
       public Boolean getActionRequestPostProcessorCheck(String actionRequestId) { | 
  |  260 |    0 |            return ArrayUtils.contains(getActionRequestRunPostProcessorCheck(), actionRequestId);  | 
  |  261 |     | 
       }  | 
  |  262 |     | 
       public List<String> getActionRequestPostProcessorCheck() { | 
  |  263 |    0 |            if (getActionRequestRunPostProcessorCheck() == null) { | 
  |  264 |    0 |                return null;  | 
  |  265 |     | 
           }  | 
  |  266 |    0 |            return Arrays.asList(getActionRequestRunPostProcessorCheck());  | 
  |  267 |     | 
       }  | 
  |  268 |     | 
     | 
  |  269 |     | 
       public String getReturnLocation() { | 
  |  270 |    0 |                return returnLocation;  | 
  |  271 |     | 
       }  | 
  |  272 |     | 
       public void setReturnLocation(String returnLocation) { | 
  |  273 |    0 |                this.returnLocation = returnLocation;  | 
  |  274 |    0 |        }  | 
  |  275 |     | 
       public boolean getActionRequestPostProcessorDisplayCheck(){ | 
  |  276 |    0 |                return getDocumentType().getSuPostprocessorOverridePolicy().getPolicyValue().booleanValue();  | 
  |  277 |     | 
       }  | 
  |  278 |     | 
   }  |