Source Code Cross Referenced for BudgetAdjustmentDocumentPreRules.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » financial » 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.financial.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.financial.rules;
017:
018:        import java.util.Map;
019:
020:        import org.kuali.core.authorization.AuthorizationConstants;
021:        import org.kuali.core.bo.user.UniversalUser;
022:        import org.kuali.core.document.Document;
023:        import org.kuali.core.rules.PreRulesContinuationBase;
024:        import org.kuali.core.service.DataDictionaryService;
025:        import org.kuali.core.service.DocumentAuthorizationService;
026:        import org.kuali.core.service.KualiConfigurationService;
027:        import org.kuali.core.util.GlobalVariables;
028:        import org.kuali.kfs.KFSConstants;
029:        import org.kuali.kfs.KFSKeyConstants;
030:        import org.kuali.kfs.context.SpringContext;
031:        import org.kuali.kfs.web.struts.form.KualiAccountingDocumentFormBase;
032:        import org.kuali.module.financial.document.BudgetAdjustmentDocument;
033:        import org.kuali.module.financial.document.authorization.BudgetAdjustmentDocumentAuthorizer;
034:        import org.kuali.module.financial.service.BudgetAdjustmentLaborBenefitsService;
035:
036:        /**
037:         * Checks warnings and prompt conditions for ba document.
038:         */
039:        public class BudgetAdjustmentDocumentPreRules extends
040:                PreRulesContinuationBase {
041:            private KualiConfigurationService kualiConfiguration;
042:
043:            /**
044:             * Execute pre-rules for BudgetAdjustmentDocument
045:             * 
046:             * @document document with pre-rules being applied
047:             * @return true if pre-rules fire without problem
048:             * @see org.kuali.core.rules.PreRulesContinuationBase#doRules(org.kuali.core.document.MaintenanceDocument)
049:             */
050:            public boolean doRules(Document document) {
051:                boolean preRulesOK = true;
052:
053:                BudgetAdjustmentDocument budgetDocument = (BudgetAdjustmentDocument) document;
054:                preRulesOK = askLaborBenefitsGeneration(budgetDocument);
055:
056:                return preRulesOK;
057:            }
058:
059:            /**
060:             * Calls service to determine if any labor object codes are present on the ba document. If so, asks the user if they want the
061:             * system to automatically generate the benefit lines. If Yes, calls service to generate the accounting lines.
062:             * 
063:             * @param budgetDocument submitted budget document
064:             * @return true if labor benefits generation question is NOT asked
065:             */
066:            private boolean askLaborBenefitsGeneration(
067:                    BudgetAdjustmentDocument budgetDocument) {
068:                // before prompting, check the document contains one or more labor object codes
069:                boolean hasLaborObjectCodes = SpringContext.getBean(
070:                        BudgetAdjustmentLaborBenefitsService.class)
071:                        .hasLaborObjectCodes(budgetDocument);
072:
073:                // and check that the user can edit the document
074:                String documentTypeName = SpringContext.getBean(
075:                        DataDictionaryService.class)
076:                        .getDocumentTypeNameByClass(
077:                                BudgetAdjustmentDocument.class);
078:                BudgetAdjustmentDocumentAuthorizer budgetAdjustmentDocumentAuthorizer = (BudgetAdjustmentDocumentAuthorizer) SpringContext
079:                        .getBean(DocumentAuthorizationService.class)
080:                        .getDocumentAuthorizer(documentTypeName);
081:                UniversalUser universalUser = GlobalVariables.getUserSession()
082:                        .getUniversalUser();
083:                Map map = budgetAdjustmentDocumentAuthorizer.getEditMode(
084:                        budgetDocument, universalUser, budgetDocument
085:                                .getSourceAccountingLines(), budgetDocument
086:                                .getTargetAccountingLines());
087:
088:                if (map.containsKey(AuthorizationConstants.EditMode.FULL_ENTRY)
089:                        && hasLaborObjectCodes) {
090:                    String questionText = SpringContext
091:                            .getBean(KualiConfigurationService.class)
092:                            .getPropertyString(
093:                                    KFSKeyConstants.QUESTION_GENERATE_LABOR_BENEFIT_LINES);
094:                    boolean generateBenefits = super 
095:                            .askOrAnalyzeYesNoQuestion(
096:                                    KFSConstants.BudgetAdjustmentDocumentConstants.GENERATE_BENEFITS_QUESTION_ID,
097:                                    questionText);
098:                    if (generateBenefits) {
099:                        SpringContext.getBean(
100:                                BudgetAdjustmentLaborBenefitsService.class)
101:                                .generateLaborBenefitsAccountingLines(
102:                                        budgetDocument);
103:                        // update baselines in form
104:                        ((KualiAccountingDocumentFormBase) form)
105:                                .setBaselineSourceAccountingLines(budgetDocument
106:                                        .getSourceAccountingLines());
107:                        ((KualiAccountingDocumentFormBase) form)
108:                                .setBaselineTargetAccountingLines(budgetDocument
109:                                        .getTargetAccountingLines());
110:
111:                        // return to document after lines are generated
112:                        super .event
113:                                .setActionForwardName(KFSConstants.MAPPING_BASIC);
114:                        return false;
115:                    }
116:                }
117:
118:                return true;
119:            }
120:
121:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.