Project

General

Profile

1
/**
2
 *  '$RCSfile$'
3
 *    Purpose: A Class that holds the data from the scheduled_job 
4
 *             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
import java.util.HashMap;
32

    
33
import edu.ucsb.nceas.shared.BaseDAO;
34

    
35
public class ScheduledJobDAO extends BaseDAO {
36
	
37
	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

    
43
	private String _name;
44
	private String _triggerName;
45
	private String _groupName;
46
	private String _className;
47
	private Timestamp _startTime;
48
	private int _intervalValue;
49
	private String _intervalUnit;
50
	private HashMap<String, ScheduledJobParamDAO> _jobParams = new HashMap<String, ScheduledJobParamDAO>();
51
	
52
	// get the name
53
	public String getName() {
54
		return _name;
55
	}
56
	
57
	// set the name
58
	public void setName(String name) {
59
		_name = name;
60
	}
61
	
62
	// get the trigger name
63
	public String getTriggerName() {
64
		return _triggerName;
65
	}
66
	
67
	// set the trigger name
68
	public void setTriggerName(String triggerName) {
69
		_triggerName = triggerName;
70
	}
71
	
72
	// get the group name
73
	public String getGroupName() {
74
		return _groupName;
75
	}
76
	
77
	// set the group name
78
	public void setGroupName(String groupName) {
79
		_groupName = groupName;
80
	}
81
	
82
	// get the class name
83
	public String getClassName() {
84
		return _className;
85
	}
86
	
87
	// set the class name
88
	public void setClassName(String className) {
89
		_className = className;
90
	}
91
	
92
	// get the start time
93
	public Timestamp getStartTime() {
94
		return _startTime;
95
	}
96
	
97
	// set the start time
98
	public void setStartTime(Timestamp startTime) {
99
		_startTime = startTime;
100
	}
101
	
102
	// get the interval value
103
	public int getIntervalValue() {
104
		return _intervalValue;
105
	}
106
	
107
	// set the interval value
108
	public void setIntervalValue(int intervalValue) {
109
		_intervalValue = intervalValue;
110
	}
111
	
112
	// get the interval unit
113
	public String getIntervalUnit() {
114
		return _intervalUnit;
115
	}
116
	
117
	// set the interval unit
118
	public void setIntervalUnit(String intervalUnit) {
119
		_intervalUnit = intervalUnit;
120
	}
121
	
122
	// get the job param with the given key
123
	public ScheduledJobParamDAO getJobParam(String key) {
124
		return _jobParams.get(key);
125
	}
126
	
127
	// get all the job params for this job
128
	public HashMap<String, ScheduledJobParamDAO> getAllJobParams() {
129
		return _jobParams;
130
	}
131
	
132
	// add a job param to this job
133
	public void addJobParam(ScheduledJobParamDAO jobParamDAO) {
134
		_jobParams.put(jobParamDAO.getKey(), jobParamDAO);
135
	}
136
}
(4-4/8)