📄 crontabentrybean.java
字号:
/** * This file is part of the jcrontab package * Copyright (C) 2001-2003 Israel Olalla * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307, USA * * For questions, suggestions: * * iolalla@yahoo.com * */ package org.jcrontab.data;import java.io.PrintWriter;import java.io.Serializable;import java.io.StringWriter;import java.util.Calendar;import java.util.Date;/** CrontabEntryBeans represents each entry into * crontab "DataSource". * This Bean allows Jcrontab to interact with * the information from CrontabEntry * @author $Author: iolalla $ * @version $Revision: 1.50 $ */public class CrontabEntryBean implements Serializable { private int id = -1; private boolean runInBusinessDays = true; private String seconds = "0"; private String hours = "*"; private String minutes = "*"; private String months = "*"; private String daysOfWeek = "*"; private String daysOfMonth = "*"; private String years = "*"; private Date startDate; private Date endDate; private String className; private String methodName = ""; private String[] extraInfo; private boolean bextraInfo = false; private String description; private boolean[] bHours; private boolean[] bSeconds; private boolean[] bMinutes; private boolean[] bMonths; private boolean[] bDaysOfWeek; private boolean[] bDaysOfMonth; private boolean[] bYears; /** * This is the default constructor */ public CrontabEntryBean() {} /** * This is a copy constructor, maybe in the future if is neded more logic * this could go to the CrontabParser. * @param the original ceb */ public CrontabEntryBean(CrontabEntryBean original) { this.setClassName(original.getClassName()); this.setMethodName(original.getMethodName()); this.setExtraInfo(original.getExtraInfo()); this.setHours(original.getHours()); this.setMinutes(original.getMinutes()); this.setSeconds(original.getSeconds()); this.setMonths(original.getMonths()); this.setDaysOfMonth(original.getDaysOfMonth()); this.setYears(original.getYears()); this.setBHours(original.getBHours()); this.setBMinutes(original.getBMinutes()); this.setBMonths(original.getBMinutes()); this.setBDaysOfWeek(original.getBDaysOfMonth()); this.setBDaysOfMonth(original.getBDaysOfMonth()); this.setBSeconds(original.getBSeconds()); this.setBYears(original.getBYears()); this.setBExtraInfo(original.getBExtraInfo()); this.setDescription(original.getDescription()); this.setBusinessDays(original.getBusinessDays()); this.setStartDate(original.getEndDate()); this.setEndDate(original.getEndDate()); } /** Id setter * @param id this integer identifies the CrontabEntryBean */ public void setId(int id){ this.id = id; } /** ClassName Setter * @param className This is the name of the class to execute */ public void setClassName(String className){ this.className = className; } /** MethodName setter * @param methodName the name of the method to execute */ public void setMethodName(String methodName){ this.methodName = methodName; } /** Extra info setter * @param extraInfo this array represents the parameters passed to the * task */ public void setExtraInfo(String[] extraInfo){ this.extraInfo = extraInfo; this.bextraInfo = true; } /** Hours setter * @param hours The hours to execute the Class, * the values can take are [ * , 2-4 , 2,3,4,5 , 3/5] */ public void setHours(String hours){ this.hours = hours; } /** Minutes setter * @param minutes The minutes to execute the Class, * the values can take are [ * , 2-4 , 2,3,4,5 , 3/5] */ public void setMinutes(String minutes){ this.minutes = minutes; } /** Seconds setter * @param seconds The seconds to execute the Class, * the values can take are [ * , 2-4 , 2,3,4,5 , 3/5] */ public void setSeconds(String seconds){ this.seconds = seconds; } /** Months setter * @param months The Monts to execute the Class, * the values can take are [ * , 2-4 , 2,3,4,5 , 3/5] */ public void setMonths(String months){ this.months = months; } /** Days of Week * @param daysOfWeek The days of the week */ public void setDaysOfWeek(String daysOfWeek){ this.daysOfWeek = daysOfWeek; } /** Days of Month setter * @param daysOfMonth The days of the month */ public void setDaysOfMonth(String daysOfMonth){ this.daysOfMonth = daysOfMonth; } /** Years Setter * @param years to be executed this task */ public void setYears(String years) { this.years = years; } /** Hours setter * @param hours The hours to execute the Class, * the values can take are [ * , 2-4 , 2,3,4,5 , 3/5] */ public void setBHours(boolean[] bHours){ this.bHours = bHours; } /** Minutes setter * @param minutes The minutes to execute the Class, * the values can take are [ * , 2-4 , 2,3,4,5 , 3/5] */ public void setBMinutes(boolean[] bMinutes){ this.bMinutes = bMinutes; } /** Months setter * @param months The Monts to execute the Class, * the values can take are [ * , 2-4 , 2,3,4,5 , 3/5] */ public void setBMonths(boolean[] bMonths){ this.bMonths = bMonths; } /** Days of Week * @param bdaysOfWeek The days of the week */ public void setBDaysOfWeek(boolean[] bDaysOfWeek){ this.bDaysOfWeek = bDaysOfWeek; } /** Days of Month setter * @param bdaysOfMonth The days of the month */ public void setBDaysOfMonth(boolean[] bDaysOfMonth){ this.bDaysOfMonth = bDaysOfMonth; } /** Seconds setter * @param bSeconds Of ecah minute */ public void setBSeconds(boolean[] bSeconds){ this.bSeconds = bSeconds; } /** Years setter * @param bYears Of ecah century */ public void setBYears(boolean[] bYears){ this.bYears = bYears; } /** bextraInfo setter * @param daysOfMonth There are */ public void setBExtraInfo(boolean bextraInfo) { this.bextraInfo = bextraInfo; } /**Description setter * @param description The desciption */ public void setDescription(String description) { this.description = description; } /**runInBusinessDays setter * @param true if shouldRun only in Business Days false otherwise */ public void setBusinessDays(boolean runInBusinessDays) { this.runInBusinessDays = runInBusinessDays; } /**startDate setter * @param the starting date of this Task */ public void setStartDate(Date startDate) { this.startDate = startDate; } /**endDate setter * @param the ending date of this Task */ public void setEndDate(Date endDate) { this.endDate = endDate; } /** Id getter * @return the Id of this CrontabBean */ public int getId(){ return id; } /** Class Name getter * @return the Class's Name of this CrontabBean */ public String getClassName(){ return className; } /** Method Name getter * @return the Method's Name of this CrontabBean */ public String getMethodName(){ return methodName; } /** Extra Info getter * @return the extraInfo of this CrontabBean
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -