Source Code Cross Referenced for SalesMan.java in  » Groupware » hipergate » com » knowgate » crm » 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 » Groupware » hipergate » com.knowgate.crm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:          Copyright (C) 2003  Know Gate S.L. All rights reserved.
003:                              C/Oņa, 107 1š2 28050 Madrid (Spain)
004:
005:          Redistribution and use in source and binary forms, with or without
006:          modification, are permitted provided that the following conditions
007:          are met:
008:
009:          1. Redistributions of source code must retain the above copyright
010:             notice, this list of conditions and the following disclaimer.
011:
012:          2. The end-user documentation included with the redistribution,
013:             if any, must include the following acknowledgment:
014:             "This product includes software parts from hipergate
015:             (http://www.hipergate.org/)."
016:             Alternately, this acknowledgment may appear in the software itself,
017:             if and wherever such third-party acknowledgments normally appear.
018:
019:          3. The name hipergate must not be used to endorse or promote products
020:             derived from this software without prior written permission.
021:             Products derived from this software may not be called hipergate,
022:             nor may hipergate appear in their name, without prior written
023:             permission.
024:
025:          This library is distributed in the hope that it will be useful,
026:          but WITHOUT ANY WARRANTY; without even the implied warranty of
027:          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
028:
029:          You should have received a copy of hipergate License with this code;
030:          if not, visit http://www.hipergate.org or mail to info@hipergate.org
031:         */
032:
033:        package com.knowgate.crm;
034:
035:        import java.sql.SQLException;
036:        import java.sql.Statement;
037:        import java.sql.PreparedStatement;
038:        import java.sql.CallableStatement;
039:        import java.sql.ResultSet;
040:
041:        import com.knowgate.debug.DebugFile;
042:        import com.knowgate.jdc.JDCConnection;
043:        import com.knowgate.dataobjs.DB;
044:        import com.knowgate.dataobjs.DBPersist;
045:        import com.knowgate.acl.ACLUser;
046:
047:        /**
048:         * <p>Sales Man</p>
049:         * <p>Copyright: Copyright (c) KnowGate 2003</p>
050:         * @author Sergio Montoro Ten
051:         * @version 2.2
052:         */
053:        public class SalesMan extends DBPersist {
054:
055:            private ACLUser oUser;
056:
057:            public SalesMan() {
058:                super (DB.k_sales_men, "SalesMan");
059:                oUser = null;
060:            }
061:
062:            /**
063:             * Get user for this sales man
064:             * @return ACLUser
065:             */
066:            public ACLUser getUser() {
067:                return oUser;
068:            }
069:
070:            /**
071:             * Load sales man and initialize internal user instance
072:             * @param oConn JDCConnection
073:             * @param PKVals Object[]
074:             * @return boolean
075:             * @throws SQLException
076:             */
077:            public boolean load(JDCConnection oConn, Object[] PKVals)
078:                    throws SQLException {
079:                boolean bRetVal = super .load(oConn, PKVals);
080:                if (bRetVal)
081:                    oUser = new ACLUser(oConn, getString(DB.gu_sales_man));
082:                return bRetVal;
083:            }
084:
085:            /**
086:             * <p>Store sales man</p>
087:             * This method initializes internal user inctance if it was not previously set
088:             * @param oConn JDCConnection
089:             * @return boolean
090:             * @throws SQLException
091:             */
092:            public boolean store(JDCConnection oConn) throws SQLException {
093:                boolean bRetVal = super .store(oConn);
094:                if (oUser == null)
095:                    oUser = new ACLUser(oConn, getString(DB.gu_sales_man));
096:                return bRetVal;
097:            }
098:
099:            /**
100:             * Delete sales man.
101:             * @throws SQLException
102:             */
103:            public boolean delete(JDCConnection oConn) throws SQLException {
104:                return SalesMan.delete(oConn, getString(DB.gu_sales_man));
105:            }
106:
107:            /**
108:             * <p>Delete sales man</p>
109:             * This method calls k_sp_del_sales_man stored procedure
110:             * @param oConn JDCConnection
111:             * @param sSalesManGUID String GUID of sales man to be deleted
112:             * @return boolean
113:             * @throws SQLException
114:             */
115:            public static boolean delete(JDCConnection oConn,
116:                    String sSalesManGUID) throws SQLException {
117:                CallableStatement oCall;
118:                Statement oStmt;
119:                if (DebugFile.trace) {
120:                    DebugFile.writeln("Begin SalesMan.delete([Connection], "
121:                            + sSalesManGUID + ")");
122:                    DebugFile.incIdent();
123:                    DebugFile
124:                            .writeln("Connection.prepareCall({ call k_sp_del_sales_man('"
125:                                    + sSalesManGUID + "')}");
126:                }
127:                switch (oConn.getDataBaseProduct()) {
128:                case JDCConnection.DBMS_POSTGRESQL:
129:                    oStmt = oConn.createStatement();
130:                    oStmt.executeQuery(
131:                            "SELECT k_sp_del_sales_man('" + sSalesManGUID
132:                                    + "')").close();
133:                    oStmt.close();
134:                    oStmt = null;
135:                    break;
136:                default:
137:                    oCall = oConn.prepareCall("{ call k_sp_del_sales_man('"
138:                            + sSalesManGUID + "')}");
139:                    oCall.execute();
140:                    oCall.close();
141:                    oCall = null;
142:                }
143:                if (DebugFile.trace) {
144:                    DebugFile.decIdent();
145:                    DebugFile.writeln("End SalesMan.delete()");
146:                }
147:
148:                return true;
149:            } // delete
150:
151:            /**
152:             * Get whether a user exists as a sales man or not
153:             * @param oConn JDCConnection
154:             * @param sSalesManGUID String sales man GUID
155:             * @return boolean <b>true</b> if a record with gu_sales_man=sSalesManGUID
156:             * exists at table k_sales_men, <b>false</b> otherwise
157:             * @throws SQLException
158:             */
159:            public static boolean exists(JDCConnection oConn,
160:                    String sSalesManGUID) throws SQLException {
161:                PreparedStatement oStmt = oConn
162:                        .prepareStatement("SELECT NULL FROM " + DB.k_sales_men
163:                                + " WHERE " + DB.gu_sales_man + "=?",
164:                                ResultSet.TYPE_FORWARD_ONLY,
165:                                ResultSet.CONCUR_READ_ONLY);
166:                oStmt.setString(1, sSalesManGUID);
167:                ResultSet oRSet = oStmt.executeQuery();
168:                boolean bExists = oRSet.next();
169:                oRSet.close();
170:                oStmt.close();
171:                return bExists;
172:            }
173:
174:            // **********************************************************
175:            // Public Constants
176:
177:            public static final short ClassId = 97;
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.