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.lang.*;
016:
017: public class ScheduleBean {
018:
019: public String dayOfTheWeek = null;
020: public String hour = null;
021: public String minute = null;
022: public String meridiem = null;
023:
024: public void initialize(String schedule) {
025: if (schedule.equals("")) {
026: this .dayOfTheWeek = "";
027: this .hour = "";
028: this .minute = "";
029: this .meridiem = "";
030: } else {
031: String[] split1 = schedule.split("@");
032: this .dayOfTheWeek = split1[0];
033: String time = split1[1];
034: String[] split2 = time.split(":");
035: this .hour = split2[0];
036: this .minute = split2[1];
037: if (Integer.parseInt(this .hour) > 11) {
038: this .hour = new Integer(
039: Integer.parseInt(this .hour) - 12).toString();
040: this .meridiem = "pm";
041: } else {
042: this .meridiem = "am";
043: }
044: }
045: }
046:
047: public String getDayOfTheWeek() {
048: return dayOfTheWeek;
049: }
050:
051: public void setDayOfTheWeek(String dayOfTheWeek) {
052: this .dayOfTheWeek = dayOfTheWeek;
053: }
054:
055: public String getHour() {
056: return hour;
057: }
058:
059: public void setHour(String hour) {
060: this .hour = hour;
061: }
062:
063: public String getMinute() {
064: return minute;
065: }
066:
067: public void setMinute(String minute) {
068: this .minute = minute;
069: }
070:
071: public String getMeridiem() {
072: return meridiem;
073: }
074:
075: public void setMeridiem(String meridiem) {
076: this .meridiem = meridiem;
077: }
078:
079: public boolean initialized() {
080: if (dayOfTheWeek == null || dayOfTheWeek.equals("")) {
081: return false;
082: }
083: if (hour == null || hour.equals("")) {
084: return false;
085: }
086: if (minute == null || minute.equals("")) {
087: return false;
088: }
089: if (meridiem == null || meridiem.equals("")) {
090: return false;
091: }
092: return true;
093: }
094:
095: public String getSchedule(String command) {
096: return command
097: + " | "
098: + dayOfTheWeek
099: + "@"
100: + ((meridiem.equals("pm")) ? new Integer(Integer
101: .parseInt(hour) + 12).toString() : hour) + ":"
102: + minute;
103: }
104:
105: }
|