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

xworker.app.userflow.UserFlowManager Maven / Gradle / Ivy

package xworker.app.userflow;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import xworker.dataObject.DataObject;

public class UserFlowManager {
	private static Logger logger = LoggerFactory.getLogger(UserFlowManager.class);	
	private static List listeners = new ArrayList();
	
	public static void addListener(UserFlowListener listener){
		if(!listeners.contains(listener)){
			listeners.add(listener);
		}
	}
	
	public static void removeListener(UserFlowListener listener){
		listeners.remove(listener);
	}
	
	public static void fireTaskStarted(DataObject task){
		for(UserFlowListener l :listeners){
			try{
				l.started(task);
			}catch(Exception e){
				logger.error("handle fireTskStarted error, task=" + task, e);
			}
		}
	}
	
	public static void fireTaskFinished(DataObject task){
		for(UserFlowListener l :listeners){
			try{
				l.finished(task);
			}catch(Exception e){
				logger.error("handle fireTaskFinished error, task=" + task, e);
			}
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy