Source Code Cross Referenced for LeadQueueEventProcessor.java in  » ERP-CRM-Financial » SourceTap-CRM » com » sourcetap » sfa » lead » 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 » SourceTap CRM » com.sourcetap.sfa.lead 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * 
003:         * Copyright (c) 2004 SourceTap - www.sourcetap.com
004:         *
005:         *  The contents of this file are subject to the SourceTap Public License 
006:         * ("License"); You may not use this file except in compliance with the 
007:         * License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
008:         * Software distributed under the License is distributed on an  "AS IS"  basis,
009:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
010:         * the specific language governing rights and limitations under the License.
011:         *
012:         * The above copyright notice and this permission notice shall be included
013:         * in all copies or substantial portions of the Software.
014:         *
015:         */
016:
017:        package com.sourcetap.sfa.lead;
018:
019:        import java.sql.Timestamp;
020:        import java.util.Calendar;
021:        import java.util.List;
022:
023:        import org.ofbiz.base.util.Debug;
024:        import org.ofbiz.entity.GenericDelegator;
025:        import org.ofbiz.entity.GenericEntityException;
026:        import org.ofbiz.entity.GenericValue;
027:
028:        import com.sourcetap.sfa.event.DataMatrix;
029:        import com.sourcetap.sfa.event.GenericEventProcessor;
030:        import com.sourcetap.sfa.replication.GenericReplicator;
031:        import com.sourcetap.sfa.util.UserInfo;
032:
033:        /**
034:         * DOCUMENT ME!
035:         *
036:         */
037:        public class LeadQueueEventProcessor extends GenericEventProcessor {
038:            public static final String module = LeadQueueEventProcessor.class
039:                    .getName();
040:
041:            /**
042:             * DOCUMENT ME!
043:             *
044:             * @param userInfo 
045:             * @param delegator 
046:             * @param dataMatrix 
047:             *
048:             * @return 
049:             */
050:            protected int preUpdate(UserInfo userInfo,
051:                    GenericDelegator delegator, DataMatrix dataMatrix) {
052:                Debug.logVerbose("Start", module);
053:
054:                // Just process the first row for now.
055:                GenericValue leadQueueGV = null;
056:                GenericValue partyGV = null;
057:
058:                try {
059:                    leadQueueGV = dataMatrix.getCurrentBuffer()
060:                            .getGenericValue(0, "LeadQueue", true);
061:                    partyGV = dataMatrix.getCurrentBuffer().getGenericValue(0,
062:                            "Party", false);
063:                } catch (GenericEntityException e) {
064:                    Debug.logError(
065:                            "[LeadQueueEventProcessor.preUpdate] Error getting generic value: "
066:                                    + e.toString(), module);
067:
068:                    return STATUS_ERROR;
069:                }
070:
071:                // Set the time stamps.
072:                Timestamp now = new Timestamp(Calendar.getInstance().getTime()
073:                        .getTime());
074:                leadQueueGV.set("modifiedDate", now);
075:
076:                // Store the current user ID in the "modified by" field.
077:                leadQueueGV.set("modifiedBy", userInfo.getPartyId());
078:
079:                return STATUS_CONTINUE;
080:            }
081:
082:            /**
083:             * DOCUMENT ME!
084:             *
085:             * @param userInfo 
086:             * @param delegator 
087:             * @param dataMatrix 
088:             *
089:             * @return 
090:             */
091:            protected int preInsert(UserInfo userInfo,
092:                    GenericDelegator delegator, DataMatrix dataMatrix) {
093:                Debug.logVerbose("preinsert start", module);
094:
095:                // Just process the first row for now.
096:                GenericValue leadQueueGV = null;
097:                GenericValue partyGV = null;
098:
099:                try {
100:                    leadQueueGV = dataMatrix.getCurrentBuffer()
101:                            .getGenericValue(0, "LeadQueue", true);
102:                    partyGV = dataMatrix.getCurrentBuffer().getGenericValue(0,
103:                            "Party", true);
104:                } catch (GenericEntityException e) {
105:                    Debug.logError(
106:                            "[LeadQueueEventProcessor.preInsert] Error getting generic value: "
107:                                    + e.getLocalizedMessage(), module);
108:
109:                    return STATUS_ERROR;
110:                }
111:
112:                // Generate new key for the leadQueue.
113:                String partyId = GenericReplicator.getNextSeqId("Party",
114:                        delegator);
115:                leadQueueGV.set("leadQueueId", partyId);
116:                partyGV.set("partyId", partyId);
117:
118:                // Set the time stamps.
119:                Timestamp now = new Timestamp(Calendar.getInstance().getTime()
120:                        .getTime());
121:                leadQueueGV.set("createdDate", now);
122:                leadQueueGV.set("modifiedDate", now);
123:
124:                // Store the current user ID in the "modified by" field.
125:                leadQueueGV.set("createdBy", userInfo.getPartyId());
126:                leadQueueGV.set("modifiedBy", userInfo.getPartyId());
127:
128:                //Set the account ID if it is empty.  This should only be the case if it is an employee created thru quick create
129:                String accountId = leadQueueGV.getString("accountId");
130:
131:                if ((accountId == null) || accountId.equals("")) {
132:                    leadQueueGV.set("accountId", userInfo.getAccountId());
133:                }
134:
135:                return STATUS_CONTINUE;
136:            }
137:
138:            /**
139:             * DOCUMENT ME!
140:             *
141:             * @param userInfo 
142:             * @param entityNameList 
143:             * @param delegator 
144:             * @param dataMatrix 
145:             *
146:             * @return 
147:             */
148:            protected int postCreate(UserInfo userInfo, List entityNameList,
149:                    GenericDelegator delegator, DataMatrix dataMatrix) {
150:                Debug.logVerbose("postCreate", module);
151:
152:                // Get the empty generic values.
153:                GenericValue leadQueueGV = null;
154:
155:                try {
156:                    leadQueueGV = dataMatrix.getCurrentBuffer()
157:                            .getGenericValue(0, "LeadQueue", true);
158:                } catch (GenericEntityException e) {
159:                    Debug.logError(
160:                            "[ContactEventProcessor.postCreate] Error getting generic value: "
161:                                    + e.toString(), module);
162:
163:                    return STATUS_ERROR;
164:                }
165:
166:                // Set default values on the new record so they will be displayed for the user to see before saving.
167:                // Active Flag
168:                Debug.logVerbose("Setting active flag to true", module);
169:
170:                leadQueueGV.set("activeFlag", new Boolean(true));
171:
172:                // Refresh the cache in the delegator so that dropdowns will show the new leadQueue
173:                delegator.getAndCache().clear();
174:
175:                return STATUS_CONTINUE;
176:            }
177:
178:            /**
179:             * DOCUMENT ME!
180:             *
181:             * @param userInfo 
182:             * @param delegator 
183:             * @param originatingEntityName 
184:             * @param entityGV 
185:             *
186:             * @return 
187:             */
188:            public int deleteAllRelated(UserInfo userInfo,
189:                    GenericDelegator delegator, String originatingEntityName,
190:                    GenericValue entityGV) {
191:                Debug.logVerbose("in deleteAllRelated", module);
192:
193:                int status = STATUS_CONTINUE;
194:
195:                // Delete related Parties.
196:                status = deleteOneRelated(userInfo, delegator, entityGV, "",
197:                        "Party", originatingEntityName,
198:                        new GenericEventProcessor());
199:
200:                if (status != STATUS_CONTINUE) {
201:                    return status;
202:                }
203:
204:                return STATUS_CONTINUE;
205:            }
206:
207:            /*        public SecurityLinkInfo getSecurityLinkInfo(UserInfo userInfo, GenericDelegator delegator)
208:                    {
209:                            return new SecurityLinkInfo( "Account", "accountId", false );
210:                    }
211:             */
212:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.