Source Code Cross Referenced for ReconciliationPropagator.java in  » ERP-CRM-Financial » jmoney » net » sf » jmoney » propagators » reconciliation » 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 » jmoney » net.sf.jmoney.propagators.reconciliation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *
003:         *  JMoney - A Personal Finance Manager
004:         *  Copyright (c) 2004 Nigel Westbury <westbury@users.sourceforge.net>
005:         *
006:         *
007:         *  This program is free software; you can redistribute it and/or modify
008:         *  it under the terms of the GNU General Public License as published by
009:         *  the Free Software Foundation; either version 2 of the License, or
010:         *  (at your option) any later version.
011:         *
012:         *  This program is distributed in the hope that it will be useful,
013:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015:         *  GNU General Public License for more details.
016:         *
017:         *  You should have received a copy of the GNU General Public License
018:         *  along with this program; if not, write to the Free Software
019:         *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
020:         *
021:         */
022:
023:        package net.sf.jmoney.propagators.reconciliation;
024:
025:        import net.sf.jmoney.model2.ScalarPropertyAccessor;
026:        import net.sf.jmoney.qif.QIFEntry;
027:        import net.sf.jmoney.reconciliation.ReconciliationEntry;
028:
029:        /**
030:         * This class connects the reconcilation field added by the reconciliation extension
031:         * plugin and the field that the QIF extension imports and exports.
032:         *
033:         * The reconciliation plugin and the QIF plugin are independent.  They could have been
034:         * written by two different developers who did not know about the other's work.
035:         * One chose to store the state as an integer (0, 1, or 2) and the other chose to store
036:         * the state as a character (' ', '*', or 'C').  An propagator like this one must then be
037:         * written by a developer who is aware of the two plugins.  This propagator connects the two
038:         * properties so when one plugin makes a change to its property, the value of the other
039:         * plugin's property is changed to match.
040:         * 
041:         * In any propagator class any number of propertyChange methods may be declared.
042:         *
043:         * @author  Nigel
044:         */
045:        public class ReconciliationPropagator {
046:
047:            public static void propertyChange(ScalarPropertyAccessor property,
048:                    ReconciliationEntry sourceReconciliationEntry,
049:                    QIFEntry destinationQifEntry) {
050:                if (property.getLocalName().equals("status")) {
051:                    if (sourceReconciliationEntry.getStatement() == null) {
052:                        if (destinationQifEntry.getReconcilingState() == 'C') {
053:                            destinationQifEntry.setReconcilingState(' ');
054:                        }
055:                    } else {
056:                        destinationQifEntry.setReconcilingState('C');
057:                    }
058:                }
059:            }
060:
061:            public static void propertyChange(ScalarPropertyAccessor property,
062:                    QIFEntry sourceQifEntry,
063:                    ReconciliationEntry destinationReconciliationEntry) {
064:                if (property.getLocalName().equals("reconcilingState")) {
065:                    switch (sourceQifEntry.getReconcilingState()) {
066:                    case ' ':
067:                        destinationReconciliationEntry
068:                                .setStatus(ReconciliationEntry.UNCLEARED);
069:                        destinationReconciliationEntry.setStatement(null);
070:                        break;
071:                    case '*':
072:                        destinationReconciliationEntry
073:                                .setStatus(ReconciliationEntry.RECONCILING);
074:                        // Don't change the statement.
075:                        break;
076:                    case 'C':
077:                        destinationReconciliationEntry
078:                                .setStatus(ReconciliationEntry.CLEARED);
079:                        /*
080:                         * We have no way of knowing what statement this entry should
081:                         * be reconciled to, so we leave it as not yet reconciled to
082:                         * any statement.
083:                         */
084:                        break;
085:                    }
086:                }
087:            }
088:
089:            /**
090:             * This is an alternative form.  This form avoids the need to switch on the
091:             * property name.  For a given source and destination pair, there can be either a
092:             * propertyChange method or there can be methods of the 'change...' pattern but
093:             * there cannot be both.  Note also that not all properties need a 'change...' method
094:             * or need to be processed by the propertyChange method.
095:             *        
096:             public static void changeStatus(ReconciliationEntry source, QIFEntryExtension destination) {
097:             switch (sourceReconciliationEntry.getStatus()) {
098:             case ReconciliationEntry.UNCLEARED:
099:             destinationQifEntry.setReconcilingState(' ');
100:             break;
101:             case ReconciliationEntry.RECONCILING:
102:             destinationQifEntry.setReconcilingState('*');
103:             break;
104:             case ReconciliationEntry.CLEARED:
105:             destinationQifEntry.setReconcilingState('C');
106:             break;
107:             }
108:             }
109:             */
110:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.