Source Code Cross Referenced for UIDisplayObjectEventProcessor.java in  » ERP-CRM-Financial » SourceTap-CRM » com » sourcetap » sfa » customization » 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.customization 
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.customization;
018:
019:        import java.util.HashMap;
020:        import java.util.Iterator;
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:        import org.ofbiz.entity.model.ModelEntity;
028:
029:        import com.sourcetap.sfa.event.DataMatrix;
030:        import com.sourcetap.sfa.event.GenericEventProcessor;
031:        import com.sourcetap.sfa.util.UserInfo;
032:
033:        /**
034:         * DOCUMENT ME!
035:         *
036:         */
037:        public class UIDisplayObjectEventProcessor extends
038:                GenericEventProcessor {
039:            public static final String module = UIDisplayObjectEventProcessor.class
040:                    .getName();
041:
042:            /**
043:             * DOCUMENT ME!
044:             *
045:             * @param userInfo 
046:             * @param delegator 
047:             * @param dataMatrix 
048:             *
049:             * @return 
050:             */
051:            protected int postUpdate(UserInfo userInfo,
052:                    GenericDelegator delegator, DataMatrix dataMatrix) {
053:
054:                return STATUS_CONTINUE;
055:            }
056:
057:            /**
058:             * DOCUMENT ME!
059:             *
060:             * @param userInfo 
061:             * @param delegator 
062:             * @param dataMatrix 
063:             *
064:             * @return 
065:             */
066:            protected int postInsert(UserInfo userInfo,
067:                    GenericDelegator delegator, DataMatrix dataMatrix) {
068:
069:                // Get the current values.
070:                GenericValue uiDisplayObjectGV = dataMatrix.getCurrentBuffer()
071:                        .getGenericValue(0, 0);
072:                String displayObjectId = uiDisplayObjectGV
073:                        .getString("displayObjectId");
074:                String displayTypeId = uiDisplayObjectGV
075:                        .getString("displayTypeId");
076:
077:                // Get the original values so we can see if this is a copy or a regular insert.
078:                GenericValue uiDisplayObjectgGVOrig = dataMatrix
079:                        .getOriginalBuffer().getGenericValue(0, 0);
080:                String displayObjectIdOrig = uiDisplayObjectgGVOrig
081:                        .getString("displayObjectId");
082:                String displayTypeIdOrig = uiDisplayObjectgGVOrig
083:                        .getString("displayTypeId");
084:
085:                if (displayObjectIdOrig.equals("")
086:                        || (displayObjectIdOrig == null)) {
087:                    // The display object ID was not filled in yet when the screen was displayed last.  This is
088:                    // a regular insert.
089:
090:                    // Insert all the attributes for this display object's display type.
091:                    HashMap uiDisplayAttribFindMap = new HashMap();
092:                    uiDisplayAttribFindMap.put("displayTypeId", displayTypeId);
093:
094:                    try {
095:                        List uiDisplayAttribGVL = delegator.findByAnd(
096:                                "UiDisplayAttrib", uiDisplayAttribFindMap);
097:                        Iterator uiDisplayAttribGVI = uiDisplayAttribGVL
098:                                .iterator();
099:                        ModelEntity uiDisplayObjectAttribME = delegator
100:                                .getModelEntity("UiDisplayObjectAttrib");
101:
102:                        while (uiDisplayAttribGVI.hasNext()) {
103:                            GenericValue uiDisplayAttribGV = (GenericValue) uiDisplayAttribGVI
104:                                    .next();
105:                            String displayAttribId = (uiDisplayAttribGV
106:                                    .getString("displayAttribId") == null) ? ""
107:                                    : uiDisplayAttribGV
108:                                            .getString("displayAttribId");
109:                            String displayAttribName = (uiDisplayAttribGV
110:                                    .getString("name") == null) ? ""
111:                                    : uiDisplayAttribGV.getString("name");
112:                            GenericValue uiDisplayObjectAttribGV = new GenericValue(
113:                                    uiDisplayObjectAttribME);
114:                            uiDisplayObjectAttribGV.setDelegator(delegator);
115:                            uiDisplayObjectAttribGV.set("displayObjectId",
116:                                    displayObjectId);
117:                            uiDisplayObjectAttribGV.set("displayTypeId",
118:                                    displayTypeId);
119:                            uiDisplayObjectAttribGV.set("displayAttribId",
120:                                    displayAttribId);
121:                            uiDisplayObjectAttribGV.set("attributeValue", "");
122:
123:                            delegator.create(uiDisplayObjectAttribGV);
124:                        }
125:                    } catch (GenericEntityException e) {
126:                        Debug
127:                                .logError(
128:                                        "[UIDisplayObjectWebEventProcessor.postInsert] Error looking for display attributes: "
129:                                                + e.getLocalizedMessage(),
130:                                        module);
131:                    }
132:                } else {
133:                    // This is a copy of an existing display object.
134:
135:                    // Copy all the attributes from the original display object.
136:                    HashMap uiDisplayObjectAttribFindMap = new HashMap();
137:                    uiDisplayObjectAttribFindMap.put("displayTypeId",
138:                            displayTypeIdOrig);
139:                    uiDisplayObjectAttribFindMap.put("displayObjectId",
140:                            displayObjectIdOrig);
141:
142:                    try {
143:                        // Get the List of original display object attributes.
144:                        List uiDisplayObjectAttribGVLOrig = delegator
145:                                .findByAnd("UiDisplayObjectAttrib",
146:                                        uiDisplayObjectAttribFindMap);
147:                        Iterator uiDisplayObjectAttribGVIOrig = uiDisplayObjectAttribGVLOrig
148:                                .iterator();
149:                        ModelEntity uiDisplayObjectAttribME = delegator
150:                                .getModelEntity("UiDisplayObjectAttrib");
151:
152:                        while (uiDisplayObjectAttribGVIOrig.hasNext()) {
153:                            GenericValue uiDisplayObjectAttribGVOrig = (GenericValue) uiDisplayObjectAttribGVIOrig
154:                                    .next();
155:                            String displayAttribIdOrig = (uiDisplayObjectAttribGVOrig
156:                                    .getString("displayAttribId") == null) ? ""
157:                                    : uiDisplayObjectAttribGVOrig
158:                                            .getString("displayAttribId");
159:
160:                            // Get values from the original display object attribute.
161:                            String displayAttribValueOrig = (uiDisplayObjectAttribGVOrig
162:                                    .getString("attributeValue") == null) ? ""
163:                                    : uiDisplayObjectAttribGVOrig
164:                                            .getString("attributeValue");
165:
166:                            // Create the new display object attribute using the new display object ID.
167:                            GenericValue uiDisplayObjectAttribGV = new GenericValue(
168:                                    uiDisplayObjectAttribME);
169:                            uiDisplayObjectAttribGV.setDelegator(delegator);
170:                            uiDisplayObjectAttribGV.set("displayObjectId",
171:                                    displayObjectId);
172:                            uiDisplayObjectAttribGV.set("displayTypeId",
173:                                    displayTypeIdOrig);
174:                            uiDisplayObjectAttribGV.set("displayAttribId",
175:                                    displayAttribIdOrig);
176:                            uiDisplayObjectAttribGV.set("attributeValue",
177:                                    displayAttribValueOrig);
178:
179:                            delegator.create(uiDisplayObjectAttribGV);
180:                        }
181:                    } catch (GenericEntityException e) {
182:                        Debug
183:                                .logError(
184:                                        "[UIDisplayObjectWebEventProcessor.postInsert] Error looking for original display object attributes: "
185:                                                + e.getLocalizedMessage(),
186:                                        module);
187:                    }
188:                }
189:
190:                return STATUS_CONTINUE;
191:            }
192:
193:            /**
194:             * DOCUMENT ME!
195:             *
196:             * @param userInfo 
197:             * @param delegator 
198:             * @param originatingEntityName 
199:             * @param entityGV 
200:             *
201:             * @return 
202:             */
203:            public int deleteAllRelated(UserInfo userInfo,
204:                    GenericDelegator delegator, String originatingEntityName,
205:                    GenericValue entityGV) {
206:
207:                int status = STATUS_CONTINUE;
208:
209:                // Delete related display object attributes.
210:                status = deleteOneRelated(userInfo, delegator, entityGV, "",
211:                        "UiDisplayObjectAttrib", originatingEntityName,
212:                        new GenericEventProcessor());
213:
214:                return status;
215:            }
216:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.