Source Code Cross Referenced for ClassificationRulesBean.java in  » Portal » Open-Portal » com » sun » portal » admin » console » search » 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 » Portal » Open Portal » com.sun.portal.admin.console.search 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright 2005 Sun Microsystems, Inc. All
003:         * rights reserved. Use of this product is subject
004:         * to license terms. Federal Acquisitions:
005:         * Commercial Software -- Government Users
006:         * Subject to Standard License Terms and
007:         * Conditions.
008:         *
009:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010:         * are trademarks or registered trademarks of Sun Microsystems,
011:         * Inc. in the United States and other countries.
012:         */package com.sun.portal.admin.console.search;
013:
014:        import java.util.*;
015:        import java.util.logging.Level;
016:        import java.io.*;
017:
018:        import javax.faces.context.FacesContext;
019:        import javax.faces.el.ValueBinding;
020:        import javax.servlet.http.HttpServletRequest;
021:        import javax.management.*;
022:
023:        import com.sun.data.provider.*;
024:        import com.sun.data.provider.impl.ListDataProvider;
025:        import com.sun.data.provider.impl.ObjectListDataProvider;
026:
027:        import com.sun.web.ui.model.*;
028:        import com.sun.web.ui.event.*;
029:        import com.sun.web.ui.component.*;
030:
031:        import com.sun.portal.admin.common.util.AdminClientUtil;
032:        import com.sun.portal.admin.console.common.PSBaseBean;
033:
034:        public class ClassificationRulesBean extends PSBaseBean {
035:
036:            private DataProvider rules = null;
037:
038:            private TableRowGroup tableRowGroup = null;
039:            private TableSelectPhaseListener tspl = null;
040:            private ArrayList classlist = null;
041:
042:            public ClassificationRulesBean() {
043:
044:                tspl = new TableSelectPhaseListener();
045:                rules = generateClassificationRules();
046:            }
047:
048:            /*
049:             * Button Actions
050:             */
051:            public String create() {
052:                return "gotoCreateClassificationRule";
053:            }
054:
055:            public String delete() {
056:                ArrayList ids = new ArrayList();
057:                ObjectListDataProvider oldp = (ObjectListDataProvider) rules;
058:                List l = oldp.getList();
059:                RowKey[] rowKeys = tableRowGroup.getRenderedRowKeys();
060:                for (int i = 0; i < rowKeys.length; i++) {
061:                    RowKey rowKey = rowKeys[i];
062:                    if (tspl.isSelected(rowKey)) {
063:                        ClassificationRuleBean crb = (ClassificationRuleBean) l
064:                                .get(Integer.parseInt(rowKey.getRowId()));
065:                        ids.add(crb.ruleId);
066:                        oldp.removeRow(rowKey);
067:                    }
068:                }
069:                oldp.commitChanges();
070:                tspl.clear();
071:
072:                try {
073:                    LinkedList path = new LinkedList();
074:                    path.addFirst(AdminClientUtil.DEFAULT_DOMAIN);
075:                    path
076:                            .addFirst((String) getSessionAttribute("search.server.selected"));
077:                    path.addFirst("category");
078:                    ObjectName on = AdminClientUtil.getResourceMBeanObjectName(
079:                            AdminClientUtil.SEARCH_CATEGORY_MBEAN_TYPE, path);
080:
081:                    Object[] params0 = {};
082:                    String[] signature0 = {};
083:
084:                    Boolean result = (Boolean) getMBeanServerConnection()
085:                            .invoke(on, "syncClassConfig", params0, signature0);
086:
087:                    Object[] params = { ids };
088:                    String[] signature = { "java.util.ArrayList" };
089:                    getMBeanServerConnection().invoke(on, "deleteClassRules",
090:                            params, signature);
091:                } catch (Exception e) {
092:                    log(
093:                            Level.SEVERE,
094:                            "ClassificationRulesBean.delete() failed to delete classification rules",
095:                            e);
096:                }
097:
098:                rules = generateClassificationRules();
099:                return "gotoClassificationRulesHome";
100:            }
101:
102:            public String edit() {
103:                ObjectListDataProvider oldp = (ObjectListDataProvider) rules;
104:                List l = oldp.getList();
105:                String id = null;
106:                RowKey[] rowKeys = tableRowGroup.getRenderedRowKeys();
107:                for (int i = 0; i < rowKeys.length; i++) {
108:                    RowKey rowKey = rowKeys[i];
109:                    if (tspl.isSelected(rowKey)) {
110:                        ClassificationRuleBean crb = (ClassificationRuleBean) l
111:                                .get(Integer.parseInt(rowKey.getRowId()));
112:                        id = crb.ruleId;
113:                        setSessionAttribute(
114:                                "robot.classificationrule.selected", id);
115:                        break;
116:                    }
117:                }
118:                if (id != null) {
119:                    tspl.clear();
120:                    return "gotoEditClassificationRule";
121:                } else {
122:                    tspl.clear();
123:                    return "gotoClassificationRulesHome";
124:                }
125:
126:            }
127:
128:            /*
129:             * Methods to Get and Set Bean elements
130:             */
131:            public DataProvider getRules() {
132:                return rules;
133:            }
134:
135:            public void setRules(DataProvider rules) {
136:                this .rules = rules;
137:            }
138:
139:            public TableRowGroup getTableRowGroup() {
140:                return tableRowGroup;
141:            }
142:
143:            public void setTableRowGroup(TableRowGroup tableRowGroup) {
144:                this .tableRowGroup = tableRowGroup;
145:            }
146:
147:            public Object getSelected() {
148:                return tspl.getSelected(getTableRow());
149:            }
150:
151:            public void setSelected(Object object) {
152:                tspl.setSelected(getTableRow(), object);
153:            }
154:
155:            /*
156:             * Private Methods
157:             */
158:            private String getLocalizedString(String key) {
159:                return super .getLocalizedString("search", key);
160:            }
161:
162:            private ArrayList getStringList(String s) {
163:
164:                ArrayList s_list = new ArrayList();
165:                StringTokenizer st = new StringTokenizer(s, ",");
166:                while (st.hasMoreTokens()) {
167:                    String label = st.nextToken();
168:                    s_list.add(label);
169:                }
170:                return s_list;
171:            }
172:
173:            private RowKey getTableRow() {
174:                FacesContext context = FacesContext.getCurrentInstance();
175:                ValueBinding vb = context.getApplication().createValueBinding(
176:                        "#{classificationRule.tableRow}");
177:                return (RowKey) vb.getValue(context);
178:            }
179:
180:            private DataProvider generateClassificationRules() {
181:
182:                try {
183:                    LinkedList path = new LinkedList();
184:                    path.addFirst(AdminClientUtil.DEFAULT_DOMAIN);
185:                    path
186:                            .addFirst((String) getSessionAttribute("search.server.selected"));
187:                    path.addFirst("category");
188:                    ObjectName on = AdminClientUtil.getResourceMBeanObjectName(
189:                            AdminClientUtil.SEARCH_CATEGORY_MBEAN_TYPE, path);
190:
191:                    Object[] params0 = {};
192:                    String[] signature0 = {};
193:
194:                    Boolean result = (Boolean) getMBeanServerConnection()
195:                            .invoke(on, "syncClassConfig", params0, signature0);
196:
197:                    Object[] params = { "" };
198:                    String[] signature = { "java.lang.String" };
199:
200:                    classlist = (ArrayList) getMBeanServerConnection().invoke(
201:                            on, "listClassRules", params, signature);
202:
203:                } catch (Exception e) {
204:                    log(
205:                            Level.SEVERE,
206:                            "ClassificationRulesBean.generateClassificationRules() failed to get classification rules",
207:                            e);
208:                }
209:
210:                ArrayList al = new ArrayList();
211:
212:                if (classlist != null && classlist.size() > 0) {
213:                    for (int i = 0; i < classlist.size(); i++) {
214:                        HashMap rule = (HashMap) classlist.get(i);
215:                        String ruleId = Integer.toString(i);
216:                        String source = (String) rule.get("Source");
217:                        String method = (String) rule.get("Method");
218:                        String criterion = (String) rule.get("Criterion");
219:                        String classification = (String) rule
220:                                .get("Classification");
221:                        Boolean caseSensitive = (Boolean) rule
222:                                .get("CaseSensitive");
223:                        al.add(new ClassificationRuleBean(ruleId, source,
224:                                method, criterion, classification,
225:                                caseSensitive));
226:                    } // end of for
227:                }
228:
229:                return new ObjectListDataProvider(al);
230:            }
231:
232:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.