Source Code Cross Referenced for Customer.java in  » Rule-Engine » Mandarax » org » mandarax » examples » crm » domainmodel » 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 » Rule Engine » Mandarax » org.mandarax.examples.crm.domainmodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */
018:        package org.mandarax.examples.crm.domainmodel;
019:
020:        /**
021:         * Represents customers. Note that there are some method to get the turnover.
022:         * These methods are used as functions to build the knowledge base.
023:         * (rules like: if the turnover of a customer in the last 6 month was more than
024:         * 500$ then ..".
025:         * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
026:         * @version 3.4 <7 March 05>
027:         * @since 1.2
028:         */
029:        public class Customer extends BusinessObject {
030:
031:            private int id = 0;
032:            private String firstName = "?";
033:            private String name = "?";
034:            public static Customer ROBERT_MUSIL = new Customer(1, "Robert",
035:                    "Musil");
036:            public static Customer KURT_VONNEGUT = new Customer(2, "Kurt",
037:                    "Vonnegut");
038:            public static Customer GRAHAM_GREENE = new Customer(3, "Graham",
039:                    "Greene");
040:            public static Customer THOMAS_MANN = new Customer(4, "Thomas",
041:                    "Mann");
042:            public static Customer UMBERTO_ECO = new Customer(5, "Umberto",
043:                    "Eco");
044:            public static Customer LUDWIG_WITTGENSTEIN = new Customer(6,
045:                    "Ludwig", "Wittgenstein");
046:            public static Customer[] ALL = { ROBERT_MUSIL, KURT_VONNEGUT,
047:                    GRAHAM_GREENE, THOMAS_MANN, UMBERTO_ECO,
048:                    LUDWIG_WITTGENSTEIN };
049:
050:            /**
051:             * Constructor.
052:             */
053:            public Customer() {
054:                super ();
055:            }
056:
057:            /**
058:             * Constructor.
059:             * @param anId int
060:             * @param aFirstName java.lang.String
061:             * @param aName java.lang.String
062:             */
063:            public Customer(int anId, String aFirstName, String aName) {
064:                super ();
065:
066:                id = anId;
067:                firstName = aFirstName;
068:                name = aName;
069:            }
070:
071:            /**
072:             * Get the first name.
073:             * @return java.lang.String
074:             */
075:            public String getFirstName() {
076:                return firstName;
077:            }
078:
079:            /**
080:             * Get the id.
081:             * @return int
082:             */
083:            public int getId() {
084:                return id;
085:            }
086:
087:            /**
088:             * Set the id.
089:             * @param id the id
090:             */
091:            public void setId(int id) {
092:                this .id = id;
093:            }
094:
095:            /**
096:             * Get the name.
097:             * @return java.lang.String
098:             */
099:            public String getName() {
100:                return name;
101:            }
102:
103:            /**
104:             * Get the turnover during the last months.
105:             * @return double
106:             * @param month int
107:             */
108:            public double getTurnover(int month) {
109:                // WARNING: pure dummy data - would probably be fetched from a DB in a real project (using a GROUP BY query)
110:                // this method is used as JFunction, see Oryx for another flavor of this example that uses SQLFunctions wrapping
111:                // SQL queries on a CUSTOMER_TRANSACTION table    	
112:                if (month > 10) {
113:                    if (id == 1)
114:                        return 80;
115:                    else if (id == 2)
116:                        return 100;
117:                    else if (id == 3)
118:                        return 150;
119:                    else if (id == 4)
120:                        return 220;
121:                    else if (id == 5)
122:                        return 300;
123:                    else if (id == 6)
124:                        return 420;
125:                }
126:                return 1000;
127:            }
128:
129:            /**
130:             * Get the turnover in the last numberOfMonth
131:             * using the kind of payment.
132:             * @return double
133:             * @param month int
134:             * @param kop KindOfPayment
135:             */
136:            public double getTurnover(int month, KindOfPayment kop) {
137:                // WARNING: pure dummy data - would probably be fetched from a DB in a real project (using a GROUP BY query)
138:                // this method is used as JFunction, see Oryx for another flavor of this example that uses SQLFunctions wrapping
139:                // SQL queries on a CUSTOMER_TRANSACTION table    	
140:                if (month > 10) {
141:                    if (id == 1)
142:                        return 50;
143:                    else if (id == 2)
144:                        return 50;
145:                    else if (id == 3)
146:                        return 100;
147:                    else if (id == 4)
148:                        return 220;
149:                    else if (id == 5)
150:                        return 200;
151:                    else if (id == 6)
152:                        return 300;
153:                }
154:                return 1000;
155:            }
156:
157:            /**
158:             * Set the first name.
159:             * @param aFirstName java.lang.String
160:             */
161:            public void setFirstName(String aFirstName) {
162:                firstName = aFirstName;
163:            }
164:
165:            /**
166:             * Set the name.
167:             * @param aName java.lang.String
168:             */
169:            public void setName(String aName) {
170:                name = aName;
171:            }
172:
173:            /**
174:             * COnvert the object to a string.
175:             * @return java.lang.String
176:             */
177:            public String toString() {
178:                return firstName + " " + name;
179:            }
180:
181:            /**
182:             * Compares objects.
183:             * @return boolean
184:             * @param obj java.lang.Object
185:             */
186:            public boolean equals(Object obj) {
187:                return obj != null && (obj instanceof  Customer)
188:                        && ((Customer) obj).id == id;
189:            }
190:
191:            /**
192:             * Get the hash code of the object.
193:             * @return int
194:             */
195:            public int hashCode() {
196:                return id;
197:            }
198:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.