Coverage Report - org.kuali.rice.kew.actionlist.web.ActionListForm
 
Classes in this File Line Coverage Branch Coverage Complexity
ActionListForm
0%
0/129
0%
0/8
1.06
 
 1  
 /*
 2  
  * Copyright 2006-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package org.kuali.rice.kew.actionlist.web;
 18  
 
 19  
 import org.kuali.rice.core.api.config.property.ConfigContext;
 20  
 import org.kuali.rice.core.framework.services.CoreFrameworkServiceLocator;
 21  
 import org.kuali.rice.kew.actionlist.ActionToTake;
 22  
 import org.kuali.rice.kew.util.KEWConstants;
 23  
 import org.kuali.rice.kew.util.WebFriendlyRecipient;
 24  
 import org.kuali.rice.kim.api.identity.principal.Principal;
 25  
 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
 26  
 import org.kuali.rice.kns.web.struts.form.KualiForm;
 27  
 import org.kuali.rice.kns.web.ui.ExtraButton;
 28  
 import org.kuali.rice.krad.util.GlobalVariables;
 29  
 import org.kuali.rice.krad.util.KRADConstants;
 30  
 import org.kuali.rice.krad.util.UrlFactory;
 31  
 
 32  
 import javax.servlet.http.HttpServletRequest;
 33  
 import java.util.ArrayList;
 34  
 import java.util.HashMap;
 35  
 import java.util.List;
 36  
 import java.util.Map;
 37  
 import java.util.Properties;
 38  
 
 39  
 
 40  
 /**
 41  
  * Struts form for action ActionListAction
 42  
  *
 43  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 44  
  */
 45  0
 public class ActionListForm extends KualiForm {
 46  
 
 47  
     private static final long serialVersionUID = -6246391732337228007L;
 48  
 
 49  
     private String delegator;
 50  0
     private String methodToCall = "";
 51  
     private String helpDeskActionListUserName;
 52  
     private String docType;
 53  
     private String filterLegend;
 54  
     private String actionListType;
 55  
     private Boolean customActionList;
 56  
     private String defaultActionToTake;
 57  0
     private List<ActionToTake> actionsToTake = new ArrayList<ActionToTake>();
 58  0
     private Map<?, ?> defaultActions = new HashMap<Object, Object>();
 59  
     private String delegationId;
 60  
     private List<?> delegators;
 61  
     private Boolean hasCustomActions;
 62  
     private Boolean routeLogPopup;
 63  
     private Boolean documentPopup;
 64  
     private List<WebFriendlyRecipient> primaryDelegates;
 65  
     private String primaryDelegateId;
 66  
 
 67  
     private Boolean hasDisplayParameters;
 68  
     
 69  
     // "sticky" parameters for paginated action list
 70  
     private Integer currentPage;
 71  
     private String currentSort;
 72  
     private String currentDir;
 73  
 
 74  
     // parameters for paginated action list
 75  
     private Integer page;
 76  
     private String sort;
 77  
     private String dir;
 78  
 
 79  
     private int count;
 80  0
     private String cssFile = "kuali.css";
 81  0
     private String logoAlign = "left";
 82  
     private String viewOutbox;
 83  
     private String[] outboxItems;
 84  
     private boolean outBoxEmpty;
 85  
     private Boolean showOutbox;
 86  0
     private List<ExtraButton> headerButtons = new ArrayList<ExtraButton>();
 87  
 
 88  
     public String getHelpDeskActionListUserName() {
 89  0
         return helpDeskActionListUserName;
 90  
     }
 91  
 
 92  
     public void setHelpDeskActionListUserName(String helpDeskActionListUserName) {
 93  0
         this.helpDeskActionListUserName = helpDeskActionListUserName;
 94  0
     }
 95  
 
 96  
     @Override
 97  
         public String getMethodToCall() {
 98  0
         return methodToCall;
 99  
     }
 100  
 
 101  
     @Override
 102  
         public void setMethodToCall(String methodToCall) {
 103  0
         this.methodToCall = methodToCall;
 104  0
     }
 105  
 
 106  
     public String getDelegator() {
 107  0
         return delegator;
 108  
     }
 109  
 
 110  
     public void setDelegator(String delegator) {
 111  0
         this.delegator = delegator;
 112  0
     }
 113  
 
 114  
         public String getDocType() {
 115  0
         return docType;
 116  
     }
 117  
 
 118  
     public void setDocType(String docType) {
 119  0
         this.docType = docType;
 120  0
     }
 121  
 
 122  
     public String getFilterLegend() {
 123  0
         return filterLegend;
 124  
     }
 125  
 
 126  
     public void setFilterLegend(String filterLegend) {
 127  0
         this.filterLegend = filterLegend;
 128  0
     }
 129  
 
 130  
     public String getActionListType() {
 131  0
         if (actionListType == null) {
 132  0
             setActionListType("all");
 133  
         }
 134  0
         return actionListType;
 135  
     }
 136  
 
 137  
     public void setActionListType(String actionListType) {
 138  0
         this.actionListType = actionListType;
 139  0
     }
 140  
 
 141  
     public Boolean getCustomActionList() {
 142  0
         return customActionList;
 143  
     }
 144  
 
 145  
     public void setCustomActionList(Boolean customActionList) {
 146  0
         this.customActionList = customActionList;
 147  0
     }
 148  
 
 149  
     public String getDefaultActionToTake() {
 150  0
         return defaultActionToTake;
 151  
     }
 152  
 
 153  
     public void setDefaultActionToTake(String defaultActionToTake) {
 154  0
         this.defaultActionToTake = defaultActionToTake;
 155  0
     }
 156  
 
 157  
     public List<ActionToTake> getActionsToTake() {
 158  0
         return actionsToTake;
 159  
     }
 160  
 
 161  
     public void setActionsToTake(List<ActionToTake> actionsToTake) {
 162  0
         this.actionsToTake = actionsToTake;
 163  0
     }
 164  
 
 165  
     public ActionToTake getActions(int index) {
 166  0
         while (getActionsToTake().size() <= index) {
 167  0
             getActionsToTake().add(new ActionToTake());
 168  
         }
 169  0
         return getActionsToTake().get(index);
 170  
     }
 171  
 
 172  
     public Map<?, ?> getDefaultActions() {
 173  0
         return defaultActions;
 174  
     }
 175  
 
 176  
     public void setDefaultActions(Map<?, ?> defaultActions) {
 177  0
         this.defaultActions = defaultActions;
 178  0
     }
 179  
 
 180  
     public String getDelegationId() {
 181  0
         return delegationId;
 182  
     }
 183  
 
 184  
     public void setDelegationId(String delegationId) {
 185  0
         this.delegationId = delegationId;
 186  0
     }
 187  
 
 188  
     public List<?> getDelegators() {
 189  0
         return delegators;
 190  
     }
 191  
 
 192  
     public void setDelegators(List<?> delegators) {
 193  0
         this.delegators = delegators;
 194  0
     }
 195  
 
 196  
     public Boolean getHasCustomActions() {
 197  0
         return hasCustomActions;
 198  
     }
 199  
 
 200  
     public void setHasCustomActions(Boolean hasCustomActions) {
 201  0
         this.hasCustomActions = hasCustomActions;
 202  0
     }
 203  
 
 204  
     public String getDir() {
 205  0
         return dir;
 206  
     }
 207  
 
 208  
     public void setDir(String dir) {
 209  0
         this.dir = dir;
 210  0
     }
 211  
 
 212  
     public Integer getPage() {
 213  0
         return page;
 214  
     }
 215  
 
 216  
     public void setPage(Integer page) {
 217  0
         this.page = page;
 218  0
     }
 219  
 
 220  
     public String getSort() {
 221  0
         return sort;
 222  
     }
 223  
 
 224  
     public void setSort(String sort) {
 225  0
         this.sort = sort;
 226  0
     }
 227  
 
 228  
     public Integer getCurrentPage() {
 229  0
         return currentPage;
 230  
     }
 231  
 
 232  
     public void setCurrentPage(Integer currentPage) {
 233  0
         this.currentPage = currentPage;
 234  0
     }
 235  
 
 236  
     public String getCurrentDir() {
 237  0
         return currentDir;
 238  
     }
 239  
 
 240  
     public void setCurrentDir(String currentDir) {
 241  0
         this.currentDir = currentDir;
 242  0
     }
 243  
 
 244  
     public String getCurrentSort() {
 245  0
         return currentSort;
 246  
     }
 247  
 
 248  
     public void setCurrentSort(String currentSort) {
 249  0
         this.currentSort = currentSort;
 250  0
     }
 251  
 
 252  
     public int getCount() {
 253  0
         return count;
 254  
     }
 255  
 
 256  
     public void setCount(int count) {
 257  0
         this.count = count;
 258  0
     }
 259  
 
 260  
     public String getCssFile() {
 261  0
         return cssFile;
 262  
     }
 263  
 
 264  
     public void setCssFile(String cssFile) {
 265  0
         this.cssFile = cssFile;
 266  0
     }
 267  
 
 268  
     public String getLogoAlign() {
 269  0
         return logoAlign;
 270  
     }
 271  
 
 272  
     public void setLogoAlign(String logoAlign) {
 273  0
         this.logoAlign = logoAlign;
 274  0
     }
 275  
 
 276  
     public String getViewOutbox() {
 277  0
         return this.viewOutbox;
 278  
     }
 279  
 
 280  
     public void setViewOutbox(String viewOutbox) {
 281  0
         this.viewOutbox = viewOutbox;
 282  0
     }
 283  
 
 284  
     public String[] getOutboxItems() {
 285  0
         return outboxItems;
 286  
     }
 287  
 
 288  
     public void setOutboxItems(String[] outboxItems) {
 289  0
         this.outboxItems = outboxItems;
 290  0
     }
 291  
 
 292  
     public boolean isOutBoxEmpty() {
 293  0
         return this.outBoxEmpty;
 294  
     }
 295  
 
 296  
     public void setOutBoxEmpty(boolean outBoxEmpty) {
 297  0
         this.outBoxEmpty = outBoxEmpty;
 298  0
     }
 299  
 
 300  
     public Boolean getShowOutbox() {
 301  0
         return this.showOutbox;
 302  
     }
 303  
 
 304  
     public void setShowOutbox(Boolean showOutbox) {
 305  0
         this.showOutbox = showOutbox;
 306  0
     }
 307  
 
 308  
         public List<ExtraButton> getHeaderButtons() {
 309  0
                 return this.headerButtons;
 310  
         }
 311  
 
 312  
         public void setHeaderButtons(List<ExtraButton> headerButtons) {
 313  0
                 this.headerButtons = headerButtons;
 314  0
         }
 315  
         
 316  
         public String getMenuBar(){
 317  0
                 String url = "";
 318  0
                 Properties parameters = new Properties();
 319  0
                 url = UrlFactory.parameterizeUrl(KRADConstants.MAINTENANCE_ACTION, parameters);
 320  0
                 String krBaseUrl = ConfigContext.getCurrentContextConfig().getKRBaseURL();
 321  0
                 url = "<a href=\"" + url + "\"><img src=\""+krBaseUrl+"/images/tinybutton-preferences.gif\" alt=\"create new\" width=\"70\" height=\"15\"/></a>";
 322  0
                 return url;
 323  
         }
 324  
 
 325  
         @Override
 326  
         public void populate(HttpServletRequest request) {
 327  0
         setHeaderButtons(getHeaderButtons());
 328  
 
 329  
         // take the UserSession from the HttpSession and add it to the request
 330  0
         request.setAttribute(KRADConstants.USER_SESSION_KEY, GlobalVariables.getUserSession());
 331  
 
 332  
         //refactor actionlist.jsp not to be dependent on this
 333  0
         request.setAttribute("preferences", GlobalVariables.getUserSession().retrieveObject(KEWConstants.PREFERENCES));
 334  
 
 335  0
         String principalId = GlobalVariables.getUserSession().getPrincipalId();
 336  0
         final Principal hdalPrinc = (Principal) GlobalVariables.getUserSession().retrieveObject(KEWConstants.HELP_DESK_ACTION_LIST_PRINCIPAL_ATTR_NAME);
 337  0
         if (hdalPrinc != null) {
 338  0
                 setHelpDeskActionListUserName(hdalPrinc.getPrincipalName());
 339  
         }
 340  0
         boolean isHelpDeskAuthorized = KimApiServiceLocator.getPermissionService().isAuthorized(principalId, KEWConstants.KEW_NAMESPACE,        KEWConstants.PermissionNames.VIEW_OTHER_ACTION_LIST, new HashMap<String, String>(), new HashMap<String, String>());
 341  0
         if (isHelpDeskAuthorized) {
 342  0
             request.setAttribute("helpDeskActionList", "true");
 343  
         }
 344  
         //String routeLogPopup = "false";
 345  
         //boolean routeLogPopupInd = Utilities.getKNSParameterBooleanValue(KEWConstants.KEW_NAMESPACE, KRADConstants.DetailTypes.ACTION_LIST_DETAIL_TYPE, KEWConstants.ACTION_LIST_ROUTE_LOG_POPUP_IND);
 346  
         //if (routeLogPopupInd) {
 347  
         //        routeLogPopup = "true";
 348  
         //}
 349  
         //String documentPopup = "false";
 350  
         //boolean documentPopupInd = Utilities.getKNSParameterBooleanValue(KEWConstants.KEW_NAMESPACE, KRADConstants.DetailTypes.ACTION_LIST_DETAIL_TYPE, KEWConstants.ACTION_LIST_DOCUMENT_POPUP_IND);
 351  
         //if (documentPopupInd) {
 352  
         //    documentPopup = "true";
 353  
         //}
 354  0
         setRouteLogPopup(CoreFrameworkServiceLocator.getParameterService().getParameterValueAsBoolean(KEWConstants.KEW_NAMESPACE, KRADConstants.DetailTypes.ACTION_LIST_DETAIL_TYPE, KEWConstants.ACTION_LIST_ROUTE_LOG_POPUP_IND));
 355  0
         setDocumentPopup(CoreFrameworkServiceLocator.getParameterService().getParameterValueAsBoolean(KEWConstants.KEW_NAMESPACE, KRADConstants.DetailTypes.ACTION_LIST_DETAIL_TYPE, KEWConstants.ACTION_LIST_DOCUMENT_POPUP_IND));
 356  0
         request.setAttribute("noRefresh", Boolean.valueOf(ConfigContext.getCurrentContextConfig().getProperty(KEWConstants.ACTION_LIST_NO_REFRESH)));
 357  0
                 super.populate(request);
 358  0
         }
 359  
 
 360  
     public Boolean getRouteLogPopup() {
 361  0
         return this.routeLogPopup;
 362  
     }
 363  
 
 364  
     public Boolean getDocumentPopup() {
 365  0
         return this.documentPopup;
 366  
     }
 367  
 
 368  
     public void setRouteLogPopup(Boolean routeLogPopup) {
 369  0
         this.routeLogPopup = routeLogPopup;
 370  0
     }
 371  
 
 372  
     public void setDocumentPopup(Boolean documentPopup) {
 373  0
         this.documentPopup = documentPopup;
 374  0
     }
 375  
 
 376  
         public Boolean getHasDisplayParameters() {
 377  0
                 return this.hasDisplayParameters;
 378  
         }
 379  
 
 380  
         public void setHasDisplayParameters(Boolean hasDisplayParameters) {
 381  0
                 this.hasDisplayParameters = hasDisplayParameters;
 382  0
         }
 383  
 
 384  
         public List<WebFriendlyRecipient> getPrimaryDelegates() {
 385  0
                 return this.primaryDelegates;
 386  
         }
 387  
 
 388  
         public void setPrimaryDelegates(List<WebFriendlyRecipient> primaryDelegates) {
 389  0
                 this.primaryDelegates = primaryDelegates;
 390  0
         }
 391  
 
 392  
         public String getPrimaryDelegateId() {
 393  0
                 return this.primaryDelegateId;
 394  
         }
 395  
 
 396  
         public void setPrimaryDelegateId(String primaryDelegateId) {
 397  0
                 this.primaryDelegateId = primaryDelegateId;
 398  0
         }
 399  
         
 400  
 }