⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reportschedule.java

📁 The ability to create groups of reports, and grant users access to reports by group. The ability to
💻 JAVA
字号:
/*
 * Copyright (C) 2003 Erik Swenson - eswenson@opensourcesoft.net
 * 
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 * 
 * This program 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 General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA 02111-1307, USA.
 *  
 */

package org.efs.openreports.objects;

import java.io.Serializable;
import java.util.*;

public class ReportSchedule implements Serializable
{
	public static final int ONCE = 0;
	public static final int DAILY = 1;
	public static final int WEEKLY = 2;
	
	private ReportUser user;
	private Report report;
	private Map reportParameters;
	private Date startDate;		
	private String startHour;
	private String startMinute;
	private String startAmPm;
	private int scheduleType;	
	private int exportType;
	
	private String recipients;
	
	private String scheduleName;
	
	private transient Date nextFireDate;
	
	public ReportSchedule()
	{
		
	}

	public Report getReport()
	{
		return report;
	}

	public void setReport(Report report)
	{
		this.report = report;
	}

	public Map getReportParameters()
	{
		return reportParameters;
	}

	public void setReportParameters(Map reportParameters)
	{
		this.reportParameters = reportParameters;
	}

	public int getScheduleType()
	{
		return scheduleType;
	}
	
	public String getScheduleTypeName()
	{
		switch (scheduleType)
		{
			case ONCE:
				return "Once";
			case DAILY:
				return "Daily";
			case WEEKLY:
				return "Weekly";
			default:
				return "Unknown";
		}		
	}	

	public void setScheduleType(int scheduleType)
	{
		this.scheduleType = scheduleType;
	}

	public Date getStartDate()
	{
		return startDate;
	}

	public void setStartDate(Date startDate)
	{
		this.startDate = startDate;
	}

	public ReportUser getUser()
	{
		return user;
	}

	public void setUser(ReportUser user)
	{
		this.user = user;
	}

	public String getStartAmPm()
	{
		return startAmPm;
	}

	public void setStartAmPm(String startAmPm)
	{
		this.startAmPm = startAmPm;
	}

	public String getStartHour()
	{
		return startHour;
	}

	public void setStartHour(String startHour)
	{
		this.startHour = startHour;
	}
	
	public int getAbsoluteStartHour()
	{
		int hour = Integer.parseInt(startHour);
		
		if (startAmPm.equalsIgnoreCase("PM"))
			hour += 12;
		
		return hour;
	}
	
	public int getDayOfWeek()
	{
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(startDate);
		
		return calendar.get(Calendar.DAY_OF_WEEK);
	}
	

	public String getStartMinute()
	{
		return startMinute;
	}

	public void setStartMinute(String startMinute)
	{
		this.startMinute = startMinute;
	}
	
	public String getScheduleName()
	{
		return scheduleName;
	}
	
	public void setScheduleName(String scheduleName)
	{
		this.scheduleName = scheduleName;
	}
	
	public String getScheduleGroup()
	{
		return String.valueOf(user.getId());
	}
	
	public Date getStartDateTime()
	{
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(startDate);
		
		calendar.set(Calendar.HOUR, Integer.parseInt(startHour));
		calendar.set(Calendar.MINUTE, Integer.parseInt(startMinute));	

		if (startAmPm.equalsIgnoreCase("AM"))
		{
			calendar.set(Calendar.AM_PM, Calendar.AM);
		}
		else
		{
			calendar.set(Calendar.AM_PM, Calendar.PM);
		}
		
		return calendar.getTime();
	}

	public String getRecipients()
	{
		return recipients;
	}

	public void setRecipients(String recipients)
	{
		this.recipients = recipients;
	}
	
	public int getExportType()
	{
		return exportType;
	}

	public void setExportType(int exportType)
	{
		this.exportType = exportType;
	}
	
	public Date getNextFireDate()
	{
		return nextFireDate;
	}
	
	public void setNextFireDate(Date nextFireDate)
	{
		this.nextFireDate = nextFireDate;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -