cn.schoolwow.download.module.progress.flow.ResumeDownloadFlow Maven / Gradle / Ivy
The newest version!
package cn.schoolwow.download.module.progress.flow;
import cn.schoolwow.download.domain.task.DownloadTask;
import cn.schoolwow.download.module.pool.domain.PoolContext;
import cn.schoolwow.download.module.pool.flow.DownloadFileFlow;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
public class ResumeDownloadFlow implements BusinessFlow {
@Override
public void executeBusinessFlow(FlowContext flowContext) throws Exception {
PoolContext poolContext = flowContext.checkInstanceData(PoolContext.class);
long id = (Long) flowContext.checkData("id");
if(!poolContext.pauseDownloadTaskMap.containsKey(id)){
throw new IllegalArgumentException("下载任务不存在或者该任务不处于中断下载状态!id:"+id);
}
DownloadTask downloadTask = poolContext.pauseDownloadTaskMap.get(id);
flowContext.getQuickFlow().startFlow("下载文件")
.putInstanceData(downloadTask)
.next(new DownloadFileFlow());
}
@Override
public String name() {
return "恢复下载";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy