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