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