Source Code Cross Referenced for UIScreenEventProcessor.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 com.sourcetap.sfa.event.GenericEventProcessor;
020:
021:        import org.ofbiz.entity.*;
022:        import org.ofbiz.entity.model.ModelEntity;
023:
024:        import java.util.*;
025:
026:        /**
027:         * DOCUMENT ME!
028:         *
029:         */
030:        public class UIScreenEventProcessor extends GenericEventProcessor {
031:            private static final boolean DEBUG = false;
032:
033:            // Define function to get all entities (screen section entities) associated with a section.
034:            protected Iterator getUiScreenSectionEntityIterator(
035:                    String sectionId, GenericDelegator delegator)
036:                    throws GenericEntityException {
037:                HashMap uiScreenSectionEntityMap = new HashMap();
038:                uiScreenSectionEntityMap.put("sectionId", sectionId);
039:
040:                ArrayList order = new ArrayList();
041:                order.add("entityId");
042:
043:                List uiScreenSectionEntitys = delegator.findByAnd(
044:                        "UiScreenSectionEntity", uiScreenSectionEntityMap,
045:                        order);
046:
047:                return uiScreenSectionEntitys.iterator();
048:            }
049:
050:            // Define function to get all attributes (screen section infos) associated with a section.
051:            protected Iterator getUiScreenSectionInfoIterator(String sectionId,
052:                    GenericDelegator delegator) throws GenericEntityException {
053:                HashMap uiScreenSectionInfoMap = new HashMap();
054:                uiScreenSectionInfoMap.put("sectionId", sectionId);
055:
056:                ArrayList order = new ArrayList();
057:                order.add("partyId");
058:                order.add("displayOrder");
059:
060:                List uiScreenSectionInfos = delegator.findByAnd(
061:                        "UiScreenSectionInfo", uiScreenSectionInfoMap, order);
062:
063:                return uiScreenSectionInfos.iterator();
064:            }
065:
066:            // Define function to add missing eligible attributes.
067:            public void addMissingAttributes(String sectionId,
068:                    GenericDelegator delegator, String partyId)
069:                    throws GenericEntityException {
070:                ModelEntity uiScreenSectionInfoEntity = delegator
071:                        .getModelEntity("UiScreenSectionInfo");
072:
073:                // Get the entities associated with this screen section.
074:                Iterator uiScreenSectionEntityIterator2 = getUiScreenSectionEntityIterator(
075:                        sectionId, delegator);
076:
077:                // Loop through entities associated with this screen section.
078:                while (uiScreenSectionEntityIterator2.hasNext()) {
079:                    GenericValue uiScreenSectionEntityDetails = (GenericValue) uiScreenSectionEntityIterator2
080:                            .next();
081:
082:                    // Get the attributes associated with this entity.
083:                    HashMap uiAttributeMap = new HashMap();
084:                    uiAttributeMap.put("entityId", uiScreenSectionEntityDetails
085:                            .getString("entityId"));
086:
087:                    List uiAttributes = delegator.findByAnd("UiAttribute",
088:                            uiAttributeMap, null);
089:                    Iterator uiAttributeIterator2 = uiAttributes.iterator();
090:
091:                    // Loop through all eligible attributes for this entity.
092:                    while (uiAttributeIterator2.hasNext()) {
093:                        GenericValue uiAttributeDetails = (GenericValue) uiAttributeIterator2
094:                                .next();
095:                        boolean attributeFound = false;
096:
097:                        // Get the attributes associated with this screen section.
098:                        Iterator uiScreenSectionInfoIterator2 = getUiScreenSectionInfoIterator(
099:                                sectionId, delegator);
100:
101:                        // Loop through the already associated attributes to see if this on is already associated with the section
102:                        // for the specified party ID.
103:                        while (uiScreenSectionInfoIterator2.hasNext()) {
104:                            GenericValue uiScreenSectionInfoDetails = (GenericValue) uiScreenSectionInfoIterator2
105:                                    .next();
106:
107:                            // See if this is a match.
108:                            if (uiScreenSectionInfoDetails.getString(
109:                                    "attributeId")
110:                                    .equals(
111:                                            uiAttributeDetails
112:                                                    .getString("attributeId"))
113:                                    && uiScreenSectionInfoDetails.getString(
114:                                            "partyId").equals(partyId)) {
115:                                // This is a match. We don't need to add this one.
116:                                attributeFound = true;
117:                            }
118:                        }
119:
120:                        // Clear the screen section info iterator so we can loop through it again.
121:                        uiScreenSectionInfoIterator2 = null;
122:
123:                        if (!attributeFound) {
124:                            // This eligible attribute is not associated with the screen section for this party ID.  Add it.
125:                            GenericValue newUiScreenSectionInfoDetails = new GenericValue(
126:                                    uiScreenSectionInfoEntity);
127:                            newUiScreenSectionInfoDetails
128:                                    .setDelegator(delegator);
129:                            newUiScreenSectionInfoDetails.set("sectionId",
130:                                    sectionId);
131:                            newUiScreenSectionInfoDetails.set("partyId",
132:                                    partyId);
133:                            newUiScreenSectionInfoDetails.set(
134:                                    "displayObjectId", uiAttributeDetails
135:                                            .getString("displayObjectId"));
136:                            newUiScreenSectionInfoDetails
137:                                    .set("attributeId", uiAttributeDetails
138:                                            .getString("attributeId"));
139:                            newUiScreenSectionInfoDetails.set("maxLength",
140:                                    uiAttributeDetails.getString("maxLength"));
141:                            newUiScreenSectionInfoDetails
142:                                    .set("isMandatory", uiAttributeDetails
143:                                            .getString("isMandatory"));
144:                            newUiScreenSectionInfoDetails.set("isReadOnly",
145:                                    uiAttributeDetails.getString("isReadOnly"));
146:                            newUiScreenSectionInfoDetails.set("isVisible",
147:                                    uiAttributeDetails.getString("isVisible"));
148:                            newUiScreenSectionInfoDetails.set("isSearchable",
149:                                    uiAttributeDetails
150:                                            .getString("isSearchable"));
151:                            newUiScreenSectionInfoDetails.set("displayOrder",
152:                                    uiAttributeDetails
153:                                            .getString("displayOrder"));
154:                            newUiScreenSectionInfoDetails.set("displayLabel",
155:                                    uiAttributeDetails
156:                                            .getString("displayLabel"));
157:                            newUiScreenSectionInfoDetails.set("displayLength",
158:                                    uiAttributeDetails
159:                                            .getString("displayLength"));
160:                            newUiScreenSectionInfoDetails.set("rowSpan",
161:                                    uiAttributeDetails.getString("rowSpan"));
162:                            newUiScreenSectionInfoDetails.set("colSpan",
163:                                    uiAttributeDetails.getString("colSpan"));
164:                            delegator.create(newUiScreenSectionInfoDetails);
165:                        }
166:                    }
167:                }
168:            }
169:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.