Source Code Cross Referenced for SubAccountPreRules.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » chart » rules » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Kuali Financial System » org.kuali.module.chart.rules 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006-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.chart.rules;
017:
018:        import org.apache.commons.lang.StringUtils;
019:        import org.kuali.core.bo.user.UniversalUser;
020:        import org.kuali.core.document.MaintenanceDocument;
021:        import org.kuali.core.document.authorization.MaintenanceDocumentAuthorizations;
022:        import org.kuali.core.document.authorization.MaintenanceDocumentAuthorizer;
023:        import org.kuali.core.util.GlobalVariables;
024:        import org.kuali.core.util.ObjectUtils;
025:        import org.kuali.kfs.KFSConstants;
026:        import org.kuali.module.chart.bo.A21SubAccount;
027:        import org.kuali.module.chart.bo.Account;
028:        import org.kuali.module.chart.bo.SubAccount;
029:
030:        /**
031:         * PreRules checks for the {@link SubAccount} that needs to occur while still in the Struts processing. This includes defaults, confirmations,
032:         * etc.
033:         */
034:        public class SubAccountPreRules extends MaintenancePreRulesBase {
035:
036:            private SubAccount newSubAccount;
037:
038:            // private SubAccount copyAccount;
039:
040:            public SubAccountPreRules() {
041:
042:            }
043:
044:            /**
045:             * This checks to see if a continuation account is necessary and then copies the ICR data from the Account 
046:             * associated with this SubAccount (if necessary)
047:             * @see org.kuali.module.chart.rules.MaintenancePreRulesBase#doCustomPreRules(org.kuali.core.document.MaintenanceDocument)
048:             */
049:            protected boolean doCustomPreRules(MaintenanceDocument document) {
050:                setupConvenienceObjects(document);
051:                checkForContinuationAccounts(document
052:                        .getNewMaintainableObject().getMaintenanceAction()); // run this first to avoid side
053:                // effects
054:
055:                LOG
056:                        .debug("done with continuation account, proceeeding with remaining pre rules");
057:
058:                copyICRFromAccount(document);
059:
060:                return true;
061:            }
062:
063:            /**
064:             * 
065:             * This looks for the SubAccount's account number and then sets the values to the continuation account value if it exists
066:             * @param maintenanceAction
067:             */
068:            private void checkForContinuationAccounts(String maintenanceAction) {
069:                LOG.debug("entering checkForContinuationAccounts()");
070:
071:                /*
072:                 * KULCOA-734 - The check for continuation account for main Account Number on sub-account has been modified to only occur
073:                 * for a New and Copy Action. This cannot happen on an Edit as the primary key will change.
074:                 */
075:                if (KFSConstants.MAINTENANCE_NEW_ACTION
076:                        .equals(maintenanceAction)
077:                        || KFSConstants.MAINTENANCE_COPY_ACTION
078:                                .equals(maintenanceAction)) {
079:
080:                    if (StringUtils
081:                            .isNotBlank(newSubAccount.getAccountNumber())) {
082:                        Account account = checkForContinuationAccount(
083:                                "Account Number", newSubAccount
084:                                        .getChartOfAccountsCode(),
085:                                newSubAccount.getAccountNumber(), "");
086:                        if (ObjectUtils.isNotNull(account)) { // override old user inputs
087:                            newSubAccount.setAccountNumber(account
088:                                    .getAccountNumber());
089:                            newSubAccount.setChartOfAccountsCode(account
090:                                    .getChartOfAccountsCode());
091:                        }
092:                    }
093:                }
094:            }
095:
096:            /**
097:             * This method sets the convenience objects like newSubAccount, so you have short and easy handles to the new and
098:             * old objects contained in the maintenance document. It also calls the BusinessObjectBase.refresh(), which will attempt to load
099:             * all sub-objects from the DB by their primary keys, if available.
100:             * @param document
101:             */
102:            private void setupConvenienceObjects(MaintenanceDocument document) {
103:
104:                // setup newAccount convenience objects, make sure all possible sub-objects are populated
105:                newSubAccount = (SubAccount) document
106:                        .getNewMaintainableObject().getBusinessObject();
107:                // copyAccount = (SubAccount) ObjectUtils.deepCopy(newAccount);
108:                // copyAccount.refresh();
109:            }
110:
111:            /**
112:             * 
113:             * This copies the Indirect Cost Rate (ICR) from the account if the SubAccount is a specific type - determined 
114:             * as "EX" from {@link SubAccountRule#CG_A21_TYPE_ICR}
115:             * <p>
116:             * If it is "EX" it will then copy over the ICR information from the Account specified for this SubAccount
117:             * @param document
118:             */
119:            private void copyICRFromAccount(MaintenanceDocument document) {
120:                UniversalUser user = GlobalVariables.getUserSession()
121:                        .getUniversalUser();
122:
123:                // get the correct documentAuthorizer for this document
124:                MaintenanceDocumentAuthorizer documentAuthorizer = (MaintenanceDocumentAuthorizer) getDocumentAuthorizationService()
125:                        .getDocumentAuthorizer(document);
126:
127:                // get a new instance of MaintenanceDocumentAuthorizations for this context
128:                MaintenanceDocumentAuthorizations auths = documentAuthorizer
129:                        .getFieldAuthorizations(document, user);
130:
131:                // don't need to copy if the user does not have the authority to edit the fields
132:                if (!auths.getAuthFieldAuthorization(
133:                        "a21SubAccount.financialIcrSeriesIdentifier")
134:                        .isReadOnly()) {
135:                    // only need to do this of the account sub type is EX
136:                    A21SubAccount a21SubAccount = newSubAccount
137:                            .getA21SubAccount();
138:                    Account account = newSubAccount.getAccount();
139:                    if (SubAccountRule.CG_A21_TYPE_ICR.equals(a21SubAccount
140:                            .getSubAccountTypeCode())) {
141:                        if (account == null
142:                                || StringUtils.isBlank(account
143:                                        .getAccountNumber())) {
144:                            account = getAccountService().getByPrimaryId(
145:                                    newSubAccount.getChartOfAccountsCode(),
146:                                    newSubAccount.getAccountNumber());
147:                            if (ObjectUtils.isNotNull(account)) {
148:                                if (StringUtils
149:                                        .isBlank(a21SubAccount
150:                                                .getIndirectCostRecoveryAccountNumber())) {
151:                                    a21SubAccount
152:                                            .setIndirectCostRecoveryAccountNumber(account
153:                                                    .getIndirectCostRecoveryAcctNbr());
154:                                    a21SubAccount
155:                                            .setIndirectCostRecoveryChartOfAccountsCode(account
156:                                                    .getIndirectCostRcvyFinCoaCode());
157:                                }
158:                                if (StringUtils.isBlank(a21SubAccount
159:                                        .getFinancialIcrSeriesIdentifier())) {
160:                                    a21SubAccount
161:                                            .setFinancialIcrSeriesIdentifier(account
162:                                                    .getFinancialIcrSeriesIdentifier());
163:                                    a21SubAccount.setOffCampusCode(account
164:                                            .isAccountOffCampusIndicator());
165:                                }
166:                                if (StringUtils.isBlank(a21SubAccount
167:                                        .getIndirectCostRecoveryTypeCode())) {
168:                                    a21SubAccount
169:                                            .setIndirectCostRecoveryTypeCode(account
170:                                                    .getAcctIndirectCostRcvyTypeCd());
171:                                }
172:                            }
173:                        }
174:                    }
175:                }
176:            }
177:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.