Source Code Cross Referenced for PartyIdentifierSelectEP.java in  » ERP-CRM-Financial » SourceTap-CRM » com » sourcetap » sfa » party » 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.party 
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.party;
018:
019:        import java.util.ArrayList;
020:        import java.util.Iterator;
021:        import java.util.List;
022:        import java.util.Map;
023:        import java.util.Vector;
024:
025:        import org.ofbiz.base.util.Debug;
026:        import org.ofbiz.base.util.UtilMisc;
027:        import org.ofbiz.entity.GenericDelegator;
028:        import org.ofbiz.entity.GenericEntityException;
029:        import org.ofbiz.entity.GenericValue;
030:        import org.ofbiz.entity.condition.EntityConditionList;
031:        import org.ofbiz.entity.condition.EntityExpr;
032:        import org.ofbiz.entity.condition.EntityOperator;
033:        import org.ofbiz.entity.model.ModelEntity;
034:
035:        import com.sourcetap.sfa.event.GenericEventProcessor;
036:        import com.sourcetap.sfa.ui.UIScreenSectionEntity;
037:        import com.sourcetap.sfa.util.QueryInfo;
038:        import com.sourcetap.sfa.util.UserInfo;
039:
040:        /**
041:         * DOCUMENT ME!
042:         *
043:         */
044:        public class PartyIdentifierSelectEP extends GenericEventProcessor {
045:            private static final boolean DEBUG = false;
046:
047:            /**
048:             * replace the CodeValue and CodeId Maps in the removerKeyMapList and createKeyMapList  with identifierId
049:             *
050:             * @param userInfo 
051:             * @param delegator 
052:             * @param primaryModelEntity 
053:             * @param removeKeyMapList 
054:             * @param createKeyMapList 
055:             *
056:             * @return 
057:             */
058:            protected int preUpdateSelect(UserInfo userInfo,
059:                    GenericDelegator delegator, ModelEntity primaryModelEntity,
060:                    ArrayList removeKeyMapList, ArrayList createKeyMapList) {
061:                replaceCodeTableMap(removeKeyMapList);
062:                replaceCodeTableMap(createKeyMapList);
063:                return STATUS_CONTINUE;
064:            }
065:
066:            private void replaceCodeTableMap(List keyMapList) {
067:                if (keyMapList == null)
068:                    return;
069:                Iterator iter = keyMapList.iterator();
070:                while (iter.hasNext()) {
071:                    Map keyMap = (Map) iter.next();
072:
073:                    String codeTypeId = (String) keyMap.get("codeTypeId");
074:                    String codeId = (String) keyMap.get("codeId");
075:
076:                    if ((codeTypeId != null) && (codeTypeId.length() > 0)) {
077:                        keyMap.remove("codeTypeId");
078:                        keyMap.remove("codeId");
079:                        keyMap.put("identifierId", codeId);
080:                    }
081:
082:                }
083:            }
084:
085:            /**
086:             * Add entity clauses for one related entity.  This will join related tables to the query
087:             * during a retrieve so query values can be entered that are in related entities.
088:             * <P>
089:             * This version overrides the ancestor to handle the AccountIdentifier to Code relationship, which
090:             * has no relation defined.
091:             *
092:             * @param delegator Reference to the OFBIZ delegator being used to connect to the data base
093:             * @param relationTitle Relation title
094:             * @param relatedEntityName Name of related entity
095:             * @param primaryEntityName Name of the primary entity
096:             * @param primaryME ModelEntity object for the primary entity
097:             * @param queryInfo critera to be used in search.
098:             */
099:            public void addOneRelationClause(GenericDelegator delegator,
100:                    String relationTitle, String relatedAndFields,
101:                    String relatedEntityName, String primaryEntityName,
102:                    ModelEntity primaryME, boolean isOuterJoin,
103:                    QueryInfo queryInfo) throws GenericEntityException {
104:
105:                if (relatedEntityName.equals("Code")) {
106:                    // Adding entity clauses for the Address entity.  Need to build it manually.
107:                    // Join the address owner ID field
108:
109:                    queryInfo.addJoin("PartyIdentifier", "Code", Boolean
110:                            .valueOf(isOuterJoin), "identifierId", "codeId");
111:
112:                    if (isOuterJoin) {
113:                        queryInfo.addAlias("Code", "codeTypeId", "codeTypeId");
114:                        queryInfo.addAlias("Code", "codeId", "codeId");
115:                        queryInfo
116:                                .addCondition(new EntityConditionList(UtilMisc
117:                                        .toList(new EntityExpr("codeTypeId",
118:                                                EntityOperator.EQUALS,
119:                                                "IDENTIFIER_TYPE"),
120:                                                new EntityExpr("codeId",
121:                                                        EntityOperator.EQUALS,
122:                                                        null)),
123:                                        EntityOperator.OR));
124:                    } else
125:                        queryInfo.addCondition("Code", "codeTypeId",
126:                                EntityOperator.EQUALS, "IDENTIFIER_TYPE");
127:
128:                } else {
129:                    // Use the parent script for all other related entities.
130:                    super .addOneRelationClause(delegator, relationTitle,
131:                            relatedAndFields, relatedEntityName,
132:                            primaryEntityName, primaryME, isOuterJoin,
133:                            queryInfo);
134:                }
135:            }
136:
137:            /**
138:             * DOCUMENT ME!
139:             *
140:             * @param mainGV 
141:             * @param relatedSearchClause 
142:             * @param outGVV 
143:             * @param userInfo 
144:             * @param delegator 
145:             *
146:             * @return 
147:             */
148:            protected GenericValue retrieveOneRelatedGV(GenericValue mainGV,
149:                    UIScreenSectionEntity relatedSearchClause, Vector outGVV,
150:                    UserInfo userInfo, GenericDelegator delegator) {
151:
152:                String relationRelEntityName = (String) relatedSearchClause
153:                        .getEntityName();
154:
155:                if (relationRelEntityName.equals("Code")) {
156:                    // Special processing for the Code record since it can't be retrieved with a relationship
157:                    // defined in the sfa-config.xml file.
158:
159:                    // Get account ID from the account record.
160:                    String identifierId = mainGV.getString("identifierId");
161:
162:                    GenericValue codeGV = null;
163:
164:                    try {
165:                        codeGV = delegator.findByPrimaryKey("Code", UtilMisc
166:                                .toMap("codeTypeId", "IDENTIFIER_TYPE",
167:                                        "codeId", identifierId));
168:
169:                        return codeGV;
170:                    } catch (GenericEntityException e) {
171:                        Debug
172:                                .logError(
173:                                        "[retrieveOneRelatedGV] An error occurred while searching for "
174:                                                + "the Identifier Code record for the partyIdentifier: "
175:                                                + e.getLocalizedMessage(),
176:                                        module);
177:
178:                        return codeGV;
179:                    }
180:                } else {
181:                    // Retrieve all other related entities the regular way.
182:                    return super.retrieveOneRelatedGV(mainGV,
183:                            relatedSearchClause, outGVV, userInfo, delegator);
184:                }
185:            }
186:
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.