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


001:        /*
002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
004:         */
005:
006:        package com.sun.portal.search.admin.model;
007:
008:        import java.lang.*;
009:        import java.io.*;
010:        import java.util.*;
011:
012:        import com.sun.portal.search.admin.CSConfig;
013:        import com.sun.portal.search.admin.cli.RunImportAgent;
014:        import com.sun.portal.search.util.SearchConfig;
015:        import com.sun.portal.search.admin.util.Task;
016:        import com.sun.portal.search.admin.util.ScheduleFactory;
017:
018:        import com.iplanet.jato.model.*;
019:
020:        public class ScheduleModel extends DefaultModel implements 
021:                RetrievingModel, UpdatingModel {
022:            public static final String FIELD_NAME = "FieldName";
023:            public static final String FIELD_HOUR = "FieldHour";
024:            public static final String FIELD_MIN = "FieldMin";
025:            public static final String FIELD_COMMAND = "Command";
026:            public static final String FIELD_DIR = "Dir";
027:            public static final String FIELD_SUN = "Sun";
028:            public static final String FIELD_MON = "Mon";
029:            public static final String FIELD_TUE = "Tue";
030:            public static final String FIELD_WED = "Wed";
031:            public static final String FIELD_THU = "Thu";
032:            public static final String FIELD_FRI = "Fri";
033:            public static final String FIELD_SAT = "Sat";
034:            private static final String[] WEEKDAYS_ARRAY = { FIELD_SUN,
035:                    FIELD_MON, FIELD_TUE, FIELD_WED, FIELD_THU, FIELD_FRI,
036:                    FIELD_SAT };
037:
038:            public static final String hourLabel[] = { "00", "01", "02", "03",
039:                    "04", "05", "06", "07", "08", "09", "10", "11", "12", "13",
040:                    "14", "15", "16", "17", "18", "19", "20", "21", "22", "23" };
041:            public static final String hourValues[] = { "0", "1", "2", "3",
042:                    "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14",
043:                    "15", "16", "17", "18", "19", "20", "21", "22", "23" };
044:            public static final String minValues[] = { "00", "10", "20", "30",
045:                    "40", "50" };
046:
047:            protected String name = null;
048:
049:            /**
050:             * @param req The HttpServletRequest object passed to the super class.
051:             * @param rbName The name of the resource bundle.
052:             */
053:            public ScheduleModel() {
054:                super ();
055:            }
056:
057:            public ScheduleModel(String name) {
058:                super (name);
059:            }
060:
061:            public void setName(String name) {
062:                this .name = name;
063:            }
064:
065:            // Model execution methods
066:            ////////////////////////////////////////////////////////////////////////////////
067:
068:            /**
069:             *
070:             *
071:             */
072:            public Object execute(ModelExecutionContext context)
073:                    throws ModelControlException {
074:                String operationName = null;
075:                if (context != null)
076:                    operationName = context.getOperationName();
077:                else
078:                    operationName = ModelExecutionContext.OPERATION_RETRIEVE;
079:
080:                Object result = null;
081:                if (operationName
082:                        .equals(ModelExecutionContext.OPERATION_RETRIEVE)) {
083:                    result = retrieve(context);
084:                }
085:                return result;
086:            }
087:
088:            /**
089:             *
090:             *
091:             */
092:            public Object update(ModelExecutionContext context)
093:                    throws ModelControlException {
094:                Task task = newTaskObject();
095:                //String cmd = (String)getValue(FIELD_COMMAND);
096:                //CSDebug.logln("ScheduleModel.update(" + name + "," + cmd + ")");
097:                task.init(name);
098:                task.setValue(Task.MINUTES, (String) getValue(FIELD_MIN));
099:                task.setValue(Task.HOURS, (String) getValue(FIELD_HOUR));
100:                String dir = (String) getValue(FIELD_DIR);
101:                String d = "";
102:                if (((String) getValue(FIELD_SUN)).compareTo("true") == 0) {
103:                    d = d + "0,";
104:                }
105:                if (((String) getValue(FIELD_MON)).compareTo("true") == 0) {
106:                    d = d + "1,";
107:                }
108:                if (((String) getValue(FIELD_TUE)).compareTo("true") == 0) {
109:                    d = d + "2,";
110:                }
111:                if (((String) getValue(FIELD_WED)).compareTo("true") == 0) {
112:                    d = d + "3,";
113:                }
114:                if (((String) getValue(FIELD_THU)).compareTo("true") == 0) {
115:                    d = d + "4,";
116:                }
117:                if (((String) getValue(FIELD_FRI)).compareTo("true") == 0) {
118:                    d = d + "5,";
119:                }
120:                if (((String) getValue(FIELD_SAT)).compareTo("true") == 0) {
121:                    d = d + "6,";
122:                }
123:                if (d.trim().length() > 0) {
124:                    task.setValue(Task.DAYS_OF_WEEK, d.substring(0,
125:                            d.length() - 1));
126:                    task.Update();
127:                } else {
128:                    task.Remove();
129:                }
130:                return null;
131:            }
132:
133:            /**
134:             *
135:             *
136:             */
137:            public Object retrieve(ModelExecutionContext context)
138:                    throws ModelControlException {
139:                // Perform a dummy retrieve operation. We ignore the
140:                // execution context for now.
141:                clear();
142:                if (name != null) {
143:                    Task task = newTaskObject();
144:                    task.init(name);
145:                    setValue(FIELD_NAME, name);
146:                    //setValue(FIELD_COMMAND, cmd);
147:                    String hrs = task.getValue(Task.HOURS);
148:                    String mins = task.getValue(Task.MINUTES);
149:                    if (hrs != null && mins != null) {
150:                        setValue(FIELD_HOUR, hrs);
151:                        setValue(FIELD_MIN, mins);
152:                    }
153:
154:                    String v = task.getValue(Task.DAYS_OF_WEEK);
155:                    if (v != null) {
156:                        StringTokenizer st = new StringTokenizer(v, ",");
157:                        while (st.hasMoreTokens()) {
158:                            String d = st.nextToken();
159:                            int ndx = Integer.parseInt(d);
160:                            try {
161:                                setValue(WEEKDAYS_ARRAY[ndx], "true");
162:                            } catch (Exception e) {
163:                            }
164:                        }
165:                    }
166:                }
167:                // Nothing useful to return
168:                return null;
169:            }
170:
171:            private Task newTaskObject() {
172:                try {
173:                    return ScheduleFactory.getNewTask();
174:                } catch (Exception e) {
175:                    return null;
176:                }
177:            }
178:
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.