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