Source Code Cross Referenced for OpportunityHelper.java in  » ERP-CRM-Financial » SourceTap-CRM » com » sourcetap » sfa » opportunity » 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.opportunity 
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.opportunity;
018:
019:        import java.util.ArrayList;
020:        import java.util.List;
021:
022:        import org.ofbiz.base.util.UtilMisc;
023:        import org.ofbiz.entity.GenericDelegator;
024:        import org.ofbiz.entity.GenericEntityException;
025:        import org.ofbiz.entity.GenericValue;
026:        import org.ofbiz.entity.condition.EntityCondition;
027:        import org.ofbiz.entity.condition.EntityConditionList;
028:        import org.ofbiz.entity.condition.EntityExpr;
029:        import org.ofbiz.entity.condition.EntityOperator;
030:        import org.ofbiz.entity.model.DynamicViewEntity;
031:        import org.ofbiz.entity.model.ModelKeyMap;
032:
033:        import com.sourcetap.sfa.util.EntityHelper;
034:
035:        /**
036:         * DOCUMENT ME!
037:         *
038:         */
039:        public class OpportunityHelper {
040:            public static final String module = OpportunityHelper.class
041:                    .getName();
042:
043:            /**
044:             * DOCUMENT ME!
045:             *
046:             * @param productId 
047:             * @param delegator 
048:             *
049:             * @return 
050:             *
051:             * @throws GenericEntityException 
052:             */
053:            public static List getProductFeaturesForProduct(String productId,
054:                    GenericDelegator delegator) throws GenericEntityException {
055:
056:                return delegator.findByAnd("ProductFeatureAppl", UtilMisc
057:                        .toMap("productId", productId), null);
058:            }
059:
060:            /**
061:             * DOCUMENT ME!
062:             *
063:             * @param productId 
064:             * @param delegator 
065:             *
066:             * @return 
067:             *
068:             * @throws GenericEntityException 
069:             */
070:            public static List getFeatureTypesForProduct(String productId,
071:                    GenericDelegator delegator) throws GenericEntityException {
072:                List productFeaturesList = getProductFeaturesForProduct(
073:                        productId, delegator);
074:
075:                if ((productFeaturesList != null)
076:                        && (productFeaturesList.size() == 0)) {
077:                    return new ArrayList();
078:                }
079:
080:                GenericValue[] productFeatures = (GenericValue[]) productFeaturesList
081:                        .toArray(new GenericValue[0]);
082:                GenericValue productFeature = null;
083:
084:                DynamicViewEntity dve = EntityHelper.createDynamicViewEntity(
085:                        delegator, "ProductFeatureType");
086:                dve.addMemberEntity("ProductFeature", "ProductFeature");
087:                dve.addViewLink("ProductFeatureType", "ProductFeature",
088:                        Boolean.FALSE, UtilMisc
089:                                .toList(new ModelKeyMap("productFeatureTypeId",
090:                                        "productFeatureTypeId")));
091:                dve.addAlias("ProductFeature", "productFeatureId", null, null,
092:                        null, null, null);
093:
094:                List exprList = new ArrayList();
095:
096:                String feature = "";
097:
098:                for (int i = 0; i < productFeatures.length; i++) {
099:                    productFeature = productFeatures[i];
100:
101:                    if (productFeature != null) {
102:                        feature = productFeature.getString("productFeatureId");
103:
104:                        if (feature != null) {
105:                            exprList.add(new EntityExpr("productFeatureId",
106:                                    EntityOperator.EQUALS, feature));
107:                        }
108:                    }
109:                }
110:
111:                EntityCondition condition = new EntityConditionList(exprList,
112:                        EntityOperator.OR);
113:
114:                List productFeatureTypesList = EntityHelper.findByCondition(
115:                        delegator, dve, condition, null);
116:                GenericValue[] productFeatureTypes = (GenericValue[]) productFeatureTypesList
117:                        .toArray(new GenericValue[0]);
118:                GenericValue productFeatureType = null;
119:                ArrayList featureTypeList = new ArrayList();
120:
121:                for (int i = 0; i < productFeatureTypes.length; i++) {
122:                    productFeatureType = productFeatureTypes[i];
123:
124:                    if ((productFeatureType != null)
125:                            && !featureTypeList.contains(productFeatureType)) {
126:                        featureTypeList.add(productFeatureType);
127:                    }
128:                }
129:
130:                return featureTypeList;
131:            }
132:
133:            /**
134:             * DOCUMENT ME!
135:             *
136:             * @param productId 
137:             * @param productFeatureTypeId 
138:             * @param delegator 
139:             *
140:             * @return 
141:             *
142:             * @throws GenericEntityException 
143:             */
144:            public static String getProductFeatureDescriptionForProduct(
145:                    String productId, String productFeatureTypeId,
146:                    GenericDelegator delegator) throws GenericEntityException {
147:                /*
148:                   select
149:                    product_feature.*
150:                   from
151:                    product_feature, product_feature_appl
152:                   where
153:                    product_feature_appl.product_id = 'GZ-2644' and
154:                    product_feature_appl.product_feature_id = product_feature.product_feature_id and
155:                    product_feature.product_feature_type_id = 'SOFTWARE_FEATURE'
156:                 */
157:                DynamicViewEntity dve = EntityHelper.createDynamicViewEntity(
158:                        delegator, "ProductFeature");
159:                dve.addMemberEntity("ProductFeatureAppl", "ProductFeatureAppl");
160:                dve.addViewLink("ProductFeature", "ProductFeatureAppl",
161:                        Boolean.FALSE, UtilMisc.toList(new ModelKeyMap(
162:                                "productFeatureId", "productFeatureId")));
163:                dve.addAlias("ProductFeatureAppl", "productId", null, null,
164:                        null, null, null);
165:
166:                EntityCondition condition = new EntityConditionList(UtilMisc
167:                        .toList(new EntityExpr("productFeatureTypeId",
168:                                EntityOperator.EQUALS, productFeatureTypeId),
169:                                new EntityExpr("productId",
170:                                        EntityOperator.EQUALS, productId)),
171:                        EntityOperator.AND);
172:
173:                List pfCol = EntityHelper.findByCondition(delegator, dve,
174:                        condition, null);
175:
176:                GenericValue[] pfGvs = (GenericValue[]) pfCol
177:                        .toArray(new GenericValue[0]);
178:
179:                if ((pfGvs == null) || (pfGvs.length <= 0)) {
180:                    return "";
181:                } else {
182:                    return pfGvs[0].getString("description");
183:                }
184:            }
185:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.