001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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.module.purap;
017:
018: import java.util.ArrayList;
019: import java.util.List;
020:
021: import org.kuali.workflow.KualiWorkflowUtils;
022:
023: /**
024: * Holds Workflow constants for PURAP documents
025: */
026: public class PurapWorkflowConstants {
027:
028: public interface NodeDetails {
029: public String getName();
030:
031: public String getAwaitingStatusCode();
032:
033: public String getDisapprovedStatusCode();
034:
035: public NodeDetails getPreviousNodeDetails();
036:
037: public NodeDetails getNextNodeDetails();
038:
039: public NodeDetails getNodeDetailByName(String name);
040:
041: public int getOrdinal();
042: }
043:
044: // Global
045: public static final String DOC_ADHOC_NODE_NAME = "Adhoc Routing";
046:
047: public static class AssignContractManagerDocument {
048: public static final String WORKFLOW_DOCUMENT_TITLE = "Contract Manager Assignment";
049: public static final String ASSIGN_CONTRACT_DOC_ERROR_COMPLETING_POST_PROCESSING = "Unable to save the contract manager for the following Requisitions: ";
050: }
051:
052: public static class RequisitionDocument {
053: public enum NodeDetailEnum implements NodeDetails {
054: ADHOC_REVIEW(DOC_ADHOC_NODE_NAME, null,
055: PurapConstants.RequisitionStatuses.CANCELLED), CONTENT_REVIEW(
056: "Content Review",
057: PurapConstants.RequisitionStatuses.AWAIT_CONTENT_REVIEW,
058: PurapConstants.RequisitionStatuses.DAPRVD_CONTENT), SUB_ACCOUNT_REVIEW(
059: KualiWorkflowUtils.RouteLevelNames.SUB_ACCOUNT_REVIEW,
060: PurapConstants.RequisitionStatuses.AWAIT_SUB_ACCT_REVIEW,
061: PurapConstants.RequisitionStatuses.DAPRVD_SUB_ACCT), ACCOUNT_REVIEW(
062: KualiWorkflowUtils.RouteLevelNames.ACCOUNT_REVIEW,
063: PurapConstants.RequisitionStatuses.AWAIT_FISCAL_REVIEW,
064: PurapConstants.RequisitionStatuses.DAPRVD_FISCAL), ORG_REVIEW(
065: KualiWorkflowUtils.RouteLevelNames.ORG_REVIEW,
066: PurapConstants.RequisitionStatuses.AWAIT_CHART_REVIEW,
067: PurapConstants.RequisitionStatuses.DAPRVD_CHART), SEPARATION_OF_DUTIES_REVIEW(
068: "Separation of Duties",
069: PurapConstants.RequisitionStatuses.AWAIT_SEP_OF_DUTY_REVIEW,
070: PurapConstants.RequisitionStatuses.DAPRVD_SEP_OF_DUTY), ;
071:
072: private final String name;
073: private final String awaitingStatusCode;
074: private final String disapprovedStatusCode;
075:
076: NodeDetailEnum(String name, String awaitingStatusCode,
077: String disapprovedStatusCode) {
078: this .name = name;
079: this .awaitingStatusCode = awaitingStatusCode;
080: this .disapprovedStatusCode = disapprovedStatusCode;
081: }
082:
083: public String getName() {
084: return name;
085: }
086:
087: public String getAwaitingStatusCode() {
088: return awaitingStatusCode;
089: }
090:
091: public String getDisapprovedStatusCode() {
092: return disapprovedStatusCode;
093: }
094:
095: public NodeDetails getPreviousNodeDetails() {
096: if (this .ordinal() > 0) {
097: return NodeDetailEnum.values()[this .ordinal() - 1];
098: }
099: return null;
100: }
101:
102: public NodeDetails getNextNodeDetails() {
103: if (this .ordinal() < (NodeDetailEnum.values().length - 1)) {
104: return NodeDetailEnum.values()[this .ordinal() + 1];
105: }
106: return null;
107: }
108:
109: public NodeDetails getNodeDetailByName(String name) {
110: return getNodeDetailEnumByName(name);
111: }
112:
113: public static NodeDetails getNodeDetailEnumByName(
114: String name) {
115: for (NodeDetailEnum nodeDetailEnum : NodeDetailEnum
116: .values()) {
117: if (nodeDetailEnum.name.equals(name)) {
118: return nodeDetailEnum;
119: }
120: }
121: return null;
122: }
123:
124: public int getOrdinal() {
125: return this .ordinal();
126: }
127: }
128:
129: }
130:
131: public static class PurchaseOrderDocument {
132: public enum NodeDetailEnum implements NodeDetails {
133: ADHOC_REVIEW(DOC_ADHOC_NODE_NAME, null,
134: PurapConstants.PurchaseOrderStatuses.CANCELLED), INTERNAL_PURCHASING_REVIEW(
135: "Internal Purchasing Review",
136: PurapConstants.PurchaseOrderStatuses.AWAIT_PURCHASING_REVIEW,
137: PurapConstants.PurchaseOrderStatuses.DAPRVD_PURCHASING), CONTRACTS_AND_GRANTS_REVIEW(
138: "Contracts and Grants Review",
139: PurapConstants.PurchaseOrderStatuses.AWAIT_CONTRACTS_GRANTS_REVIEW,
140: PurapConstants.PurchaseOrderStatuses.DAPRVD_CONTRACTS_GRANTS), BUDGET_OFFICE_REVIEW(
141: "Budget Office Review",
142: PurapConstants.PurchaseOrderStatuses.AWAIT_BUDGET_REVIEW,
143: PurapConstants.PurchaseOrderStatuses.DAPRVD_BUDGET), VENDOR_TAX_REVIEW(
144: "Vendor Tax Review",
145: PurapConstants.PurchaseOrderStatuses.AWAIT_TAX_REVIEW,
146: PurapConstants.PurchaseOrderStatuses.DAPRVD_TAX), DOCUMENT_TRANSMISSION(
147: "Document Transmission", null,
148: PurapConstants.PurchaseOrderStatuses.VOID), ;
149:
150: private final String name;
151: private final String awaitingStatusCode;
152: private final String disapprovedStatusCode;
153:
154: NodeDetailEnum(String name, String awaitingStatusCode,
155: String disapprovedStatusCode) {
156: this .name = name;
157: this .awaitingStatusCode = awaitingStatusCode;
158: this .disapprovedStatusCode = disapprovedStatusCode;
159: }
160:
161: public String getName() {
162: return name;
163: }
164:
165: public String getAwaitingStatusCode() {
166: return awaitingStatusCode;
167: }
168:
169: public String getDisapprovedStatusCode() {
170: return disapprovedStatusCode;
171: }
172:
173: public NodeDetails getPreviousNodeDetails() {
174: if (this .ordinal() > 0) {
175: return NodeDetailEnum.values()[this .ordinal() - 1];
176: }
177: return null;
178: }
179:
180: public NodeDetails getNextNodeDetails() {
181: if (this .ordinal() < (NodeDetailEnum.values().length - 1)) {
182: return NodeDetailEnum.values()[this .ordinal() + 1];
183: }
184: return null;
185: }
186:
187: public NodeDetails getNodeDetailByName(String name) {
188: return getNodeDetailEnumByName(name);
189: }
190:
191: public static NodeDetails getNodeDetailEnumByName(
192: String name) {
193: for (NodeDetailEnum nodeDetailEnum : NodeDetailEnum
194: .values()) {
195: if (nodeDetailEnum.name.equals(name)) {
196: return nodeDetailEnum;
197: }
198: }
199: return null;
200: }
201:
202: public int getOrdinal() {
203: return this .ordinal();
204: }
205: }
206: }
207:
208: public static class PaymentRequestDocument {
209: public enum NodeDetailEnum implements NodeDetails {
210: ADHOC_REVIEW(
211: DOC_ADHOC_NODE_NAME,
212: null,
213: PurapConstants.PaymentRequestStatuses.CANCELLED_IN_PROCESS,
214: false), ACCOUNTS_PAYABLE_REVIEW(
215: "Accounts Payable Review",
216: PurapConstants.PaymentRequestStatuses.AWAITING_ACCOUNTS_PAYABLE_REVIEW,
217: PurapConstants.PaymentRequestStatuses.CANCELLED_PRIOR_TO_AP_APPROVAL,
218: false), SUB_ACCOUNT_REVIEW(
219: KualiWorkflowUtils.RouteLevelNames.SUB_ACCOUNT_REVIEW,
220: PurapConstants.PaymentRequestStatuses.AWAITING_SUB_ACCT_MGR_REVIEW,
221: PurapConstants.PaymentRequestStatuses.CANCELLED_POST_AP_APPROVE,
222: false), ACCOUNT_REVIEW(
223: KualiWorkflowUtils.RouteLevelNames.ACCOUNT_REVIEW,
224: PurapConstants.PaymentRequestStatuses.AWAITING_FISCAL_REVIEW,
225: PurapConstants.PaymentRequestStatuses.CANCELLED_POST_AP_APPROVE,
226: true), ORG_REVIEW(
227: KualiWorkflowUtils.RouteLevelNames.ORG_REVIEW,
228: PurapConstants.PaymentRequestStatuses.AWAITING_ORG_REVIEW,
229: PurapConstants.PaymentRequestStatuses.CANCELLED_POST_AP_APPROVE,
230: false), VENDOR_TAX_REVIEW(
231: "Vendor Tax Review",
232: PurapConstants.PaymentRequestStatuses.AWAITING_TAX_REVIEW,
233: PurapConstants.PaymentRequestStatuses.CANCELLED_POST_AP_APPROVE,
234: false), ;
235:
236: private final String name;
237: private final String awaitingStatusCode;
238: private final String disapprovedStatusCode;
239: private final boolean correctingGeneralLedgerEntriesRequired;
240:
241: NodeDetailEnum(String name, String awaitingStatusCode,
242: String disapprovedStatusCode,
243: boolean correctingGeneralLedgerEntriesRequired) {
244: this .name = name;
245: this .awaitingStatusCode = awaitingStatusCode;
246: this .disapprovedStatusCode = disapprovedStatusCode;
247: this .correctingGeneralLedgerEntriesRequired = correctingGeneralLedgerEntriesRequired;
248: }
249:
250: public String getName() {
251: return name;
252: }
253:
254: public String getAwaitingStatusCode() {
255: return awaitingStatusCode;
256: }
257:
258: public String getDisapprovedStatusCode() {
259: return disapprovedStatusCode;
260: }
261:
262: public boolean isCorrectingGeneralLedgerEntriesRequired() {
263: return correctingGeneralLedgerEntriesRequired;
264: }
265:
266: public NodeDetails getPreviousNodeDetails() {
267: if (this .ordinal() > 0) {
268: return NodeDetailEnum.values()[this .ordinal() - 1];
269: }
270: return null;
271: }
272:
273: public NodeDetails getNextNodeDetails() {
274: if (this .ordinal() < (NodeDetailEnum.values().length - 1)) {
275: return NodeDetailEnum.values()[this .ordinal() + 1];
276: }
277: return null;
278: }
279:
280: public NodeDetails getNodeDetailByName(String name) {
281: return getNodeDetailEnumByName(name);
282: }
283:
284: public static NodeDetails getNodeDetailEnumByName(
285: String name) {
286: for (NodeDetailEnum nodeDetailEnum : NodeDetailEnum
287: .values()) {
288: if (nodeDetailEnum.name.equals(name)) {
289: return nodeDetailEnum;
290: }
291: }
292: return null;
293: }
294:
295: public static List<String> getNodesRequiringCorrectingGeneralLedgerEntries() {
296: List<String> returnEnumNames = new ArrayList<String>();
297: for (NodeDetailEnum currentEnum : NodeDetailEnum
298: .values()) {
299: if (currentEnum
300: .isCorrectingGeneralLedgerEntriesRequired()) {
301: returnEnumNames.add(currentEnum.getName());
302: }
303: }
304: return returnEnumNames;
305: }
306:
307: public int getOrdinal() {
308: return this .ordinal();
309: }
310: }
311: }
312:
313: public static class CreditMemoDocument {
314: public enum NodeDetailEnum implements NodeDetails {
315: ADHOC_REVIEW(
316: DOC_ADHOC_NODE_NAME,
317: null,
318: PurapConstants.PaymentRequestStatuses.CANCELLED_IN_PROCESS,
319: false), ACCOUNTS_PAYABLE_REVIEW(
320: "Accounts Payable Review",
321: PurapConstants.CreditMemoStatuses.AWAITING_ACCOUNTS_PAYABLE_REVIEW,
322: PurapConstants.CreditMemoStatuses.CANCELLED_PRIOR_TO_AP_APPROVAL,
323: false), ACCOUNT_REVIEW(
324: KualiWorkflowUtils.RouteLevelNames.ACCOUNT_REVIEW,
325: PurapConstants.CreditMemoStatuses.AWAITING_FISCAL_REVIEW,
326: PurapConstants.CreditMemoStatuses.CANCELLED_POST_AP_APPROVE,
327: false), ;
328:
329: private final String name;
330: private final String awaitingStatusCode;
331: private final String disapprovedStatusCode;
332: private final boolean correctingGeneralLedgerEntriesRequired;
333:
334: NodeDetailEnum(String name, String awaitingStatusCode,
335: String disapprovedStatusCode,
336: boolean correctingGeneralLedgerEntriesRequired) {
337: this .name = name;
338: this .awaitingStatusCode = awaitingStatusCode;
339: this .disapprovedStatusCode = disapprovedStatusCode;
340: this .correctingGeneralLedgerEntriesRequired = correctingGeneralLedgerEntriesRequired;
341: }
342:
343: public String getName() {
344: return name;
345: }
346:
347: public String getAwaitingStatusCode() {
348: return awaitingStatusCode;
349: }
350:
351: public String getDisapprovedStatusCode() {
352: return disapprovedStatusCode;
353: }
354:
355: public boolean isCorrectingGeneralLedgerEntriesRequired() {
356: return correctingGeneralLedgerEntriesRequired;
357: }
358:
359: public NodeDetails getPreviousNodeDetails() {
360: if (this .ordinal() > 0) {
361: return NodeDetailEnum.values()[this .ordinal() - 1];
362: }
363: return null;
364: }
365:
366: public NodeDetails getNextNodeDetails() {
367: if (this .ordinal() < (NodeDetailEnum.values().length - 1)) {
368: return NodeDetailEnum.values()[this .ordinal() + 1];
369: }
370: return null;
371: }
372:
373: public NodeDetails getNodeDetailByName(String name) {
374: return getNodeDetailEnumByName(name);
375: }
376:
377: public static NodeDetails getNodeDetailEnumByName(
378: String name) {
379: for (NodeDetailEnum nodeDetailEnum : NodeDetailEnum
380: .values()) {
381: if (nodeDetailEnum.name.equals(name)) {
382: return nodeDetailEnum;
383: }
384: }
385: return null;
386: }
387:
388: public static List<String> getNodesRequiringCorrectingGeneralLedgerEntries() {
389: List<String> returnEnumNames = new ArrayList<String>();
390: for (NodeDetailEnum currentEnum : NodeDetailEnum
391: .values()) {
392: if (currentEnum
393: .isCorrectingGeneralLedgerEntriesRequired()) {
394: returnEnumNames.add(currentEnum.getName());
395: }
396: }
397: return returnEnumNames;
398: }
399:
400: public int getOrdinal() {
401: return this.ordinal();
402: }
403: }
404: }
405: }
|