change version to 3.3.0-SNAPSHOT in cdm-3.3 branch
[cdmlib.git] / cdmlib-commons / src / main / java / eu / etaxonomy / cdm / common / monitor / RestServiceProgressMonitor.java
1 // $Id$
2 /**
3 * Copyright (C) 2012 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.cdm.common.monitor;
11
12 /**
13 * @author Andreas Kohlbecker
14 * @date Jul 16, 2012
15 *
16 */
17 public class RestServiceProgressMonitor extends DefaultProgressMonitor implements IRestServiceProgressMonitor {
18
19 public static final int STOPPED_WORK_INDICATOR = -1;
20
21 private boolean isFailed;
22
23 private boolean isDone;
24
25 public RestServiceProgressMonitor(){
26 super();
27 }
28
29 public String getTaskName(){
30 return taskName;
31 }
32
33 public String getSubTask(){
34 return subTask;
35 }
36
37 public int getTotalWork() {
38 return totalWork;
39 }
40
41 public double getWorkDone() {
42 return workDone;
43 }
44
45 public boolean isFailed() {
46 return isFailed;
47 }
48
49 public void setIsFailed(boolean isStopped) {
50 this.isFailed = isStopped;
51 }
52
53 /* (non-Javadoc)
54 * @see eu.etaxonomy.cdm.common.IProgressMonitor#worked(int)
55 */
56 @Override
57 public void worked(int work) {
58 if(work == -1){
59 setIsFailed(true);
60 }
61 super.worked(work);
62 }
63
64
65 @Override
66 public void internalWorked(double work) {
67 if(work == -1){
68 setIsFailed(true);
69 }
70 super.internalWorked(work);
71 }
72
73 public boolean isDone() {
74 return isDone;
75 }
76
77 public void setDone(boolean isDone) {
78 this.isDone = isDone;
79 }
80
81 @Override
82 public void done() {
83 this.isDone = true;
84 super.done();
85 }
86
87 }