-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b227c3
commit 1209814
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package fr.cirad.manager; | ||
|
||
import fr.cirad.tools.ProgressIndicator; | ||
|
||
public class ImportProcess extends AbstractProcess { | ||
private ProgressIndicator progress; | ||
|
||
public ImportProcess(ProgressIndicator progress, String module) { | ||
this.progress = progress; | ||
this.module = module; | ||
this.status = ProcessStatus.IDLE; | ||
} | ||
|
||
@Override | ||
public String getProcessID() { | ||
return progress.getProcessId(); | ||
} | ||
|
||
@Override | ||
public ProcessStatus getStatus() { | ||
return progress.isAborted() ? ProcessStatus.INTERRUPTED : (progress.isComplete() ? ProcessStatus.SUCCESS : progress.getError() != null ? ProcessStatus.ERROR : ProcessStatus.RUNNING); | ||
} | ||
|
||
@Override | ||
public String getStatusMessage() { | ||
return progress.isComplete() ? "Import complete" : progress.getProgressDescription(); | ||
} | ||
|
||
@Override | ||
public void abort() { | ||
progress.abort(); | ||
this.status = ProcessStatus.INTERRUPTED; | ||
this.statusMessage = "Import process aborted"; | ||
} | ||
|
||
@Override | ||
public String getLog() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getAbortWarning() { | ||
return null; | ||
} | ||
} |