| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| DocumentTypePolicyEnum |
|
| 9.75;9.75 |
| 1 | /** | |
| 2 | * Copyright 2005-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 | package org.kuali.rice.kew.doctype; | |
| 17 | ||
| 18 | import org.kuali.rice.kew.api.KewApiConstants; | |
| 19 | ||
| 20 | ||
| 21 | /** | |
| 22 | * DocumentType policy enum type. | |
| 23 | * Encapsulates policies of the document. | |
| 24 | * | |
| 25 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 26 | */ | |
| 27 | public final class DocumentTypePolicyEnum { | |
| 28 | ||
| 29 | /** | |
| 30 | * FIXME: needs docs | |
| 31 | */ | |
| 32 | 0 | public static final DocumentTypePolicyEnum DISAPPROVE = new DocumentTypePolicyEnum(KewApiConstants.DISAPPROVE_POLICY); |
| 33 | ||
| 34 | /** | |
| 35 | * This policy determines whether to use the internal KEW Super User document handler URL when opening a document from | |
| 36 | * super user search. If set to false the client must implement a custom super user screen to be used when the doc | |
| 37 | * handler URL has a post variable of the name defined by {@link KewApiConstants#COMMAND_PARAMETER} and a value of | |
| 38 | * {@link KewApiConstants#SUPERUSER_COMMAND}. The default is 'true'. | |
| 39 | */ | |
| 40 | 0 | public static final DocumentTypePolicyEnum USE_KEW_SUPERUSER_DOCHANDLER = new DocumentTypePolicyEnum(KewApiConstants.USE_KEW_SUPERUSER_DOCHANDLER); |
| 41 | ||
| 42 | /** | |
| 43 | * 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. | |
| 44 | * If set to false an exception should be thrown from ApproveAction, CompleteAction, AcknowledgeAction | |
| 45 | * and ClearFYIAction classes when there does not exist a corresponding pending request for the user who is submitting the action. | |
| 46 | * 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 | |
| 47 | * at the same time (this can happen in workgroup situtations). | |
| 48 | */ | |
| 49 | 0 | public static final DocumentTypePolicyEnum ALLOW_UNREQUESTED_ACTION = new DocumentTypePolicyEnum(KewApiConstants.ALLOW_UNREQUESTED_ACTION_POLICY); |
| 50 | ||
| 51 | /** | |
| 52 | * determines whether a document will go processed without any approval requests. If | |
| 53 | * a document has this policy set to false and doesn't generate and approval requests the document will | |
| 54 | * be put in exception routing, which is the exception workgroup associated with the last route node or the | |
| 55 | * workgroup defined in the 'defaultExceptionGroupName'. This policy if not defined in this or a parent | |
| 56 | * document type defaults to true | |
| 57 | */ | |
| 58 | 0 | public static final DocumentTypePolicyEnum DEFAULT_APPROVE = new DocumentTypePolicyEnum(KewApiConstants.DEFAULT_APPROVE_POLICY); |
| 59 | /** | |
| 60 | * determines if the user that initiated a document must 'route' the document when it is | |
| 61 | * in the initiated state. Defaults to true. | |
| 62 | */ | |
| 63 | 0 | public static final DocumentTypePolicyEnum INITIATOR_MUST_ROUTE = new DocumentTypePolicyEnum(KewApiConstants.INITIATOR_MUST_ROUTE_POLICY); |
| 64 | /** | |
| 65 | * determines if the user that initiated a document must 'route' the document when it is | |
| 66 | * in the initiated state. Defaults to true. | |
| 67 | */ | |
| 68 | 0 | public static final DocumentTypePolicyEnum INITIATOR_MUST_SAVE = new DocumentTypePolicyEnum(KewApiConstants.INITIATOR_MUST_SAVE_POLICY); |
| 69 | 0 | public static final DocumentTypePolicyEnum INITIATOR_MUST_CANCEL = new DocumentTypePolicyEnum(KewApiConstants.INITIATOR_MUST_CANCEL_POLICY); |
| 70 | 0 | public static final DocumentTypePolicyEnum INITIATOR_MUST_BLANKET_APPROVE = new DocumentTypePolicyEnum(KewApiConstants.INITIATOR_MUST_BLANKET_APPROVE_POLICY); |
| 71 | ||
| 72 | /** | |
| 73 | * determines whether the document can be brought into a simulated route from the route log. A | |
| 74 | * simulation of where the document would end up if it where routed to completion now. Defaults to false. | |
| 75 | */ | |
| 76 | // determines if route log will show the look into the future link | |
| 77 | 0 | public static final DocumentTypePolicyEnum LOOK_FUTURE = new DocumentTypePolicyEnum(KewApiConstants.LOOK_INTO_FUTURE_POLICY); |
| 78 | ||
| 79 | 0 | public static final DocumentTypePolicyEnum SEND_NOTIFICATION_ON_SU_APPROVE = new DocumentTypePolicyEnum(KewApiConstants.SEND_NOTIFICATION_ON_SU_APPROVE_POLICY); |
| 80 | ||
| 81 | 0 | public static final DocumentTypePolicyEnum SUPPORTS_QUICK_INITIATE = new DocumentTypePolicyEnum(KewApiConstants.SUPPORTS_QUICK_INITIATE_POLICY); |
| 82 | ||
| 83 | 0 | public static final DocumentTypePolicyEnum NOTIFY_ON_SAVE = new DocumentTypePolicyEnum(KewApiConstants.NOTIFY_ON_SAVE_POLICY); |
| 84 | ||
| 85 | /** | |
| 86 | * The Document Status Policy determines whether the KEW Route Status or the Application Document Status (or both) | |
| 87 | * are to be used for a specific document type. | |
| 88 | */ | |
| 89 | 0 | public static final DocumentTypePolicyEnum DOCUMENT_STATUS_POLICY = new DocumentTypePolicyEnum(KewApiConstants.DOCUMENT_STATUS_POLICY); |
| 90 | ||
| 91 | /** | |
| 92 | * This document type policy allows us to configure if the "Perform Post Processor Logic" for the super user action on action requests is displayed. | |
| 93 | * KULRICE-3584 | |
| 94 | */ | |
| 95 | 0 | public static final DocumentTypePolicyEnum ALLOW_SU_POSTPROCESSOR_OVERRIDE_POLICY = new DocumentTypePolicyEnum(KewApiConstants.ALLOW_SU_POSTPROCESSOR_OVERRIDE_POLICY); |
| 96 | ||
| 97 | 0 | public static final DocumentTypePolicyEnum FAIL_ON_INACTIVE_GROUP = new DocumentTypePolicyEnum(KewApiConstants.FAIL_ON_INACTIVE_GROUP_POLICY); |
| 98 | ||
| 99 | 0 | public static final DocumentTypePolicyEnum REGENERATE_ACTION_REQUESTS_ON_CHANGE = new DocumentTypePolicyEnum(KewApiConstants.REGENERATE_ACTION_REQUESTS_ON_CHANGE_POLICY); |
| 100 | ||
| 101 | private final String name; | |
| 102 | ||
| 103 | 0 | public DocumentTypePolicyEnum(String name) { |
| 104 | 0 | this.name = name; |
| 105 | 0 | } |
| 106 | ||
| 107 | public String getName() { | |
| 108 | 0 | return name; |
| 109 | } | |
| 110 | ||
| 111 | public String toString() { | |
| 112 | 0 | return "[DocumentTypePolicyEnum: name=" + name + "]"; |
| 113 | } | |
| 114 | ||
| 115 | public static DocumentTypePolicyEnum lookup(String name) { | |
| 116 | 0 | if (name == null) { |
| 117 | 0 | throw new IllegalArgumentException("Document type policy name must be non-null"); |
| 118 | } | |
| 119 | 0 | if (DISAPPROVE.name.equalsIgnoreCase(name)) { |
| 120 | 0 | return DISAPPROVE; |
| 121 | 0 | } else if (DEFAULT_APPROVE.name.equalsIgnoreCase(name)) { |
| 122 | 0 | return DEFAULT_APPROVE; |
| 123 | 0 | } else if (ALLOW_UNREQUESTED_ACTION.name.equalsIgnoreCase(name)) { |
| 124 | 0 | return ALLOW_UNREQUESTED_ACTION; |
| 125 | 0 | } else if (INITIATOR_MUST_ROUTE.name.equalsIgnoreCase(name)) { |
| 126 | 0 | return INITIATOR_MUST_ROUTE; |
| 127 | 0 | } else if (INITIATOR_MUST_SAVE.name.equalsIgnoreCase(name)) { |
| 128 | 0 | return INITIATOR_MUST_SAVE; |
| 129 | 0 | } else if (INITIATOR_MUST_BLANKET_APPROVE.name.equalsIgnoreCase(name)) { |
| 130 | 0 | return INITIATOR_MUST_BLANKET_APPROVE; |
| 131 | 0 | } else if (INITIATOR_MUST_CANCEL.name.equalsIgnoreCase(name)) { |
| 132 | 0 | return INITIATOR_MUST_CANCEL; |
| 133 | 0 | } else if (LOOK_FUTURE.name.equalsIgnoreCase(name)) { |
| 134 | 0 | return LOOK_FUTURE; |
| 135 | 0 | } else if (SEND_NOTIFICATION_ON_SU_APPROVE.name.equalsIgnoreCase(name)) { |
| 136 | 0 | return SEND_NOTIFICATION_ON_SU_APPROVE; |
| 137 | 0 | } else if (SUPPORTS_QUICK_INITIATE.name.equalsIgnoreCase(name)) { |
| 138 | 0 | return SUPPORTS_QUICK_INITIATE; |
| 139 | 0 | } else if (NOTIFY_ON_SAVE.name.equalsIgnoreCase(name)) { |
| 140 | 0 | return NOTIFY_ON_SAVE; |
| 141 | 0 | } else if (USE_KEW_SUPERUSER_DOCHANDLER.name.equalsIgnoreCase(name)) { |
| 142 | 0 | return USE_KEW_SUPERUSER_DOCHANDLER; |
| 143 | 0 | } else if (DOCUMENT_STATUS_POLICY.name.equalsIgnoreCase(name)) { |
| 144 | 0 | return DOCUMENT_STATUS_POLICY; |
| 145 | 0 | }else if (ALLOW_SU_POSTPROCESSOR_OVERRIDE_POLICY.name.equalsIgnoreCase(name)) { |
| 146 | 0 | return ALLOW_SU_POSTPROCESSOR_OVERRIDE_POLICY; |
| 147 | 0 | } else if (FAIL_ON_INACTIVE_GROUP.name.equalsIgnoreCase(name)) { |
| 148 | 0 | return FAIL_ON_INACTIVE_GROUP; |
| 149 | 0 | } else if(REGENERATE_ACTION_REQUESTS_ON_CHANGE.name.equalsIgnoreCase(name)) { |
| 150 | 0 | return REGENERATE_ACTION_REQUESTS_ON_CHANGE; |
| 151 | } else { | |
| 152 | 0 | throw new IllegalArgumentException("Invalid Document type policy: '" + name + "'"); |
| 153 | } | |
| 154 | } | |
| 155 | } |