| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| DocumentTypePolicyEnum |
|
| 8.75;8.75 |
| 1 | /* | |
| 2 | * Copyright 2005-2008 The Kuali Foundation | |
| 3 | * | |
| 4 | * | |
| 5 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 6 | * you may not use this file except in compliance with the License. | |
| 7 | * You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.opensource.org/licenses/ecl2.php | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | package org.kuali.rice.kew.doctype; | |
| 18 | ||
| 19 | import org.kuali.rice.kew.util.KEWConstants; | |
| 20 | ||
| 21 | ||
| 22 | /** | |
| 23 | * DocumentType policy enum type. | |
| 24 | * Encapsulates policies of the document. | |
| 25 | * | |
| 26 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 27 | */ | |
| 28 | public final class DocumentTypePolicyEnum { | |
| 29 | ||
| 30 | /** | |
| 31 | * FIXME: needs docs | |
| 32 | */ | |
| 33 | 0 | public static final DocumentTypePolicyEnum DISAPPROVE = new DocumentTypePolicyEnum(KEWConstants.DISAPPROVE_POLICY); |
| 34 | ||
| 35 | /** | |
| 36 | * This policy determines whether to use the internal KEW Super User document handler URL when opening a document from | |
| 37 | * super user search. If set to false the client must implement a custom super user screen to be used when the doc | |
| 38 | * handler URL has a post variable of the name defined by {@link KEWConstants#COMMAND_PARAMETER} and a value of | |
| 39 | * {@link KEWConstants#SUPERUSER_COMMAND}. The default is 'true'. | |
| 40 | */ | |
| 41 | 0 | public static final DocumentTypePolicyEnum USE_KEW_SUPERUSER_DOCHANDLER = new DocumentTypePolicyEnum(KEWConstants.USE_KEW_SUPERUSER_DOCHANDLER); |
| 42 | ||
| 43 | /** | |
| 44 | * determines how to handle the situation where the user has initiated an action but there is not a corresponding pending request. This policy has a default of true. | |
| 45 | * If set to false an exception should be thrown from ApproveAction, CompleteAction, AcknowledgeAction | |
| 46 | * and ClearFYIAction classes when there does not exist a corresponding pending request for the user who is submitting the action. | |
| 47 | * When set to false, this will result in one of the users getting an error message if 2 users attempt to submit the same action | |
| 48 | * at the same time (this can happen in workgroup situtations). | |
| 49 | */ | |
| 50 | 0 | public static final DocumentTypePolicyEnum ALLOW_UNREQUESTED_ACTION = new DocumentTypePolicyEnum(KEWConstants.ALLOW_UNREQUESTED_ACTION_POLICY); |
| 51 | ||
| 52 | /** | |
| 53 | * determines whether a document will go processed without any approval requests. If | |
| 54 | * a document has this policy set to false and doesn't generate and approval requests the document will | |
| 55 | * be put in exception routing, which is the exception workgroup associated with the last route node or the | |
| 56 | * workgroup defined in the 'defaultExceptionGroupName'. This policy if not defined in this or a parent | |
| 57 | * document type defaults to true | |
| 58 | */ | |
| 59 | 0 | public static final DocumentTypePolicyEnum DEFAULT_APPROVE = new DocumentTypePolicyEnum(KEWConstants.DEFAULT_APPROVE_POLICY); |
| 60 | /** | |
| 61 | * determines if the user that initiated a document must 'route' the document when it is | |
| 62 | * in the initiated state. Defaults to true. | |
| 63 | */ | |
| 64 | 0 | public static final DocumentTypePolicyEnum INITIATOR_MUST_ROUTE = new DocumentTypePolicyEnum(KEWConstants.INITIATOR_MUST_ROUTE_POLICY); |
| 65 | /** | |
| 66 | * determines if the user that initiated a document must 'route' the document when it is | |
| 67 | * in the initiated state. Defaults to true. | |
| 68 | */ | |
| 69 | 0 | public static final DocumentTypePolicyEnum INITIATOR_MUST_SAVE = new DocumentTypePolicyEnum(KEWConstants.INITIATOR_MUST_SAVE_POLICY); |
| 70 | 0 | public static final DocumentTypePolicyEnum INITIATOR_MUST_CANCEL = new DocumentTypePolicyEnum(KEWConstants.INITIATOR_MUST_CANCEL_POLICY); |
| 71 | 0 | public static final DocumentTypePolicyEnum INITIATOR_MUST_BLANKET_APPROVE = new DocumentTypePolicyEnum(KEWConstants.INITIATOR_MUST_BLANKET_APPROVE_POLICY); |
| 72 | ||
| 73 | /** | |
| 74 | * determines whether the document can be brought into a simulated route from the route log. A | |
| 75 | * simulation of where the document would end up if it where routed to completion now. Defaults to false. | |
| 76 | */ | |
| 77 | // determines if route log will show the look into the future link | |
| 78 | 0 | public static final DocumentTypePolicyEnum LOOK_FUTURE = new DocumentTypePolicyEnum(KEWConstants.LOOK_INTO_FUTURE_POLICY); |
| 79 | ||
| 80 | 0 | public static final DocumentTypePolicyEnum SEND_NOTIFICATION_ON_SU_APPROVE = new DocumentTypePolicyEnum(KEWConstants.SEND_NOTIFICATION_ON_SU_APPROVE_POLICY); |
| 81 | ||
| 82 | 0 | public static final DocumentTypePolicyEnum SUPPORTS_QUICK_INITIATE = new DocumentTypePolicyEnum(KEWConstants.SUPPORTS_QUICK_INITIATE_POLICY); |
| 83 | ||
| 84 | 0 | public static final DocumentTypePolicyEnum NOTIFY_ON_SAVE = new DocumentTypePolicyEnum(KEWConstants.NOTIFY_ON_SAVE_POLICY); |
| 85 | ||
| 86 | /** | |
| 87 | * The Document Status Policy determines whether the KEW Route Status or the Application Document Status (or both) | |
| 88 | * are to be used for a specific document type. | |
| 89 | */ | |
| 90 | 0 | public static final DocumentTypePolicyEnum DOCUMENT_STATUS_POLICY = new DocumentTypePolicyEnum(KEWConstants.DOCUMENT_STATUS_POLICY); |
| 91 | ||
| 92 | /** | |
| 93 | * This document type policy allows us to configure if the "Perform Post Processor Logic" for the super user action on action requests is displayed. | |
| 94 | * KULRICE-3584 | |
| 95 | */ | |
| 96 | 0 | public static final DocumentTypePolicyEnum ALLOW_SU_POSTPROCESSOR_OVERRIDE_POLICY = new DocumentTypePolicyEnum(KEWConstants.ALLOW_SU_POSTPROCESSOR_OVERRIDE_POLICY); |
| 97 | ||
| 98 | ||
| 99 | private final String name; | |
| 100 | ||
| 101 | 0 | public DocumentTypePolicyEnum(String name) { |
| 102 | 0 | this.name = name; |
| 103 | 0 | } |
| 104 | ||
| 105 | public String getName() { | |
| 106 | 0 | return name; |
| 107 | } | |
| 108 | ||
| 109 | public String toString() { | |
| 110 | 0 | return "[DocumentTypePolicyEnum: name=" + name + "]"; |
| 111 | } | |
| 112 | ||
| 113 | public static DocumentTypePolicyEnum lookup(String name) { | |
| 114 | 0 | if (name == null) { |
| 115 | 0 | throw new IllegalArgumentException("Document type policy name must be non-null"); |
| 116 | } | |
| 117 | 0 | if (DISAPPROVE.name.equalsIgnoreCase(name)) { |
| 118 | 0 | return DISAPPROVE; |
| 119 | 0 | } else if (DEFAULT_APPROVE.name.equalsIgnoreCase(name)) { |
| 120 | 0 | return DEFAULT_APPROVE; |
| 121 | 0 | } else if (ALLOW_UNREQUESTED_ACTION.name.equalsIgnoreCase(name)) { |
| 122 | 0 | return ALLOW_UNREQUESTED_ACTION; |
| 123 | 0 | } else if (INITIATOR_MUST_ROUTE.name.equalsIgnoreCase(name)) { |
| 124 | 0 | return INITIATOR_MUST_ROUTE; |
| 125 | 0 | } else if (INITIATOR_MUST_SAVE.name.equalsIgnoreCase(name)) { |
| 126 | 0 | return INITIATOR_MUST_SAVE; |
| 127 | 0 | } else if (INITIATOR_MUST_BLANKET_APPROVE.name.equalsIgnoreCase(name)) { |
| 128 | 0 | return INITIATOR_MUST_BLANKET_APPROVE; |
| 129 | 0 | } else if (INITIATOR_MUST_CANCEL.name.equalsIgnoreCase(name)) { |
| 130 | 0 | return INITIATOR_MUST_CANCEL; |
| 131 | 0 | } else if (LOOK_FUTURE.name.equalsIgnoreCase(name)) { |
| 132 | 0 | return LOOK_FUTURE; |
| 133 | 0 | } else if (SEND_NOTIFICATION_ON_SU_APPROVE.name.equalsIgnoreCase(name)) { |
| 134 | 0 | return SEND_NOTIFICATION_ON_SU_APPROVE; |
| 135 | 0 | } else if (SUPPORTS_QUICK_INITIATE.name.equalsIgnoreCase(name)) { |
| 136 | 0 | return SUPPORTS_QUICK_INITIATE; |
| 137 | 0 | } else if (NOTIFY_ON_SAVE.name.equalsIgnoreCase(name)) { |
| 138 | 0 | return NOTIFY_ON_SAVE; |
| 139 | 0 | } else if (USE_KEW_SUPERUSER_DOCHANDLER.name.equalsIgnoreCase(name)) { |
| 140 | 0 | return USE_KEW_SUPERUSER_DOCHANDLER; |
| 141 | 0 | } else if (DOCUMENT_STATUS_POLICY.name.equalsIgnoreCase(name)) { |
| 142 | 0 | return DOCUMENT_STATUS_POLICY; |
| 143 | 0 | }else if (ALLOW_SU_POSTPROCESSOR_OVERRIDE_POLICY.name.equalsIgnoreCase(name)) { |
| 144 | 0 | return ALLOW_SU_POSTPROCESSOR_OVERRIDE_POLICY; |
| 145 | } else { | |
| 146 | 0 | throw new IllegalArgumentException("Invalid Document type policy: '" + name + "'"); |
| 147 | } | |
| 148 | } | |
| 149 | } |