Source Code Cross Referenced for CodeHelper.java in  » ERP-CRM-Financial » SourceTap-CRM » com » sourcetap » sfa » code » 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.code 
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.code;
018:
019:        import java.util.ArrayList;
020:        import java.util.HashMap;
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:        /**
029:         * DOCUMENT ME!
030:         *
031:         */
032:        public class CodeHelper {
033:            public static final String module = CodeHelper.class.getName();
034:
035:            /**
036:             * This function gets the code value for a given code type and code ID
037:             * @author  John Nutting
038:             * @param codeTypeId Code Type ID
039:             * @param codeId Code ID
040:             * @param delegator Generic delegator for accessing the database
041:             * @return Code value
042:             */
043:            public static String getCodeValue(String codeTypeId, String codeId,
044:                    GenericDelegator delegator) {
045:                if (codeTypeId == null) {
046:                    Debug.logWarning("Code Type ID is required", module);
047:
048:                    return "";
049:                }
050:
051:                if (codeId == null) {
052:                    Debug.logWarning("Code ID is required", module);
053:
054:                    return "";
055:                }
056:
057:                HashMap codeFindMap = new HashMap();
058:                codeFindMap.put("codeTypeId", codeTypeId);
059:                codeFindMap.put("codeId", codeId);
060:
061:                try {
062:                    GenericValue codeGV = delegator.findByPrimaryKey("Code",
063:                            codeFindMap);
064:
065:                    if (codeGV == null) {
066:                        Debug
067:                                .logWarning(
068:                                        "Code not found for code type ID "
069:                                                + codeTypeId + " and code ID "
070:                                                + codeId, module);
071:
072:                        return "";
073:                    }
074:
075:                    String codeValue = (codeGV.getString("codeValue") == null) ? ""
076:                            : codeGV.getString("codeValue");
077:
078:                    return codeValue;
079:                } catch (Exception e) {
080:                    Debug.logError("Error retrieving code for " + codeTypeId
081:                            + "/" + codeId + ": " + e.getLocalizedMessage(),
082:                            module);
083:                }
084:
085:                return "";
086:            }
087:
088:            /**
089:             * This function gets the codes for a given code type
090:             * @author  John Nutting
091:             * @param codeTypeId Code Type ID
092:             * @param delegator Generic delegator for accessing the database
093:             * @return List of code generic values
094:             */
095:            public static List getCodeGVL(String codeTypeId,
096:                    GenericDelegator delegator) {
097:                if (codeTypeId == null) {
098:                    Debug.logWarning("Code Type ID is required", module);
099:
100:                    return null;
101:                }
102:
103:                // Set default sort order.
104:                ArrayList sort = new ArrayList();
105:                sort.add("codeValue");
106:
107:                return getCodeGVL(codeTypeId, delegator, sort);
108:            }
109:
110:            /**
111:             * This function gets the codes for a given code type
112:             * @author  John Nutting
113:             * @param codeTypeId Code Type ID
114:             * @param delegator Generic delegator for accessing the database
115:             * @param sort Sort order
116:             * @return List of code generic values
117:             */
118:            public static List getCodeGVL(String codeTypeId,
119:                    GenericDelegator delegator, ArrayList sort) {
120:                if (codeTypeId == null) {
121:                    Debug.logWarning("Code Type ID is required", module);
122:
123:                    return null;
124:                }
125:
126:                HashMap codeFindMap = new HashMap();
127:                codeFindMap.put("codeTypeId", codeTypeId);
128:
129:                try {
130:                    return delegator.findByAnd("Code", codeFindMap, sort);
131:                } catch (GenericEntityException e) {
132:                    Debug.logWarning("Error retrieving codes for code type "
133:                            + codeTypeId + ": " + e.getLocalizedMessage(),
134:                            module);
135:                }
136:
137:                return null;
138:            }
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.