1 package yukihane.inqubus.model;
3 import org.apache.commons.lang.StringUtils;
4 import yukihane.inqubus.manager.RequestProcess;
5 import yukihane.inqubus.manager.TaskKind;
6 import yukihane.inqubus.manager.TaskStatus;
10 private final RequestProcess requestProcess;
11 private Progress progress;
13 public Target(RequestProcess rp) {
14 this.requestProcess = rp;
15 this.progress = new Progress("待機中");
18 public int getRowId() {
19 return requestProcess.getRowId();
23 return getRequestProcess().getVideoId();
26 boolean isVideoDownload() {
27 return getRequestProcess().getDownloadProfile().getVideoProfile().isDownload();
30 boolean isCommentDownload() {
31 return getRequestProcess().getDownloadProfile().getCommentProfile().isDownload();
35 return getRequestProcess().getConvertProfile().isConvert();
38 Progress getProgress() {
42 void setProgress(TaskKind kind, TaskStatus status, double percent, String message) {
45 if (status == TaskStatus.READY) {
46 text = status.toString();
47 } else if (status == TaskStatus.DOING || status == TaskStatus.DONE || status == TaskStatus.CANCELLED) {
48 if (StringUtils.isEmpty(message)) {
49 text = kind.toString() + " " + status.toString();
57 progress = new Progress(p, text);
60 private RequestProcess getRequestProcess() {
61 return requestProcess;