001 /** 002 * Copyright 2005-2012 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.kew.api.preferences; 017 018 import java.io.Serializable; 019 import java.util.Collection; 020 import java.util.HashMap; 021 import java.util.Map; 022 023 import javax.xml.bind.annotation.XmlAccessType; 024 import javax.xml.bind.annotation.XmlAccessorType; 025 import javax.xml.bind.annotation.XmlAnyElement; 026 import javax.xml.bind.annotation.XmlElement; 027 import javax.xml.bind.annotation.XmlRootElement; 028 import javax.xml.bind.annotation.XmlType; 029 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 030 031 import org.apache.commons.lang.StringUtils; 032 import org.kuali.rice.core.api.mo.AbstractDataTransferObject; 033 import org.kuali.rice.core.api.mo.ModelBuilder; 034 import org.kuali.rice.core.api.util.jaxb.MultiValuedStringMapAdapter; 035 import org.kuali.rice.kew.api.KewApiConstants; 036 import org.w3c.dom.Element; 037 038 /** 039 * An immutable data transfer object implementing {@link PreferencesContract}. 040 * 041 * p>When loaded, Preferences could be in a state where they require being saved to the database. 042 * If this is the case then {{@link #requiresSave} will evaluate to true. 043 * 044 * @see PreferencesContract 045 * 046 * @author Kuali Rice Team (rice.collab@kuali.org) 047 */ 048 @XmlRootElement(name = Preferences.Constants.ROOT_ELEMENT_NAME) 049 @XmlAccessorType(XmlAccessType.NONE) 050 @XmlType(name = Preferences.Constants.TYPE_NAME) 051 public final class Preferences extends AbstractDataTransferObject implements PreferencesContract { 052 053 private static final long serialVersionUID = 642820621349964439L; 054 055 @XmlElement(name = Elements.REQUIRES_SAVE) 056 private final boolean requiresSave; 057 @XmlElement(name = Elements.EMAIL_NOTIFICATION) 058 private final String emailNotification; 059 @XmlElement(name = Elements.NOTIFY_PRIMARY_DELEGATION) 060 private final String notifyPrimaryDelegation; 061 @XmlElement(name = Elements.NOTIFY_SECONDARY_DELEGATION) 062 private final String notifySecondaryDelegation; 063 @XmlElement(name = Elements.OPEN_NEW_WINDOW) 064 private final String openNewWindow; 065 @XmlElement(name = Elements.SHOW_ACTION_REQUESTED) 066 private final String showActionRequested; 067 @XmlElement(name = Elements.SHOW_DATE_CREATED) 068 private final String showDateCreated; 069 @XmlElement(name = Elements.SHOW_DOCUMENT_STATUS) 070 private final String showDocumentStatus; 071 @XmlElement(name = Elements.SHOW_APP_DOC_STATUS) 072 private final String showAppDocStatus; 073 @XmlElement(name = Elements.SHOW_DOC_TYPE) 074 private final String showDocType; 075 @XmlElement(name = Elements.SHOW_INITIATOR) 076 private final String showInitiator; 077 @XmlElement(name = Elements.SHOW_DOC_TITLE) 078 private final String showDocTitle; 079 @XmlElement(name = Elements.SHOW_WORKGROUP_REQUEST) 080 private final String showWorkgroupRequest; 081 @XmlElement(name = Elements.SHOW_DELEGATOR) 082 private final String showDelegator; 083 @XmlElement(name = Elements.SHOW_CLEAR_FYI) 084 private final String showClearFyi; 085 @XmlElement(name = Elements.PAGE_SIZE) 086 private final String pageSize; 087 @XmlElement(name = Elements.REFRESH_RATE) 088 private final String refreshRate; 089 @XmlElement(name = Elements.COLOR_SAVED) 090 private final String colorSaved; 091 @XmlElement(name = Elements.COLOR_INITIATED) 092 private final String colorInitiated; 093 @XmlElement(name = Elements.COLOR_DISAPPROVED) 094 private final String colorDisapproved; 095 @XmlElement(name = Elements.COLOR_ENROUTE) 096 private final String colorEnroute; 097 @XmlElement(name = Elements.COLOR_APPROVED) 098 private final String colorApproved; 099 @XmlElement(name = Elements.COLOR_FINAL) 100 private final String colorFinal; 101 @XmlElement(name = Elements.COLOR_DISAPPROVE_CANCEL) 102 private final String colorDisapproveCancel; 103 @XmlElement(name = Elements.COLOR_PROCESSED) 104 private final String colorProcessed; 105 @XmlElement(name = Elements.COLOR_EXCEPTION) 106 private final String colorException; 107 @XmlElement(name = Elements.COLOR_CANCELED) 108 private final String colorCanceled; 109 @XmlElement(name = Elements.DELEGATOR_FILTER) 110 private final String delegatorFilter; 111 @XmlElement(name = Elements.USE_OUTBOX) 112 private final String useOutbox; 113 @XmlElement(name = Elements.SHOW_DATE_APPROVED) 114 private final String showDateApproved; 115 @XmlElement(name = Elements.SHOW_CURRENT_NODE) 116 private final String showCurrentNode; 117 @XmlElement(name = Elements.PRIMARY_DELEGATE_FILTER) 118 private final String primaryDelegateFilter; 119 @XmlElement(name = Elements.NOTIFY_ACKNOWLEDGE) 120 private final String notifyAcknowledge; 121 @XmlElement(name = Elements.NOTIFY_APPROVE) 122 private final String notifyApprove; 123 @XmlElement(name = Elements.NOTIFY_COMPLETE) 124 private final String notifyComplete; 125 @XmlElement(name = Elements.NOTIFY_FYI) 126 private final String notifyFYI; 127 @XmlElement(name = Elements.DOCUMENT_TYPE_NOTIFICATION_PREFERENCES) 128 @XmlJavaTypeAdapter(MultiValuedStringMapAdapter.class) 129 private Map<String, String> documentTypeNotificationPreferences; 130 131 @SuppressWarnings("unused") 132 @XmlAnyElement 133 private final Collection<Element> _futureElements = null; 134 135 private Preferences() { 136 this.emailNotification = null; 137 this.notifyPrimaryDelegation = null; 138 this.notifySecondaryDelegation = null; 139 this.openNewWindow = null; 140 this.showActionRequested = null; 141 this.showDateCreated = null; 142 this.showDocumentStatus = null; 143 this.showAppDocStatus = null; 144 this.showDocType = null; 145 this.showInitiator = null; 146 this.showDocTitle = null; 147 this.showWorkgroupRequest = null; 148 this.showDelegator = null; 149 this.showClearFyi = null; 150 this.pageSize = null; 151 this.refreshRate = null; 152 this.colorSaved = null; 153 this.colorInitiated = null; 154 this.colorDisapproved = null; 155 this.colorEnroute = null; 156 this.colorApproved = null; 157 this.colorFinal = null; 158 this.colorDisapproveCancel = null; 159 this.colorProcessed = null; 160 this.colorException = null; 161 this.colorCanceled = null; 162 this.delegatorFilter = null; 163 this.useOutbox = null; 164 this.showDateApproved = null; 165 this.showCurrentNode = null; 166 this.primaryDelegateFilter = null; 167 this.notifyAcknowledge = null; 168 this.notifyApprove = null; 169 this.notifyComplete = null; 170 this.notifyFYI = null; 171 this.documentTypeNotificationPreferences = new HashMap<String, String>(); 172 173 this.requiresSave = false; 174 } 175 176 public Preferences(Builder builder) { 177 this.emailNotification = builder.getEmailNotification(); 178 this.notifyPrimaryDelegation = builder.getNotifyPrimaryDelegation(); 179 this.notifySecondaryDelegation = builder.getNotifySecondaryDelegation(); 180 this.openNewWindow = builder.getOpenNewWindow(); 181 this.showActionRequested = builder.getShowActionRequested(); 182 this.showDateCreated = builder.getShowDateCreated(); 183 this.showDocumentStatus = builder.getShowDocumentStatus(); 184 this.showAppDocStatus = builder.getShowAppDocStatus(); 185 this.showDocType = builder.getShowDocType(); 186 this.showInitiator = builder.getShowInitiator(); 187 this.showDocTitle = builder.getShowDocTitle(); 188 this.showWorkgroupRequest = builder.getShowWorkgroupRequest(); 189 this.showDelegator = builder.getShowDelegator(); 190 this.showClearFyi = builder.getShowClearFyi(); 191 this.pageSize = builder.getPageSize(); 192 this.refreshRate = builder.getRefreshRate(); 193 this.colorSaved = builder.getColorSaved(); 194 this.colorInitiated = builder.getColorInitiated(); 195 this.colorDisapproved = builder.getColorDisapproved(); 196 this.colorEnroute = builder.getColorEnroute(); 197 this.colorApproved = builder.getColorApproved(); 198 this.colorFinal = builder.getColorFinal(); 199 this.colorDisapproveCancel = builder.getColorDisapproveCancel(); 200 this.colorProcessed = builder.getColorProcessed(); 201 this.colorException = builder.getColorException(); 202 this.colorCanceled = builder.getColorCanceled(); 203 this.delegatorFilter = builder.getDelegatorFilter(); 204 this.useOutbox = builder.getUseOutbox(); 205 this.showDateApproved = builder.getShowDateApproved(); 206 this.showCurrentNode = builder.getShowCurrentNode(); 207 this.primaryDelegateFilter = builder.getPrimaryDelegateFilter(); 208 this.requiresSave = builder.isRequiresSave(); 209 this.notifyAcknowledge = builder.getNotifyAcknowledge(); 210 this.notifyApprove = builder.getNotifyApprove(); 211 this.notifyComplete = builder.getNotifyComplete(); 212 this.notifyFYI = builder.getNotifyFYI(); 213 this.documentTypeNotificationPreferences = builder.getDocumentTypeNotificationPreferences(); 214 } 215 216 public boolean isRequiresSave() { 217 return requiresSave; 218 } 219 220 public String getEmailNotification() { 221 return emailNotification; 222 } 223 224 public String getNotifyPrimaryDelegation() { 225 return notifyPrimaryDelegation; 226 } 227 228 public String getNotifySecondaryDelegation() { 229 return notifySecondaryDelegation; 230 } 231 232 public String getOpenNewWindow() { 233 return openNewWindow; 234 } 235 236 public String getShowActionRequested() { 237 return showActionRequested; 238 } 239 240 public String getShowDateCreated() { 241 return showDateCreated; 242 } 243 244 public String getShowDocumentStatus() { 245 return showDocumentStatus; 246 } 247 248 public String getShowAppDocStatus() { 249 return showAppDocStatus; 250 } 251 252 public String getShowDocType() { 253 return showDocType; 254 } 255 256 public String getShowInitiator() { 257 return showInitiator; 258 } 259 260 public String getShowDocTitle() { 261 return showDocTitle; 262 } 263 264 public String getShowWorkgroupRequest() { 265 return showWorkgroupRequest; 266 } 267 268 public String getShowDelegator() { 269 return showDelegator; 270 } 271 272 public String getShowClearFyi() { 273 return showClearFyi; 274 } 275 276 public String getPageSize() { 277 return pageSize; 278 } 279 280 public String getRefreshRate() { 281 return refreshRate; 282 } 283 284 public String getColorSaved() { 285 return colorSaved; 286 } 287 288 public String getColorInitiated() { 289 return colorInitiated; 290 } 291 292 public String getColorDisapproved() { 293 return colorDisapproved; 294 } 295 296 public String getColorEnroute() { 297 return colorEnroute; 298 } 299 300 public String getColorApproved() { 301 return colorApproved; 302 } 303 304 public String getColorFinal() { 305 return colorFinal; 306 } 307 308 public String getColorDisapproveCancel() { 309 return colorDisapproveCancel; 310 } 311 312 public String getColorProcessed() { 313 return colorProcessed; 314 } 315 316 public String getColorException() { 317 return colorException; 318 } 319 320 public String getColorCanceled() { 321 return colorCanceled; 322 } 323 324 public String getDelegatorFilter() { 325 return delegatorFilter; 326 } 327 328 public String getUseOutbox() { 329 return useOutbox; 330 } 331 332 public String getShowDateApproved() { 333 return showDateApproved; 334 } 335 336 public String getShowCurrentNode() { 337 return showCurrentNode; 338 } 339 340 public String getPrimaryDelegateFilter() { 341 return primaryDelegateFilter; 342 } 343 344 public String getNotifyComplete() { 345 return this.notifyComplete; 346 } 347 348 public String getNotifyApprove() { 349 return this.notifyApprove; 350 } 351 352 public String getNotifyAcknowledge() { 353 return this.notifyAcknowledge; 354 } 355 356 public String getNotifyFYI() { 357 return this.notifyFYI; 358 } 359 360 public String getDocumentTypeNotificationPreference(String documentType) { 361 String preferenceName = documentType.replace(KewApiConstants.DOCUMENT_TYPE_NOTIFICATION_DELIMITER, "."); 362 String preferenceValue = this.documentTypeNotificationPreferences.get(preferenceName); 363 if(StringUtils.isNotBlank(preferenceValue)) { 364 return preferenceValue; 365 } 366 return null; 367 } 368 369 public Map<String, String> getDocumentTypeNotificationPreferences() { 370 return this.documentTypeNotificationPreferences; 371 } 372 373 public boolean isUsingOutbox() { 374 if (this.getUseOutbox() != null && this.getUseOutbox().equals(Constants.PREFERENCES_YES_VAL)) { 375 return true; 376 } 377 return false; 378 } 379 380 public final static class Builder 381 implements Serializable, ModelBuilder, PreferencesContract 382 { 383 384 private boolean requiresSave = false; 385 386 private String emailNotification; 387 private String notifyPrimaryDelegation; 388 private String notifySecondaryDelegation; 389 private String openNewWindow; 390 private String showActionRequested; 391 private String showDateCreated; 392 private String showDocumentStatus; 393 private String showAppDocStatus; 394 private String showDocType; 395 private String showInitiator; 396 private String showDocTitle; 397 private String showWorkgroupRequest; 398 private String showDelegator; 399 private String showClearFyi; 400 private String pageSize; 401 private String refreshRate; 402 private String colorSaved; 403 private String colorInitiated; 404 private String colorDisapproved; 405 private String colorEnroute; 406 private String colorApproved; 407 private String colorFinal; 408 private String colorDissapproveCancel; 409 private String colorProcessed; 410 private String colorException; 411 private String colorCanceled; 412 private String delegatorFilter; 413 private String useOutbox; 414 private String showDateApproved; 415 private String showCurrentNode; 416 private String primaryDelegateFilter; 417 private String notifyAcknowledge; 418 private String notifyApprove; 419 private String notifyComplete; 420 private String notifyFYI; 421 private Map<String, String> documentTypeNotificationPreferences; 422 423 private Builder() { 424 this.documentTypeNotificationPreferences = new HashMap<String, String>(); 425 } 426 427 private Builder(String emailNotification, String notifyPrimaryDelegation, String notifySecondaryDelegation, 428 String openNewWindow, String showActionRequested, String showDateCreated, String showDocumentStatus, 429 String showAppDocStatus, String showDocType, String showInitiator, String showDocTitle, 430 String showWorkgroupRequest, String showDelegator, String showClearFyi, String pageSize, String refreshRate, 431 String colorSaved, String colorInitiated, String colorDisapproved, String colorEnroute, 432 String colorApproved, String colorFinal, String colorDissapproveCancel, String colorProcessed, 433 String colorException, String colorCanceled, String delegatorFilter, String useOutbox, 434 String showDateApproved, String showCurrentNode, String primaryDelegateFilter, String notifyAcknowledge, 435 String notifyApprove, String notifyComplete, String notifyFYI, Map<String, String> documentTypeNotificationPreferences, 436 boolean requiresSave) { 437 this.emailNotification = emailNotification; 438 this.notifyPrimaryDelegation = notifyPrimaryDelegation; 439 this.notifySecondaryDelegation = notifySecondaryDelegation; 440 this.openNewWindow = openNewWindow; 441 this.showActionRequested = showActionRequested; 442 this.showDateCreated = showDateCreated; 443 this.showDocumentStatus = showDocumentStatus; 444 this.showAppDocStatus = showAppDocStatus; 445 this.showDocType = showDocType; 446 this.showInitiator = showInitiator; 447 this.showDocTitle = showDocTitle; 448 this.showWorkgroupRequest = showWorkgroupRequest; 449 this.showDelegator = showDelegator; 450 this.showClearFyi = showClearFyi; 451 this.pageSize = pageSize; 452 this.refreshRate = refreshRate; 453 this.colorSaved = colorSaved; 454 this.colorInitiated = colorInitiated; 455 this.colorDisapproved = colorDisapproved; 456 this.colorEnroute = colorEnroute; 457 this.colorApproved = colorApproved; 458 this.colorFinal = colorFinal; 459 this.colorDissapproveCancel = colorDissapproveCancel; 460 this.colorProcessed = colorProcessed; 461 this.colorException = colorException; 462 this.colorCanceled = colorCanceled; 463 this.delegatorFilter = delegatorFilter; 464 this.useOutbox = useOutbox; 465 this.showDateApproved = showDateApproved; 466 this.showCurrentNode = showCurrentNode; 467 this.primaryDelegateFilter = primaryDelegateFilter; 468 this.requiresSave = requiresSave; 469 this.notifyAcknowledge = notifyAcknowledge; 470 this.notifyApprove = notifyApprove; 471 this.notifyComplete = notifyComplete; 472 this.notifyFYI = notifyFYI; 473 this.documentTypeNotificationPreferences = documentTypeNotificationPreferences; 474 } 475 476 public Preferences build() { 477 return new Preferences(this); 478 } 479 480 public static Builder create() { 481 return new Builder(); 482 } 483 484 public static Builder create(String emailNotification, String notifyPrimaryDelegation, String notifySecondaryDelegation, 485 String openNewWindow, String showActionRequested, String showDateCreated, String showDocumentStatus, 486 String showAppDocStatus, String showDocType, String showInitiator, String showDocTitle, 487 String showWorkgroupRequest, String showDelegator, String showClearFyi, String pageSize, String refreshRate, 488 String colorSaved, String colorInitiated, String colorDisapproved, String colorEnroute, 489 String colorApproved, String colorFinal, String colorDissapproveCancel, String colorProcessed, 490 String colorException, String colorCanceled, String delegatorFilter, String useOutbox, 491 String showDateApproved, String showCurrentNode, String primaryDelegateFilter, String notifyAcknowledge, 492 String notifyApprove, String notifyComplete, String notifyFYI, Map<String, String> documentTypeNotificationPreferences, 493 boolean requiresSave) { 494 return new Builder(emailNotification, notifyPrimaryDelegation, notifySecondaryDelegation, openNewWindow, showActionRequested, showDateCreated, 495 showDocumentStatus, showAppDocStatus, showDocType, showInitiator, showDocTitle, showWorkgroupRequest, showDelegator, showClearFyi, 496 pageSize, refreshRate, colorSaved, colorInitiated, colorDisapproved, colorEnroute, colorApproved, colorFinal, colorDissapproveCancel, 497 colorProcessed, colorException, colorCanceled, delegatorFilter, useOutbox, showDateApproved, showCurrentNode, primaryDelegateFilter, 498 notifyAcknowledge, notifyApprove, notifyComplete, notifyFYI, documentTypeNotificationPreferences, requiresSave); 499 } 500 501 public static Builder create(PreferencesContract contract) { 502 if (contract == null) { 503 throw new IllegalArgumentException("contract was null"); 504 } 505 Builder builder = create(contract.getEmailNotification(), contract.getNotifyPrimaryDelegation(), contract.getNotifySecondaryDelegation(), contract.getOpenNewWindow(), 506 contract.getShowActionRequested(), contract.getShowDateCreated(), contract.getShowDocumentStatus(), contract.getShowAppDocStatus(), contract.getShowDocType(), 507 contract.getShowInitiator(), contract.getShowDocTitle(), contract.getShowWorkgroupRequest(), contract.getShowDelegator(), contract.getShowClearFyi(), 508 contract.getPageSize(), contract.getRefreshRate(), contract.getColorSaved(), contract.getColorInitiated(), contract.getColorDisapproved(), 509 contract.getColorEnroute(), contract.getColorApproved(), contract.getColorFinal(), contract.getColorDisapproveCancel(), contract.getColorProcessed(), 510 contract.getColorException(), contract.getColorCanceled(), contract.getDelegatorFilter(), contract.getUseOutbox(), contract.getShowDateApproved(), 511 contract.getShowCurrentNode(), contract.getPrimaryDelegateFilter(), contract.getNotifyAcknowledge(), contract.getNotifyApprove(), contract.getNotifyComplete(), 512 contract.getNotifyFYI(), contract.getDocumentTypeNotificationPreferences(), contract.isRequiresSave()); 513 return builder; 514 } 515 516 public static Builder create(Map<String, String> map, Map<String, String> documentTypeNotificationPreferences, boolean requiresSave) { 517 Builder builder = create(map.get(KEYS.EMAIL_NOTIFICATION), map.get(KEYS.NOTIFY_PRIMARY_DELEGATION), map.get(KEYS.NOTIFY_SECONDARY_DELEGATION), map.get(KEYS.OPEN_NEW_WINDOW), 518 map.get(KEYS.SHOW_ACTION_REQUESTED), map.get(KEYS.SHOW_DATE_CREATED), map.get(KEYS.SHOW_DOCUMENT_STATUS), map.get(KEYS.SHOW_APP_DOC_STATUS), map.get(KEYS.SHOW_DOC_TYPE), 519 map.get(KEYS.SHOW_INITIATOR), map.get(KEYS.SHOW_DOC_TITLE), map.get(KEYS.SHOW_GROUP_REQUEST), map.get(KEYS.SHOW_DELEGATOR), map.get(KEYS.SHOW_CLEAR_FYI), 520 map.get(KEYS.PAGE_SIZE), map.get(KEYS.REFRESH_RATE), map.get(KEYS.COLOR_SAVED), map.get(KEYS.COLOR_INITIATED), map.get(KEYS.COLOR_DISAPPROVED), 521 map.get(KEYS.COLOR_ENROUTE), map.get(KEYS.COLOR_APPROVED), map.get(KEYS.COLOR_FINAL), map.get(KEYS.COLOR_DISAPPROVE_CANCEL), map.get(KEYS.COLOR_PROCESSED), 522 map.get(KEYS.COLOR_EXCEPTION), map.get(KEYS.COLOR_CANCELED), map.get(KEYS.DELEGATOR_FILTER), map.get(KEYS.USE_OUT_BOX), map.get(KEYS.SHOW_DATE_APPROVED), 523 map.get(KEYS.SHOW_CURRENT_NODE), map.get(KEYS.PRIMARY_DELEGATE_FILTER), map.get(KEYS.NOTIFY_ACKNOWLEDGE), map.get(KEYS.NOTIFY_APPROVE), map.get(KEYS.NOTIFY_COMPLETE), 524 map.get(KEYS.NOTIFY_FYI), documentTypeNotificationPreferences, requiresSave); 525 return builder; 526 } 527 528 public synchronized boolean isRequiresSave() { 529 return requiresSave; 530 } 531 532 public synchronized void setRequiresSave(boolean requiresSave) { 533 this.requiresSave = requiresSave; 534 } 535 536 public synchronized String getEmailNotification() { 537 return emailNotification; 538 } 539 540 public synchronized void setEmailNotification(String emailNotification) { 541 this.emailNotification = emailNotification; 542 } 543 544 public synchronized String getNotifyPrimaryDelegation() { 545 return notifyPrimaryDelegation; 546 } 547 548 public synchronized void setNotifyPrimaryDelegation(String notifyPrimaryDelegation) { 549 this.notifyPrimaryDelegation = notifyPrimaryDelegation; 550 } 551 552 public synchronized String getNotifySecondaryDelegation() { 553 return notifySecondaryDelegation; 554 } 555 556 public synchronized void setNotifySecondaryDelegation(String notifySecondaryDelegation) { 557 this.notifySecondaryDelegation = notifySecondaryDelegation; 558 } 559 560 public synchronized String getOpenNewWindow() { 561 return openNewWindow; 562 } 563 564 public synchronized void setOpenNewWindow(String openNewWindow) { 565 this.openNewWindow = openNewWindow; 566 } 567 568 public synchronized String getShowActionRequested() { 569 return showActionRequested; 570 } 571 572 public synchronized void setShowActionRequested(String showActionRequested) { 573 this.showActionRequested = showActionRequested; 574 } 575 576 public synchronized String getShowDateCreated() { 577 return showDateCreated; 578 } 579 580 public synchronized void setShowDateCreated(String showDateCreated) { 581 this.showDateCreated = showDateCreated; 582 } 583 584 public synchronized String getShowDocumentStatus() { 585 return showDocumentStatus; 586 } 587 588 public synchronized void setShowDocumentStatus(String showDocumentStatus) { 589 this.showDocumentStatus = showDocumentStatus; 590 } 591 592 public synchronized String getShowAppDocStatus() { 593 return showAppDocStatus; 594 } 595 596 public synchronized void setShowAppDocStatus(String showAppDocStatus) { 597 this.showAppDocStatus = showAppDocStatus; 598 } 599 600 public synchronized String getShowDocType() { 601 return showDocType; 602 } 603 604 public synchronized void setShowDocType(String showDocType) { 605 this.showDocType = showDocType; 606 } 607 608 public synchronized String getShowInitiator() { 609 return showInitiator; 610 } 611 612 public synchronized void setShowInitiator(String showInitiator) { 613 this.showInitiator = showInitiator; 614 } 615 616 public synchronized String getShowDocTitle() { 617 return showDocTitle; 618 } 619 620 public synchronized void setShowDocTitle(String showDocTitle) { 621 this.showDocTitle = showDocTitle; 622 } 623 624 public synchronized String getShowWorkgroupRequest() { 625 return showWorkgroupRequest; 626 } 627 628 public synchronized void setShowWorkgroupRequest(String showWorkgroupRequest) { 629 this.showWorkgroupRequest = showWorkgroupRequest; 630 } 631 632 public synchronized String getShowDelegator() { 633 return showDelegator; 634 } 635 636 public synchronized void setShowDelegator(String showDelegator) { 637 this.showDelegator = showDelegator; 638 } 639 640 public synchronized String getShowClearFyi() { 641 return showClearFyi; 642 } 643 644 public synchronized void setShowClearFyi(String showClearFyi) { 645 this.showClearFyi = showClearFyi; 646 } 647 648 public synchronized String getPageSize() { 649 return pageSize; 650 } 651 652 public synchronized void setPageSize(String pageSize) { 653 this.pageSize = pageSize; 654 } 655 656 public synchronized String getRefreshRate() { 657 return refreshRate; 658 } 659 660 public synchronized void setRefreshRate(String refreshRate) { 661 this.refreshRate = refreshRate; 662 } 663 664 public synchronized String getColorSaved() { 665 return colorSaved; 666 } 667 668 public synchronized void setColorSaved(String colorSaved) { 669 this.colorSaved = colorSaved; 670 } 671 672 public synchronized String getColorInitiated() { 673 return colorInitiated; 674 } 675 676 public synchronized void setColorInitiated(String colorInitiated) { 677 this.colorInitiated = colorInitiated; 678 } 679 680 public synchronized String getColorDisapproved() { 681 return colorDisapproved; 682 } 683 684 public synchronized void setColorDisapproved(String colorDisapproved) { 685 this.colorDisapproved = colorDisapproved; 686 } 687 688 public synchronized String getColorEnroute() { 689 return colorEnroute; 690 } 691 692 public synchronized void setColorEnroute(String colorEnroute) { 693 this.colorEnroute = colorEnroute; 694 } 695 696 public synchronized String getColorApproved() { 697 return colorApproved; 698 } 699 700 public synchronized void setColorApproved(String colorApproved) { 701 this.colorApproved = colorApproved; 702 } 703 704 public synchronized String getColorFinal() { 705 return colorFinal; 706 } 707 708 public synchronized void setColorFinal(String colorFinal) { 709 this.colorFinal = colorFinal; 710 } 711 712 public synchronized String getColorDisapproveCancel() { 713 return colorDissapproveCancel; 714 } 715 716 public synchronized void setColorDissapproveCancel(String colorDissapproveCancel) { 717 this.colorDissapproveCancel = colorDissapproveCancel; 718 } 719 720 public synchronized String getColorProcessed() { 721 return colorProcessed; 722 } 723 724 public synchronized void setColorProcessed(String colorProcessed) { 725 this.colorProcessed = colorProcessed; 726 } 727 728 public synchronized String getColorException() { 729 return colorException; 730 } 731 732 public synchronized void setColorException(String colorException) { 733 this.colorException = colorException; 734 } 735 736 public synchronized String getColorCanceled() { 737 return colorCanceled; 738 } 739 740 public synchronized void setColorCanceled(String colorCanceled) { 741 this.colorCanceled = colorCanceled; 742 } 743 744 public synchronized String getDelegatorFilter() { 745 return delegatorFilter; 746 } 747 748 public synchronized void setDelegatorFilter(String delegatorFilter) { 749 this.delegatorFilter = delegatorFilter; 750 } 751 752 public synchronized String getUseOutbox() { 753 return useOutbox; 754 } 755 756 public synchronized void setUseOutbox(String useOutbox) { 757 this.useOutbox = useOutbox; 758 } 759 760 public synchronized String getShowDateApproved() { 761 return showDateApproved; 762 } 763 764 public synchronized void setShowDateApproved(String showDateApproved) { 765 this.showDateApproved = showDateApproved; 766 } 767 768 public synchronized String getShowCurrentNode() { 769 return showCurrentNode; 770 } 771 772 public synchronized void setShowCurrentNode(String showCurrentNode) { 773 this.showCurrentNode = showCurrentNode; 774 } 775 776 public synchronized String getPrimaryDelegateFilter() { 777 return primaryDelegateFilter; 778 } 779 780 public synchronized void setPrimaryDelegateFilter(String primaryDelegateFilter) { 781 this.primaryDelegateFilter = primaryDelegateFilter; 782 } 783 784 public synchronized String getNotifyAcknowledge() { 785 return this.notifyAcknowledge; 786 } 787 788 public synchronized void setNotifyAcknowledge(String notifyAcknowledge) { 789 this.notifyAcknowledge = notifyAcknowledge; 790 } 791 792 public synchronized String getNotifyApprove() { 793 return this.notifyApprove; 794 } 795 796 public synchronized void setNotifyApprove(String notifyApprove) { 797 this.notifyApprove = notifyApprove; 798 } 799 800 public synchronized String getNotifyComplete() { 801 return this.notifyComplete; 802 } 803 804 public synchronized void setNotifyComplete(String notifyComplete) { 805 this.notifyComplete = notifyComplete; 806 } 807 808 public synchronized String getNotifyFYI() { 809 return this.notifyFYI; 810 } 811 812 public synchronized void setNotifyFYI(String notifyFYI) { 813 this.notifyFYI = notifyFYI; 814 } 815 816 public synchronized String getDocumentTypeNotificationPreference(String documentType) { 817 String preferenceName = documentType.replace(KewApiConstants.DOCUMENT_TYPE_NOTIFICATION_DELIMITER, "."); 818 String preferenceValue = this.documentTypeNotificationPreferences.get(preferenceName); 819 if(StringUtils.isNotBlank(preferenceValue)) { 820 return preferenceValue; 821 } 822 return null; 823 } 824 825 public synchronized void setDocumentTypeNotificationPreference(String documentType, String preference) { 826 documentType = documentType.replace(KewApiConstants.DOCUMENT_TYPE_NOTIFICATION_DELIMITER, "."); 827 this.documentTypeNotificationPreferences.put(documentType, preference); 828 } 829 830 public synchronized Map<String, String> getDocumentTypeNotificationPreferences() { 831 if(this.documentTypeNotificationPreferences == null) { 832 this.documentTypeNotificationPreferences = new HashMap<String, String>(); 833 } 834 return this.documentTypeNotificationPreferences; 835 } 836 837 public synchronized void setDocumentTypeNotificationPreferences(Map<String, String> documentTypeNotificationPreferences) { 838 this.documentTypeNotificationPreferences = documentTypeNotificationPreferences; 839 } 840 841 public synchronized void addDocumentTypeNotificationPreference(String documentType, String preference) { 842 this.getDocumentTypeNotificationPreferences().put(documentType, preference); 843 } 844 845 public synchronized void removeDocumentTypeNotificationPreference(String documentType) { 846 this.getDocumentTypeNotificationPreferences().remove(documentType); 847 } 848 } 849 850 static class Constants { 851 static final String ROOT_ELEMENT_NAME = "preferences"; 852 static final String TYPE_NAME = "PreferencesType"; 853 static final String PREFERENCES_YES_VAL = "yes"; 854 } 855 856 /** 857 * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML. 858 * 859 */ 860 static class Elements { 861 862 static final String REQUIRES_SAVE = "requiresSave"; 863 static final String EMAIL_NOTIFICATION = "emailNotification"; 864 static final String NOTIFY_PRIMARY_DELEGATION = "notifyPrimaryDelegation"; 865 static final String NOTIFY_SECONDARY_DELEGATION = "notifySecondaryDelegation"; 866 static final String OPEN_NEW_WINDOW = "openNewWindow"; 867 static final String SHOW_ACTION_REQUESTED = "showActionRequested"; 868 static final String SHOW_DATE_CREATED = "showDateCreated"; 869 static final String SHOW_DOCUMENT_STATUS = "showDocumentStatus"; 870 static final String SHOW_APP_DOC_STATUS = "showAppDocStatus"; 871 static final String SHOW_DOC_TYPE = "showDocType"; 872 static final String SHOW_INITIATOR = "showInitiator"; 873 static final String SHOW_DOC_TITLE = "showDocTitle"; 874 static final String SHOW_WORKGROUP_REQUEST = "showWorkgroupRequest"; 875 static final String SHOW_DELEGATOR = "showDelegator"; 876 static final String SHOW_CLEAR_FYI = "showClearFyi"; 877 static final String PAGE_SIZE = "pageSize"; 878 static final String REFRESH_RATE = "refreshRate"; 879 static final String COLOR_SAVED = "colorSaved"; 880 static final String COLOR_INITIATED = "colorInitiated"; 881 static final String COLOR_DISAPPROVED = "colorDisapproved"; 882 static final String COLOR_ENROUTE = "colorEnroute"; 883 static final String COLOR_APPROVED = "colorApproved"; 884 static final String COLOR_FINAL = "colorFinal"; 885 static final String COLOR_DISAPPROVE_CANCEL = "colorDisapproveCancel"; 886 static final String COLOR_PROCESSED = "colorProcessed"; 887 static final String COLOR_EXCEPTION = "colorException"; 888 static final String COLOR_CANCELED = "colorCanceled"; 889 static final String DELEGATOR_FILTER = "delegatorFilter"; 890 static final String USE_OUTBOX = "useOutbox"; 891 static final String SHOW_DATE_APPROVED = "showDateApproved"; 892 static final String SHOW_CURRENT_NODE = "showCurrentNode"; 893 static final String PRIMARY_DELEGATE_FILTER = "primaryDelegateFilter"; 894 static final String NOTIFY_ACKNOWLEDGE = "notifyAcknowledge"; 895 static final String NOTIFY_APPROVE = "notifyApprove"; 896 static final String NOTIFY_COMPLETE = "notifyCompelte"; 897 static final String NOTIFY_FYI = "notifyFYI"; 898 static final String DOCUMENT_TYPE_NOTIFICATION_PREFERENCES = "documentTypeNotificationPreferences"; 899 } 900 901 public static class KEYS { 902 public static final String COLOR_DISAPPROVED = "DOCUMENT_STATUS_COLOR_D"; 903 public static final String COLOR_DISAPPROVE_CANCEL = "DOCUMENT_STATUS_COLOR_C"; 904 public static final String COLOR_APPROVED = "DOCUMENT_STATUS_COLOR_A"; 905 public static final String COLOR_CANCELED = "DOCUMENT_STATUS_COLOR_X"; 906 public static final String COLOR_SAVED = "DOCUMENT_STATUS_COLOR_S"; 907 public static final String COLOR_ENROUTE = "DOCUMENT_STATUS_COLOR_R"; 908 public static final String COLOR_PROCESSED = "DOCUMENT_STATUS_COLOR_P"; 909 public static final String COLOR_INITIATED = "DOCUMENT_STATUS_COLOR_I"; 910 public static final String COLOR_FINAL = "DOCUMENT_STATUS_COLOR_F"; 911 public static final String COLOR_EXCEPTION = "DOCUMENT_STATUS_COLOR_E"; 912 public static final String REFRESH_RATE = "REFRESH_RATE"; 913 public static final String OPEN_NEW_WINDOW = "OPEN_ITEMS_NEW_WINDOW"; 914 public static final String SHOW_DOC_TYPE = "DOC_TYPE_COL_SHOW_NEW"; 915 public static final String SHOW_DOC_TITLE = "TITLE_COL_SHOW_NEW"; 916 public static final String SHOW_ACTION_REQUESTED = "ACTION_REQUESTED_COL_SHOW_NEW"; 917 public static final String SHOW_INITIATOR = "INITIATOR_COL_SHOW_NEW"; 918 public static final String SHOW_DELEGATOR = "DELEGATOR_COL_SHOW_NEW"; 919 public static final String SHOW_DATE_CREATED = "DATE_CREATED_COL_SHOW_NEW"; 920 public static final String SHOW_DOCUMENT_STATUS = "DOCUMENT_STATUS_COL_SHOW_NEW"; 921 public static final String SHOW_APP_DOC_STATUS = "APP_DOC_STATUS_COL_SHOW_NEW"; 922 public static final String SHOW_GROUP_REQUEST = "WORKGROUP_REQUEST_COL_SHOW_NEW"; 923 public static final String SHOW_CLEAR_FYI = "CLEAR_FYI_COL_SHOW_NEW"; 924 public static final String PAGE_SIZE = "ACTION_LIST_SIZE_NEW"; 925 public static final String EMAIL_NOTIFICATION = "EMAIL_NOTIFICATION"; 926 public static final String NOTIFY_PRIMARY_DELEGATION = "EMAIL_NOTIFY_PRIMARY"; 927 public static final String NOTIFY_SECONDARY_DELEGATION = "EMAIL_NOTIFY_SECONDARY"; 928 public static final String DEFAULT_COLOR = "white"; 929 public static final String DEFAULT_ACTION_LIST_SIZE = "10"; 930 public static final String DEFAULT_REFRESH_RATE = "15"; 931 public static final String ERR_KEY_REFRESH_RATE_WHOLE_NUM = "preferences.refreshRate"; 932 public static final String ERR_KEY_ACTION_LIST_PAGE_SIZE_WHOLE_NUM = "preferences.pageSize"; 933 public static final String DELEGATOR_FILTER = "DELEGATOR_FILTER"; 934 public static final String PRIMARY_DELEGATE_FILTER = "PRIMARY_DELEGATE_FILTER"; 935 public static final String USE_OUT_BOX = "USE_OUT_BOX"; 936 public static final String SHOW_DATE_APPROVED = "LAST_APPROVED_DATE_COL_SHOW_NEW"; 937 public static final String SHOW_CURRENT_NODE = "CURRENT_NODE_COL_SHOW_NEW"; 938 public static final String NOTIFY_ACKNOWLEDGE = "NOTIFY_ACKNOWLEDGE"; 939 public static final String NOTIFY_APPROVE = "NOTIFY_APPROVE"; 940 public static final String NOTIFY_COMPLETE = "NOTIFY_COMPLETE"; 941 public static final String NOTIFY_FYI = "NOTIFY_FYI"; 942 public static final String DOCUMENT_TYPE_NOTIFICATION_PREFERENCES = "DOCUMENT_TYPE_NOTIFICATION_PREFERENCES"; 943 } 944 945 public static class Cache { 946 public static final String NAME = KewApiConstants.Namespaces.KEW_NAMESPACE_2_0 + "/" + Preferences.Constants.TYPE_NAME; 947 } 948 949 }