01: /* ***** BEGIN LICENSE BLOCK *****
02: * Version: MPL 1.1
03: * The contents of this file are subject to the Mozilla Public License Version
04: * 1.1 (the "License"); you may not use this file except in compliance with
05: * the License. You may obtain a copy of the License at
06: * http://www.mozilla.org/MPL/
07: *
08: * Software distributed under the License is distributed on an "AS IS" basis,
09: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10: * for the specific language governing rights and limitations under the
11: * License.
12: *
13: * The Original Code is Riot.
14: *
15: * The Initial Developer of the Original Code is
16: * Neteye GmbH.
17: * Portions created by the Initial Developer are Copyright (C) 2007
18: * the Initial Developer. All Rights Reserved.
19: *
20: * Contributor(s):
21: * Jan-Frederic Linde [jfl at neteye dot de]
22: *
23: * ***** END LICENSE BLOCK ***** */
24: package org.riotfamily.riot.job.context;
25:
26: import org.riotfamily.riot.job.JobContext;
27: import org.riotfamily.riot.job.JobInterruptedException;
28: import org.riotfamily.riot.job.support.JobTask;
29:
30: public class TaskJobContext implements JobContext {
31:
32: private JobTask task;
33:
34: public TaskJobContext(JobTask task) {
35: this .task = task;
36: }
37:
38: /**
39: * Returns the objectId.
40: */
41: public String getObjectId() {
42: return task.getDetail().getObjectId();
43: }
44:
45: /**
46: * Notifies the DAO that a step has been completed.
47: * @throws JobInterruptedException if the job has been interrupted
48: */
49: public void stepCompleted() throws JobInterruptedException {
50: task.stepCompleted();
51: }
52:
53: /**
54: * Logs an info message.
55: */
56: public void logInfo(String message) {
57: task.logInfo(message);
58: }
59:
60: /**
61: * Logs an error message.
62: */
63: public void logError(String message) {
64: task.logError(message);
65: }
66:
67: public void updateDescription(String description) {
68: task.updateDescription(description);
69: }
70:
71: public void updateStepsTotal(int stepsTotal) {
72: task.updateStepsTotal(stepsTotal);
73: }
74:
75: }
|