Source Code Cross Referenced for Oportunity.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.CallableStatement;
037:        import java.sql.Statement;
038:        import java.sql.PreparedStatement;
039:        import java.sql.ResultSet;
040:
041:        import com.knowgate.debug.DebugFile;
042:        import com.knowgate.misc.Gadgets;
043:        import com.knowgate.jdc.JDCConnection;
044:        import com.knowgate.dataobjs.DB;
045:        import com.knowgate.dataobjs.DBBind;
046:        import com.knowgate.dataobjs.DBPersist;
047:
048:        /**
049:         * <p>Sales Oportunity</p>
050:         * @author Sergio Montoro Ten
051:         * @version 1.0
052:         */
053:        public class Oportunity extends DBPersist {
054:
055:            public Oportunity() {
056:                super (DB.k_oportunities, "Oportunity");
057:            }
058:
059:            // ----------------------------------------------------------
060:
061:            /**
062:             * <p>Store Oportunity</p>
063:             * Fields gu_oportunity, dt_modified, tx_contact and tx_company are automatically filled if not given
064:             * @param oConn Database Connection
065:             * @return
066:             * @throws SQLException
067:             */
068:            public boolean store(JDCConnection oConn) throws SQLException {
069:                PreparedStatement oStmt;
070:                ResultSet oRSet;
071:                boolean bRetVal;
072:
073:                if (DebugFile.trace) {
074:                    DebugFile.writeln("Begin Oportunity.store([Connection])");
075:                    DebugFile.incIdent();
076:                }
077:
078:                java.sql.Timestamp dtNow = new java.sql.Timestamp(DBBind
079:                        .getTime());
080:
081:                if (!AllVals.containsKey(DB.gu_oportunity))
082:                    put(DB.gu_oportunity, Gadgets.generateUUID());
083:
084:                replace(DB.dt_modified, dtNow);
085:
086:                if (!AllVals.containsKey(DB.tx_contact)) {
087:                    if (DebugFile.trace)
088:                        DebugFile.writeln("Connection.prepareStatement(SELECT "
089:                                + DB.tx_surname + "," + DB.tx_name + " FROM "
090:                                + DB.k_contacts + " WHERE " + DB.gu_contact
091:                                + "='" + getStringNull(DB.gu_contact, "null")
092:                                + "')");
093:
094:                    oStmt = oConn.prepareStatement("SELECT " + DB.tx_surname
095:                            + "," + DB.tx_name + " FROM " + DB.k_contacts
096:                            + " WHERE " + DB.gu_contact + "=?",
097:                            ResultSet.TYPE_FORWARD_ONLY,
098:                            ResultSet.CONCUR_READ_ONLY);
099:                    oStmt.setObject(1, get(DB.gu_contact), java.sql.Types.CHAR);
100:                    oRSet = oStmt.executeQuery();
101:                    if (oRSet.next())
102:                        put(DB.tx_contact, oRSet.getString(1) + ", "
103:                                + oRSet.getString(2));
104:                    oRSet.close();
105:                    oStmt.close();
106:                }
107:
108:                if (!AllVals.containsKey(DB.tx_company)) {
109:                    if (DebugFile.trace)
110:                        DebugFile.writeln("Connection.prepareStatement(SELECT "
111:                                + DB.nm_legal + " FROM " + DB.k_companies
112:                                + " WHERE " + DB.gu_company + "='"
113:                                + getStringNull(DB.gu_company, "null") + "')");
114:
115:                    oStmt = oConn.prepareStatement("SELECT " + DB.nm_legal
116:                            + " FROM " + DB.k_companies + " WHERE "
117:                            + DB.gu_company + "=?",
118:                            ResultSet.TYPE_FORWARD_ONLY,
119:                            ResultSet.CONCUR_READ_ONLY);
120:                    oStmt.setObject(1, get(DB.gu_company), java.sql.Types.CHAR);
121:                    oRSet = oStmt.executeQuery();
122:                    if (oRSet.next())
123:                        put(DB.tx_company, oRSet.getString(1));
124:                    oRSet.close();
125:                    oStmt.close();
126:                }
127:
128:                bRetVal = super .store(oConn);
129:
130:                if (DebugFile.trace) {
131:                    DebugFile.decIdent();
132:                    DebugFile.writeln("End Oportunity.store() : "
133:                            + String.valueOf(bRetVal));
134:                }
135:
136:                return bRetVal;
137:            } // store
138:
139:            // ----------------------------------------------------------
140:
141:            public boolean delete(JDCConnection oConn) throws SQLException {
142:                return Oportunity.delete(oConn, getString(DB.gu_oportunity));
143:            }
144:
145:            // **********************************************************
146:            // Static Methods
147:
148:            /**
149:             * Delete Oportunity
150:             * Call k_sp_del_oportunity stored procedure
151:             * @param oConn Database Connection
152:             * @param sOportunityGUID GUID of Oportunity to be deleted.
153:             * @throws SQLException
154:             */
155:            public static boolean delete(JDCConnection oConn,
156:                    String sOportunityGUID) throws SQLException {
157:                CallableStatement oCall;
158:                Statement oStmt;
159:                boolean bRetVal;
160:
161:                if (DebugFile.trace) {
162:                    DebugFile.writeln("Begin Oportunity.delete([Connection], "
163:                            + sOportunityGUID + ")");
164:                    DebugFile.incIdent();
165:
166:                }
167:
168:                if (oConn.getDataBaseProduct() == JDCConnection.DBMS_POSTGRESQL) {
169:                    oStmt = oConn.createStatement();
170:
171:                    if (DebugFile.trace)
172:                        DebugFile
173:                                .writeln("Statement.execute(SELECT k_sp_del_oportunity ('"
174:                                        + sOportunityGUID + "'))");
175:
176:                    bRetVal = oStmt.execute("SELECT k_sp_del_oportunity ('"
177:                            + sOportunityGUID + "')");
178:                    oStmt.close();
179:                } else {
180:                    if (DebugFile.trace)
181:                        DebugFile
182:                                .writeln("Connection.prepareCall({ call k_sp_del_oportunity('"
183:                                        + sOportunityGUID + "')})");
184:
185:                    oCall = oConn.prepareCall("{ call k_sp_del_oportunity ('"
186:                            + sOportunityGUID + "')}");
187:                    bRetVal = oCall.execute();
188:                    oCall.close();
189:                }
190:                if (DebugFile.trace) {
191:                    DebugFile.decIdent();
192:                    DebugFile.writeln("End Oportunity.delete() : "
193:                            + String.valueOf(bRetVal));
194:                }
195:
196:                return bRetVal;
197:            }
198:
199:            // **********************************************************
200:            // Constantes Publicas
201:
202:            public static final short ClassId = 92;
203:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.