Source Code Cross Referenced for RoleTreeNode.java in  » ERP-CRM-Financial » SourceTap-CRM » com » sourcetap » sfa » ui » 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.ui 
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.ui;
018:
019:        import java.util.ArrayList;
020:        import java.util.HashMap;
021:        import java.util.List;
022:        import java.util.Vector;
023:
024:        import org.ofbiz.entity.GenericDelegator;
025:        import org.ofbiz.entity.GenericEntityException;
026:        import org.ofbiz.entity.GenericValue;
027:        import org.ofbiz.entity.condition.EntityExpr;
028:        import org.ofbiz.entity.condition.EntityOperator;
029:
030:        /**
031:         * DOCUMENT ME!
032:         *
033:         */
034:        public class RoleTreeNode extends BasicTreeNode {
035:            public static final String module = RoleTreeNode.class.getName();
036:
037:            public RoleTreeNode() {
038:                super ();
039:            }
040:
041:            public RoleTreeNode(Object userObject) {
042:                super (userObject);
043:            }
044:
045:            /**
046:             * DOCUMENT ME!
047:             *
048:             * @param delegator 
049:             *
050:             * @return 
051:             *
052:             * @throws GenericEntityException 
053:             * @throws ClassNotFoundException 
054:             * @throws LinkageError 
055:             * @throws ExceptionInInitializerError 
056:             * @throws InstantiationException 
057:             * @throws IllegalAccessException 
058:             */
059:            public static BasicTreeNode createTree(GenericDelegator delegator)
060:                    throws GenericEntityException, ClassNotFoundException,
061:                    LinkageError, ExceptionInInitializerError,
062:                    InstantiationException, IllegalAccessException {
063:                return createTree(delegator, "Role", "roleId", "roleParentId",
064:                        "com.sourcetap.sfa.ui.RoleTreeNode");
065:            }
066:
067:            /**
068:             * DOCUMENT ME!
069:             *
070:             * @param delegator 
071:             * @param accountId 
072:             *
073:             * @return 
074:             *
075:             * @throws GenericEntityException 
076:             * @throws ClassNotFoundException 
077:             * @throws LinkageError 
078:             * @throws ExceptionInInitializerError 
079:             * @throws InstantiationException 
080:             * @throws IllegalAccessException 
081:             */
082:            public static BasicTreeNode createTree(GenericDelegator delegator,
083:                    String accountId) throws GenericEntityException,
084:                    ClassNotFoundException, LinkageError,
085:                    ExceptionInInitializerError, InstantiationException,
086:                    IllegalAccessException {
087:                ArrayList orderBy = new ArrayList();
088:                orderBy.add("roleParentId");
089:
090:                HashMap acctMap = new HashMap();
091:                acctMap.put("accountId", accountId);
092:
093:                List rows = delegator.findByLike("Role", acctMap, orderBy);
094:                GenericValue[] genericValue = (GenericValue[]) rows
095:                        .toArray(new GenericValue[0]);
096:
097:                return createTree(genericValue, "roleId", "roleParentId",
098:                        "com.sourcetap.sfa.ui.RoleTreeNode");
099:            }
100:
101:            /**
102:             * DOCUMENT ME!
103:             *
104:             * @return 
105:             */
106:            public String getDisplayText() {
107:                Object o = getUserObject();
108:
109:                String name = "";
110:                String assignments = "";
111:                String roleId = "";
112:
113:                if (o instanceof  String) {
114:                    name = (String) o;
115:
116:                    if (name.equals("PLACEHOLDER")) {
117:                        name = "";
118:                    }
119:                } else if (o instanceof  GenericValue) {
120:                    GenericValue gv = (GenericValue) o;
121:                    name = (String) gv.get("roleName");
122:                    roleId = (String) gv.get("roleId");
123:
124:                    try {
125:                        GenericDelegator delegator = gv.getDelegator();
126:
127:                        //find contacts for role
128:                        Vector contactFields = new Vector();
129:                        Vector contactValueVector = new Vector();
130:                        Vector contactOps = new Vector();
131:
132:                        contactFields.add(new EntityExpr("roleId",
133:                                EntityOperator.EQUALS, roleId));
134:
135:                        List contacts = delegator.findByAnd("Contact",
136:                                contactFields, null);
137:                        GenericValue[] contactValues = (GenericValue[]) contacts
138:                                .toArray(new GenericValue[0]);
139:
140:                        for (int i = 0; i < contactValues.length; i++) {
141:                            GenericValue contactValue = contactValues[i];
142:                            String firstName = contactValue
143:                                    .getString("firstName");
144:                            String lastName = contactValue
145:                                    .getString("lastName");
146:
147:                            if (assignments.length() > 0) {
148:                                assignments = assignments + "<BR>";
149:                            }
150:
151:                            assignments = assignments + "<nobr>" + firstName
152:                                    + " " + lastName + "</nobr>";
153:                        }
154:                    } catch (Exception e) {
155:                    }
156:                }
157:
158:                String html = "<div align=top><font color=#003399><b><center>"
159:                        + name + "</center></b></div>\n";
160:
161:                if (assignments.length() > 0) {
162:                    html += ("<br><br><font color=#009933><center>"
163:                            + assignments + "</center>");
164:                } else {
165:                    html += "<br><br><font color=#993300><center><i>Unassigned</i></center></font>";
166:                }
167:
168:                // add buttons
169:                html = html
170:                        + "<br><div class=freeFormSectionTitleTable>"
171:                        + "<FORM NAME=TerritoryFormButton STYLE=\"BORDER:0; MARGIN:0; PADDING:0; \" METHOD=post ACTION=territoryEdit TARGET=contentFrame>"
172:                        + "<INPUT TYPE=hidden NAME=roleId VALUE="
173:                        + roleId
174:                        + ">"
175:                        + "<INPUT TYPE=hidden NAME=action VALUE=button>"
176:                        + "<INPUT CLASS=titleBarImageButton TYPE=image NAME=newButton TITLE=\"Create a new record\" SRC=/sfaimages/New24.gif>"
177:                        + "<INPUT CLASS=titleBarImageButton TYPE=image NAME=editButton TITLE=\"Edit the current record\" SRC=/sfaimages/Edit24.gif>"
178:                        + "<INPUT CLASS=titleBarImageButton TYPE=image NAME=deleteButton TITLE=\"Delete the current record\" SRC=/sfaimages/Delete24.gif>"
179:                        + "</FORM></div>";
180:
181:                return html;
182:            }
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.