All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.dts.common.domain.ProgressDetail Maven / Gradle / Ivy

package com.alibaba.dts.common.domain;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 * 进度详情
 * @author tianyao.myc
 *
 */
public class ProgressDetail {

	private String instanceId;

	/** Job描述 */
	private String description;

	/** 实例触发时间 */
	private String fireTime;

	/** 总体执行进度条 */
	private ProgressBar totalProgressBar;

	/** 各级进度条列表 */
	private List progressBarList = new ArrayList();

	/** 实例结束时间 */
	private String finishTime;

	/** Job类型 */
	private int type;

	/** 按机器维度统计结果 */
	private Map machineProgressBarMap = new HashMap();

	private boolean failureWarning;

	private String information;

	public String getInformation() {
		return information;
	}

	public void setInformation(String information) {
		this.information = information;
	}

	public ProgressDetail() {

	}

	public ProgressDetail(String fireTime, String description, ProgressBar totalProgressBar) {
		this.fireTime = fireTime;
		this.description = description;
		this.totalProgressBar = totalProgressBar;
	}

	public ProgressDetail(String fireTime, String description, ProgressBar totalProgressBar, List progressBarList) {
		this.fireTime = fireTime;
		this.description = description;
		this.totalProgressBar = totalProgressBar;
		this.progressBarList = progressBarList;
	}

	/**
	 * 添加各级进度条
	 *  progressBar
	 */
	public void add(ProgressBar progressBar) {
		this.progressBarList.add(progressBar);
	}

	/**
	 * 添加各级进度条
	 *  progressBarList
	 */
	public void add(List progressBarList) {
		this.progressBarList.addAll(progressBarList);
	}

	/**
	 * json转换成对象
	 *  json
	 *
	 */
/*	public static ProgressDetail newInstance(String json) {
		return RemotingSerializable.fromJson(json, ProgressDetail.class);
	}

	*//**
	 * 对象转换成json
	 *//*
	@Override
	public String toString() {
		return RemotingSerializable.toJson(this, false);
	}*/

	/**
	 * 获取机器维度统计信息
	 *
	 */
	@SuppressWarnings("rawtypes")
	public String getMachineProgress() {

		StringBuilder machineProgress = new StringBuilder();

		Iterator iterator = machineProgressBarMap.entrySet().iterator();
		while (iterator.hasNext()) {
		    Map.Entry entry = (Map.Entry) iterator.next();
		    String ip = (String)entry.getKey();
		    ProgressBar progressBar = (ProgressBar)entry.getValue();

		    machineProgress.append(ip
		    		+ "[总量:" + progressBar.getTotalAmount()
		    		+ ", 排队:" + progressBar.getQueueAmount()
		    		+ ", 成功:" + progressBar.getSuccessAmount()
		    		+ ", 失败:" + progressBar.getFailureAmount() + "]    ");
		}

		return machineProgress.toString();
	}

	/**
	 * 获取机器维度统计信息
	 *
	 */
	@SuppressWarnings("rawtypes")
	public String getMachineProgressForWeb() {

		StringBuilder machineProgress = new StringBuilder();

		Iterator iterator = machineProgressBarMap.entrySet().iterator();
		while (iterator.hasNext()) {
			Map.Entry entry = (Map.Entry) iterator.next();
			String ip = (String)entry.getKey();
			ProgressBar progressBar = (ProgressBar)entry.getValue();

			machineProgress.append(ip + " "
					+ "[总量:" + progressBar.getTotalAmount()
					+ ", 排队:" + progressBar.getQueueAmount()
					+ ", 成功:" + progressBar.getSuccessAmount()
					+ ", 失败:" + progressBar.getFailureAmount() + "]
"); } return machineProgress.toString(); } public String getLongTimeMachineProgress() { StringBuilder machineProgress = new StringBuilder(); Iterator iterator = machineProgressBarMap.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); String ip = (String)entry.getKey(); ProgressBar progressBar = (ProgressBar)entry.getValue(); machineProgress.append(ip + "[总量:" + progressBar.getTotalAmount() + ", 运行:" + progressBar.getRunningAmount() + ", 分配:" + progressBar.getAllocateAmount() + "] "); } return machineProgress.toString(); } public String getInstanceId() { return instanceId; } public void setInstanceId(String instanceId) { this.instanceId = instanceId; } public String getFireTime() { return fireTime; } public void setFireTime(String fireTime) { this.fireTime = fireTime; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public ProgressBar getTotalProgressBar() { return totalProgressBar; } public void setTotalProgressBar(ProgressBar totalProgressBar) { this.totalProgressBar = totalProgressBar; } public List getProgressBarList() { return progressBarList; } public void setProgressBarList(List progressBarList) { this.progressBarList = progressBarList; } public String getFinishTime() { return finishTime; } public void setFinishTime(String finishTime) { this.finishTime = finishTime; } public int getType() { return type; } public void setType(int type) { this.type = type; } public Map getMachineProgressBarMap() { return machineProgressBarMap; } public void setMachineProgressBarMap( Map machineProgressBarMap) { this.machineProgressBarMap = machineProgressBarMap; } public boolean isFailureWarning() { return failureWarning; } public void setFailureWarning(boolean failureWarning) { this.failureWarning = failureWarning; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy