01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.pdp.rules;
17:
18: import org.kuali.core.document.MaintenanceDocument;
19: import org.kuali.module.chart.rules.MaintenancePreRulesBase;
20: import org.kuali.module.pdp.bo.PayeeAchAccount;
21:
22: public class PayeeAchAccountPreRules extends MaintenancePreRulesBase {
23:
24: protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
25: .getLogger(PayeeAchAccountPreRules.class);
26: private PayeeAchAccount newPayeeAchAccount;
27:
28: private void setupConvenienceObjects(MaintenanceDocument document) {
29: newPayeeAchAccount = (PayeeAchAccount) document
30: .getNewMaintainableObject().getBusinessObject();
31: }
32:
33: protected boolean doCustomPreRules(MaintenanceDocument document) {
34: setupConvenienceObjects(document);
35: blankFields();
36:
37: return true;
38: }
39:
40: // only 1 Payee Id field should be populated, the one chosen in Payee Type Code, the rest from the list should be blank
41: private void blankFields() {
42: String payeeIdTypeCd = newPayeeAchAccount
43: .getPayeeIdentifierTypeCode();
44: if (payeeIdTypeCd != null) {
45: if (payeeIdTypeCd.equals("E")) {
46: newPayeeAchAccount
47: .setPayeeFederalEmployerIdentificationNumber(null);
48: newPayeeAchAccount.setDisbVchrPayeeIdNumber(null);
49: newPayeeAchAccount.setPayeeSocialSecurityNumber(null);
50: newPayeeAchAccount
51: .setVendorHeaderGeneratedIdentifier(null);
52: newPayeeAchAccount
53: .setVendorDetailAssignedIdentifier(null);
54: } else if (payeeIdTypeCd.equals("V")) {
55: newPayeeAchAccount.setPersonUniversalIdentifier(null);
56: newPayeeAchAccount.setDisbVchrPayeeIdNumber(null);
57: newPayeeAchAccount.setPayeeSocialSecurityNumber(null);
58: newPayeeAchAccount
59: .setPayeeFederalEmployerIdentificationNumber(null);
60: } else if (payeeIdTypeCd.equals("F")) {
61: newPayeeAchAccount.setPersonUniversalIdentifier(null);
62: newPayeeAchAccount.setDisbVchrPayeeIdNumber(null);
63: newPayeeAchAccount.setPayeeSocialSecurityNumber(null);
64: newPayeeAchAccount
65: .setVendorHeaderGeneratedIdentifier(null);
66: newPayeeAchAccount
67: .setVendorDetailAssignedIdentifier(null);
68: } else if (payeeIdTypeCd.equals("S")) {
69: newPayeeAchAccount.setPersonUniversalIdentifier(null);
70: newPayeeAchAccount
71: .setPayeeFederalEmployerIdentificationNumber(null);
72: newPayeeAchAccount.setDisbVchrPayeeIdNumber(null);
73: newPayeeAchAccount
74: .setVendorHeaderGeneratedIdentifier(null);
75: newPayeeAchAccount
76: .setVendorDetailAssignedIdentifier(null);
77: } else if (payeeIdTypeCd.equals("P")) {
78: newPayeeAchAccount.setPersonUniversalIdentifier(null);
79: newPayeeAchAccount
80: .setPayeeFederalEmployerIdentificationNumber(null);
81: newPayeeAchAccount.setPayeeSocialSecurityNumber(null);
82: newPayeeAchAccount
83: .setVendorHeaderGeneratedIdentifier(null);
84: newPayeeAchAccount
85: .setVendorDetailAssignedIdentifier(null);
86: }
87: }
88: }
89: }
|