Project

General

Profile

1 4951 daigle
/**
2
 *  '$RCSfile$'
3 4971 daigle
 *    Purpose: A Class that holds the data from the scheduled_job
4 4951 daigle
 *             table in the database.
5
 *  Copyright: 2009 Regents of the University of California and the
6
 *             National Center for Ecological Analysis and Synthesis
7
 *    Authors: Michael Daigle
8
 *
9
 *   '$Author: daigle $'
10
 *     '$Date: 2009-03-23 13:56:56 -0800 (Mon, 23 Mar 2009) $'
11
 * '$Revision: 4854 $'
12
 *
13
 * This program is free software; you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation; either version 2 of the License, or
16
 * (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
 */
27
28
package edu.ucsb.nceas.metacat.scheduler;
29
30
import java.sql.Timestamp;
31 4959 daigle
import java.util.HashMap;
32 4951 daigle
33 5015 daigle
import edu.ucsb.nceas.metacat.shared.BaseDAO;
34 4951 daigle
35
public class ScheduledJobDAO extends BaseDAO {
36
37 4971 daigle
	public static String SECONDLY = "s";
38
	public static String MINUTELY = "m";
39
	public static String HOURLY = "h";
40
	public static String DAILY = "d";
41
	public static String WEEKLY = "w";
42 4951 daigle
43
	private String _name;
44
	private String _triggerName;
45
	private String _groupName;
46
	private String _className;
47
	private Timestamp _startTime;
48 5012 daigle
	private Timestamp _endTime;
49 4959 daigle
	private int _intervalValue;
50
	private String _intervalUnit;
51
	private HashMap<String, ScheduledJobParamDAO> _jobParams = new HashMap<String, ScheduledJobParamDAO>();
52 4951 daigle
53 4971 daigle
	// get the name
54 4951 daigle
	public String getName() {
55
		return _name;
56
	}
57
58 4971 daigle
	// set the name
59 4951 daigle
	public void setName(String name) {
60
		_name = name;
61
	}
62
63 4971 daigle
	// get the trigger name
64 4951 daigle
	public String getTriggerName() {
65
		return _triggerName;
66
	}
67
68 4971 daigle
	// set the trigger name
69 4951 daigle
	public void setTriggerName(String triggerName) {
70
		_triggerName = triggerName;
71
	}
72
73 4971 daigle
	// get the group name
74 4951 daigle
	public String getGroupName() {
75
		return _groupName;
76
	}
77
78 4971 daigle
	// set the group name
79 4951 daigle
	public void setGroupName(String groupName) {
80
		_groupName = groupName;
81
	}
82
83 4971 daigle
	// get the class name
84 4951 daigle
	public String getClassName() {
85
		return _className;
86
	}
87
88 4971 daigle
	// set the class name
89 4951 daigle
	public void setClassName(String className) {
90
		_className = className;
91
	}
92
93 4971 daigle
	// get the start time
94 4951 daigle
	public Timestamp getStartTime() {
95
		return _startTime;
96
	}
97
98 4971 daigle
	// set the start time
99 4951 daigle
	public void setStartTime(Timestamp startTime) {
100
		_startTime = startTime;
101
	}
102
103 5012 daigle
	// get the end time
104
	public Timestamp getEndTime() {
105
		return _endTime;
106
	}
107
108
	// set the end time
109
	public void setEndTime(Timestamp endTime) {
110
		_endTime = endTime;
111
	}
112
113 4971 daigle
	// get the interval value
114 4959 daigle
	public int getIntervalValue() {
115
		return _intervalValue;
116 4951 daigle
	}
117
118 4971 daigle
	// set the interval value
119 4959 daigle
	public void setIntervalValue(int intervalValue) {
120
		_intervalValue = intervalValue;
121 4951 daigle
	}
122 4959 daigle
123 4971 daigle
	// get the interval unit
124 4959 daigle
	public String getIntervalUnit() {
125
		return _intervalUnit;
126
	}
127
128 4971 daigle
	// set the interval unit
129 4959 daigle
	public void setIntervalUnit(String intervalUnit) {
130
		_intervalUnit = intervalUnit;
131
	}
132
133 4971 daigle
	// get the job param with the given key
134 4959 daigle
	public ScheduledJobParamDAO getJobParam(String key) {
135
		return _jobParams.get(key);
136
	}
137
138 4971 daigle
	// get all the job params for this job
139 4959 daigle
	public HashMap<String, ScheduledJobParamDAO> getAllJobParams() {
140
		return _jobParams;
141
	}
142
143 4971 daigle
	// add a job param to this job
144 4959 daigle
	public void addJobParam(ScheduledJobParamDAO jobParamDAO) {
145
		_jobParams.put(jobParamDAO.getKey(), jobParamDAO);
146
	}
147 4951 daigle
}