Source Code Cross Referenced for IBankStatementSource.java in  » ERP-CRM-Financial » jmoney » net » sf » jmoney » 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.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.reconciliation;
024:
025:        import java.util.Collection;
026:        import java.util.Date;
027:        import java.util.HashMap;
028:        import java.util.Map;
029:
030:        import net.sf.jmoney.model2.CurrencyAccount;
031:        import net.sf.jmoney.model2.Entry;
032:        import net.sf.jmoney.model2.PropertyAccessor;
033:        import net.sf.jmoney.model2.Transaction;
034:
035:        import org.eclipse.swt.widgets.Shell;
036:
037:        /**
038:         * An implementation of this interface must be provided by all
039:         * extensions to the net.sf.jmoney.bankstatements extension point.
040:         * 
041:         * @author Nigel Westbury
042:         */
043:        public interface IBankStatementSource {
044:
045:            /**
046:             * @param account
047:             *            the account into which the entries are being imported.
048:             *            Implementations of this method do not generally need to know
049:             *            the account because the entry data are returned in a
050:             *            collection of EntryData objects and it is up to the caller to
051:             *            merge the data into the datastore. However, there are
052:             *            instances where information from the account is needed. For
053:             *            example, knowing the currency of the account may affect the
054:             *            way amounts are interpreted or implementations may add
055:             *            properties to the account objects that affect the import
056:             *            process.
057:             * @return a collection of EntryData objects if entries are available for
058:             *         importing, or null if the user cancelled the operation or if an
059:             *         error occured.
060:             */
061:            Collection<EntryData> importEntries(Shell shell,
062:                    CurrencyAccount account);
063:
064:            class EntryData {
065:                private Date clearedDate = null;
066:                private Date valueDate = null;
067:                private String check = null;
068:                private String memo = null;
069:                private String name = null;
070:                private String payee = null;
071:                private long amount = 0;
072:                private String uniqueId = null;
073:                private Map<PropertyAccessor, Object> propertyMap = new HashMap<PropertyAccessor, Object>();
074:
075:                public void setClearedDate(Date clearedDate) {
076:                    this .clearedDate = clearedDate;
077:                }
078:
079:                public void setValueDate(Date valueDate) {
080:                    this .valueDate = valueDate;
081:                }
082:
083:                public void setCheck(String check) {
084:                    this .check = check;
085:                }
086:
087:                public void setMemo(String memo) {
088:                    this .memo = memo;
089:                }
090:
091:                public void setName(String name) {
092:                    this .name = name;
093:                }
094:
095:                public void setPayee(String payee) {
096:                    this .payee = payee;
097:                }
098:
099:                public void setAmount(long amount) {
100:                    this .amount = amount;
101:                }
102:
103:                public void setUniqueId(String uniqueId) {
104:                    this .uniqueId = uniqueId;
105:                }
106:
107:                public void setProperty(PropertyAccessor propertyAccessor,
108:                        Object value) {
109:                    propertyMap.put(propertyAccessor, value);
110:                }
111:
112:                /**
113:                 * This method is given a transaction with two entries.
114:                 * This method assigns the properties from the bank statement
115:                 * import to the properties in the transaction.
116:                 * <P>
117:                 * Other than the account and memo properties, no properties
118:                 * will have been set in the transaction  before this method
119:                 * is called.
120:                 * 
121:                 * @param transaction
122:                 * @param entry1 the entry in the bank account.  The account
123:                 * 					property will already have been set
124:                 * @param entry2 the other entry, typically an entry in an
125:                 * 					income and expense account
126:                 */
127:                public void assignPropertyValues(Transaction transaction,
128:                        Entry entry1, Entry entry2) {
129:                    if (valueDate == null) {
130:                        transaction.setDate(clearedDate);
131:                        entry1.setValuta(clearedDate);
132:                    } else {
133:                        transaction.setDate(valueDate);
134:                        entry1.setValuta(clearedDate);
135:                    }
136:
137:                    entry1.setCheck(check);
138:                    entry1.setPropertyValue(ReconciliationEntryInfo
139:                            .getUniqueIdAccessor(), uniqueId);
140:
141:                    entry1.setAmount(amount);
142:                    entry2.setAmount(-amount);
143:                }
144:
145:                @Override
146:                public String toString() {
147:                    return "[a:" + amount + ";n:" + name + "]";
148:                }
149:
150:                /**
151:                 * Returns the text that is to be used for pattern matching.
152:                 * The patterns entered by the user are matched against the text
153:                 * returned by this method.
154:                 * 
155:                 * @return the text which may be empty but must never be null
156:                 */
157:                public String getTextToMatch() {
158:                    String text = "";
159:                    if (memo != null) {
160:                        text += "memo=" + memo;
161:                    }
162:                    if (name != null) {
163:                        text += "name=" + name;
164:                    }
165:                    if (payee != null) {
166:                        text += "payee=" + payee;
167:                    }
168:                    return text;
169:                }
170:
171:                public String getName() {
172:                    return name;
173:                }
174:
175:                /**
176:                 * The memo if no patterns match
177:                 */
178:                public String getDefaultMemo() {
179:                    return memo == null ? (name == null ? payee : name) : memo;
180:                }
181:
182:                /**
183:                 * The description if no patterns match
184:                 */
185:                public String getDefaultDescription() {
186:                    return payee == null ? (memo == null ? name : memo) : payee;
187:                }
188:            }
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.