package org.arefgard.icerya.flow.node;

import java.util.Map;

import org.arefgard.icerya.flow.exception.UsecaseFlowException;
import org.arefgard.icerya.flow.integration.DIContainer;
import org.arefgard.icerya.flow.integration.DIContainerFactory;

public class LoadNode extends Node {
	private String type;
	private String var;
	private String nextTo;
	
	public String getNextTo() {
		return nextTo;
	}
	public void setNextTo(String nextTo) {
		this.nextTo = nextTo;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getVar() {
		return var;
	}
	public void setVar(String var) {
		this.var = var;
	}
	public void load(String path, Map<String, Object> params) throws UsecaseFlowException {
		DIContainer container = DIContainerFactory.createContainer(path);
		Object obj = container.get(this.type);
		if(params.containsKey(this.var)) {
			params.put(this.var, obj);
		}else {
			params.put(this.var, obj);
		}
	}
	
	
}
