Source Code Cross Referenced for UIEntityEventProcessor.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.Iterator;
020:
021:        import org.ofbiz.base.util.Debug;
022:        import org.ofbiz.entity.GenericDelegator;
023:        import org.ofbiz.entity.GenericEntityException;
024:        import org.ofbiz.entity.GenericValue;
025:        import org.ofbiz.entity.model.ModelEntity;
026:        import org.ofbiz.entity.model.ModelField;
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.StringHelper;
032:        import com.sourcetap.sfa.util.UserInfo;
033:
034:        /**
035:         * DOCUMENT ME!
036:         *
037:         */
038:        public class UIEntityEventProcessor extends GenericEventProcessor {
039:            public static final String module = UIEntityEventProcessor.class
040:                    .getName();
041:
042:            private static String displayObjectText20 = "1";
043:            private static String displayObjectText60 = "2";
044:            private static String displayObjectDateTime = "17";
045:            private static String displayObjectDate = "18";
046:            private static String displayObjectTime = "19";
047:            private static String displayObjectCheckbox = "41";
048:            private static String displayObjectCurrency = "25";
049:            private static String displayObjectNumber = "26";
050:            private static String displayObjectSelectUser = "21";
051:            private static String displayObjectText255 = "34";
052:            private static String displayObjectTextArea = "55";
053:
054:            /**
055:             * Create the default UIAttribute values by copying from fields from the Table Definition
056:             *
057:             * @param userInfo 
058:             * @param delegator 
059:             * @param dataMatrix 
060:             *
061:             * @return 
062:             */
063:            protected int postInsert(UserInfo userInfo,
064:                    GenericDelegator delegator, DataMatrix dataMatrix) {
065:
066:                // Get the current values.
067:                GenericValue uiEntityGV = dataMatrix.getCurrentBuffer()
068:                        .getGenericValue(0, 0);
069:                String entityId = uiEntityGV.getString("entityId");
070:                String entityName = uiEntityGV.getString("entityName");
071:
072:                if ((entityId == null) || (entityName == null))
073:                    return STATUS_CONTINUE;
074:
075:                ModelEntity me = delegator.getModelEntity(entityName);
076:                if (me == null)
077:                    return STATUS_CONTINUE;
078:
079:                ModelEntity uiAttributeME = delegator
080:                        .getModelEntity("UiAttribute");
081:
082:                Iterator fieldI = me.getFieldsIterator();
083:                int displayOrder = 0;
084:
085:                while (fieldI.hasNext()) {
086:                    ModelField fld = (ModelField) fieldI.next();
087:
088:                    String attrName = fld.getName();
089:                    String colName = fld.getName();
090:                    String type = fld.getType();
091:                    boolean isPK = fld.getIsPk();
092:
093:                    String displayType = "";
094:                    String maxLength = "20";
095:                    String editMask = "";
096:                    String displayLogic = "";
097:                    boolean isMandatory = fld.getIsPk();
098:                    boolean isReadOnly = false;
099:                    boolean isVisible = true;
100:                    boolean isSearchable = true;
101:                    boolean isExtension = false;
102:                    displayOrder += 10;
103:                    String displayLabel = StringHelper
104:                            .javaNameToDescription(attrName);
105:                    int colSpan = 1;
106:                    int rowSpan = 1;
107:                    boolean startOnNewRow = false;
108:                    String displayObjectId = "0";
109:
110:                    if (attrName.equals("createdBy")
111:                            || attrName.equals("modifiedBy")) {
112:                        displayObjectId = displayObjectSelectUser;
113:                        maxLength = "60";
114:
115:                    } else if (type.equals("date-time")) {
116:                        displayObjectId = displayObjectDateTime;
117:                    } else if (type.equals("time")) {
118:                        displayObjectId = displayObjectTime;
119:                    } else if (type.equals("date")) {
120:                        displayObjectId = displayObjectDate;
121:                    } else if (type.equals("currency-amount")) {
122:                        displayObjectId = displayObjectCurrency;
123:                    } else if (type.equals("floating-point")
124:                            || type.equals("numeric")) {
125:                        displayObjectId = displayObjectNumber;
126:                    } else if (type.equals("id") || type.equals("id-ne")) {
127:                        displayObjectId = displayObjectText20;
128:                    } else if (type.equals("id-long")
129:                            || type.equals("short-varchar")
130:                            || type.equals("id-long-ne")
131:                            || type.equals("tel-number")) {
132:                        displayObjectId = displayObjectText60;
133:                        maxLength = "60";
134:                    } else if (type.equals("id-vlong")
135:                            || type.equals("long-varchar")
136:                            || type.equals("comment")
137:                            || type.equals("description")
138:                            || type.equals("value") || type.equals("email")
139:                            || type.equals("url") || type.equals("id-vlong-ne")) {
140:                        displayObjectId = displayObjectText255;
141:                        maxLength = "255";
142:                    } else if (type.equals("very-short")) {
143:                        displayObjectId = displayObjectText20;
144:                        maxLength = "10";
145:                    } else if (type.equals("indicator")) {
146:                        displayObjectId = displayObjectCheckbox;
147:                        maxLength = "1";
148:                    } else if (type.equals("very-long")) {
149:                        displayObjectId = displayObjectTextArea;
150:                        maxLength = "1000";
151:                    } else if (type.equals("name")) {
152:                        displayObjectId = displayObjectText60;
153:                        maxLength = "100";
154:                    } else {
155:                        displayObjectId = displayObjectText20;
156:                        maxLength = "20";
157:                    }
158:
159:                    if (type.equals("id-ne") || type.equals("id-long-ne")
160:                            || type.equals("id-vlong-ne")) {
161:                        isMandatory = true;
162:                    }
163:
164:                    String attributeId = GenericReplicator.getNextSeqId(
165:                            "UiAttribute", delegator);
166:
167:                    GenericValue uiAttributeGV = new GenericValue(uiAttributeME);
168:                    uiAttributeGV.setDelegator(delegator);
169:                    uiAttributeGV.set("attributeId", attributeId);
170:                    uiAttributeGV.set("entityId", entityId);
171:                    uiAttributeGV.set("attributeName", attrName);
172:                    uiAttributeGV.set("description", displayLabel);
173:                    uiAttributeGV.set("columnName", colName);
174:                    uiAttributeGV.set("displayObjectId", displayObjectId);
175:                    uiAttributeGV.set("maxLength", maxLength);
176:                    uiAttributeGV.set("editMask", "");
177:                    uiAttributeGV.set("displayLogic", "");
178:                    uiAttributeGV.set("isMandatory", Boolean
179:                            .valueOf(isMandatory));
180:                    uiAttributeGV
181:                            .set("isReadOnly", Boolean.valueOf(isReadOnly));
182:                    uiAttributeGV.set("isVisible", Boolean.valueOf(isVisible));
183:                    uiAttributeGV.set("isSearchable", Boolean
184:                            .valueOf(isSearchable));
185:                    uiAttributeGV.set("isExtension", Boolean
186:                            .valueOf(isExtension));
187:                    uiAttributeGV
188:                            .set("displayOrder", new Integer(displayOrder));
189:                    uiAttributeGV.set("displayLabel", displayLabel);
190:                    uiAttributeGV.set("displayLength", maxLength);
191:                    uiAttributeGV.set("colSpan", new Integer(colSpan));
192:                    uiAttributeGV.set("rowSpan", new Integer(rowSpan));
193:                    uiAttributeGV.set("startOnNewRow", Boolean
194:                            .valueOf(startOnNewRow));
195:
196:                    // This is a copy of an existing screen section.
197:
198:                    try {
199:                        delegator.create(uiAttributeGV);
200:                    } catch (GenericEntityException e) {
201:                        Debug.logError(e, module);
202:                    }
203:                }
204:
205:                return STATUS_CONTINUE;
206:            }
207:
208:            /**
209:             * DOCUMENT ME!
210:             *
211:             * @param userInfo 
212:             * @param delegator 
213:             * @param originatingEntityName 
214:             * @param entityGV 
215:             *
216:             * @return 
217:             */
218:            public int deleteAllRelated(UserInfo userInfo,
219:                    GenericDelegator delegator, String originatingEntityName,
220:                    GenericValue entityGV) {
221:
222:                int status = STATUS_CONTINUE;
223:
224:                // Delete related screen section entities.
225:                status = deleteOneRelated(userInfo, delegator, entityGV, "",
226:                        "UiAttribute", originatingEntityName,
227:                        new GenericEventProcessor());
228:
229:                return status;
230:            }
231:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.