Source Code Cross Referenced for CashReceiptDocumentAuthorizer.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » financial » document » authorization » 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.document.authorization 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.financial.document.authorization;
017:
018:        import java.util.HashMap;
019:        import java.util.List;
020:        import java.util.Map;
021:
022:        import org.apache.commons.logging.Log;
023:        import org.apache.commons.logging.LogFactory;
024:        import org.kuali.core.bo.user.UniversalUser;
025:        import org.kuali.core.document.Document;
026:        import org.kuali.core.document.TransactionalDocument;
027:        import org.kuali.core.document.authorization.DocumentActionFlags;
028:        import org.kuali.core.document.authorization.TransactionalDocumentActionFlags;
029:        import org.kuali.core.exceptions.DocumentTypeAuthorizationException;
030:        import org.kuali.core.util.Timer;
031:        import org.kuali.kfs.bo.AccountingLine;
032:        import org.kuali.kfs.context.SpringContext;
033:        import org.kuali.kfs.document.authorization.AccountingDocumentAuthorizerBase;
034:        import org.kuali.module.chart.bo.ChartUser;
035:        import org.kuali.module.financial.bo.CashDrawer;
036:        import org.kuali.module.financial.document.CashReceiptDocument;
037:        import org.kuali.module.financial.service.CashDrawerService;
038:        import org.kuali.module.financial.service.CashReceiptService;
039:
040:        /**
041:         * Abstract base class for all TransactionalDocumentAuthorizers, since there's this one bit of common code.
042:         */
043:        public class CashReceiptDocumentAuthorizer extends
044:                AccountingDocumentAuthorizerBase {
045:            private static Log LOG = LogFactory
046:                    .getLog(CashReceiptDocumentAuthorizer.class);
047:
048:            /**
049:             * Overrides to use the parent's implementation, with the exception that if the cash drawer that is associated with this
050:             * document is closed, the CR doc cannot be approved at all.
051:             * 
052:             * @see org.kuali.core.authorization.DocumentAuthorizer#getDocumentActionFlags(org.kuali.core.document.Document,
053:             *      org.kuali.core.bo.user.KualiUser)
054:             */
055:            @Override
056:            public DocumentActionFlags getDocumentActionFlags(
057:                    Document document, UniversalUser user) {
058:                Timer t0 = new Timer("getDocumentActionFlags");
059:                DocumentActionFlags flags = super .getDocumentActionFlags(
060:                        document, user);
061:
062:                // if an approval is requested, check to make sure that the cash drawer is open
063:                // if it's not, then they should not be able to verify the CR document
064:                if (document.getDocumentHeader().getWorkflowDocument()
065:                        .isApprovalRequested()) {
066:                    CashReceiptDocument crd = (CashReceiptDocument) document;
067:
068:                    String unitName = SpringContext.getBean(
069:                            CashReceiptService.class)
070:                            .getCashReceiptVerificationUnitForCampusCode(
071:                                    crd.getCampusLocationCode());
072:                    CashDrawer cd = SpringContext.getBean(
073:                            CashDrawerService.class).getByWorkgroupName(
074:                            unitName, false);
075:                    if (cd == null) {
076:                        throw new IllegalStateException(
077:                                "There is no cash drawer associated with cash receipt: "
078:                                        + crd.getDocumentNumber());
079:                    } else if (cd.isClosed()) {
080:                        flags.setCanBlanketApprove(false);
081:                        flags.setCanApprove(false);
082:                    }
083:                }
084:
085:                TransactionalDocumentActionFlags tflags = (TransactionalDocumentActionFlags) flags;
086:                tflags.setCanErrorCorrect(false); // CR, DV, andd PCDO don't allow error correction
087:
088:                t0.log();
089:                return flags;
090:            }
091:
092:            /**
093:             * Overrides to always return false because there is never FO routing or FO approval for CR docs.
094:             * 
095:             * @see org.kuali.module.financial.document.FinancialDocumentAuthorizer#userOwnsAnyAccountingLine(org.kuali.core.bo.user.KualiUser,
096:             *      java.util.List)
097:             */
098:            @Override
099:            protected boolean userOwnsAnyAccountingLine(ChartUser user,
100:                    List accountingLines) {
101:                return false;
102:            }
103:
104:            /**
105:             * Overrides parent to return an empty Map since FO routing doesn't apply to the CR doc.
106:             * 
107:             * @see org.kuali.core.authorization.TransactionalDocumentAuthorizer#getEditableAccounts(org.kuali.core.document.TransactionalDocument,
108:             *      org.kuali.core.bo.user.KualiUser)
109:             */
110:            @Override
111:            public Map getEditableAccounts(TransactionalDocument document,
112:                    ChartUser user) {
113:                return new HashMap();
114:            }
115:
116:            /**
117:             * Overrides parent to return an empty Map since FO routing doesn't apply to the CR doc.
118:             * 
119:             * @see org.kuali.kfs.document.authorization.AccountingDocumentAuthorizerBase#getEditableAccounts(java.util.List,
120:             *      org.kuali.module.chart.bo.ChartUser)
121:             */
122:            @Override
123:            public Map getEditableAccounts(List<AccountingLine> lines,
124:                    ChartUser user) {
125:                return new HashMap();
126:            }
127:
128:            /**
129:             * CR docs cannot be initiated by users in a verification unit that the CR is associated with. Right now, since there is a
130:             * single verification unit, we only need this to check for exitence in that one.
131:             * 
132:             * @see org.kuali.core.authorization.DocumentAuthorizer#canInitiate(java.lang.String, org.kuali.core.bo.user.KualiUser)
133:             */
134:            @Override
135:            public void canInitiate(String documentTypeName, UniversalUser user) {
136:                boolean authorized = false;
137:                String unitName = SpringContext.getBean(
138:                        CashReceiptService.class)
139:                        .getCashReceiptVerificationUnitForUser(user);
140:                if (unitName != null) {
141:                    authorized = !user.isMember(unitName);
142:                }
143:                if (!authorized) {
144:                    // TODO: customize message indicating the required unitName using DocumentInitiationAuthorizationException
145:                    throw new DocumentTypeAuthorizationException(user
146:                            .getPersonUserIdentifier(), "initiate",
147:                            documentTypeName);
148:                }
149:            }
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.