package gov.nih.nci.cananolab.dto.particle.composition;

import gov.nih.nci.cananolab.domain.particle.samplecomposition.Function;
import gov.nih.nci.cananolab.domain.particle.samplecomposition.base.ComposingElement;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * Represents the view bean for ComposingElement domain object
 * 
 * @author pansu
 * 
 */
public class ComposingElementBean {
	private ComposingElement domainComposingElement=new ComposingElement();

	private List<FunctionBean> inherentFunctions = new ArrayList<FunctionBean>();

	public ComposingElementBean(ComposingElement composingElement) {
		this.domainComposingElement = composingElement;
		for (Function function : composingElement
				.getInherentFunctionCollection()) {
			inherentFunctions.add(new FunctionBean(function));
		}
	}

	public ComposingElementBean() {
		FunctionBean fb = new FunctionBean();
		inherentFunctions.add(fb);
	}

	public ComposingElement getDomainComposingElement() {
		return domainComposingElement;
	}

	public List<FunctionBean> getInherentFunctions() {
		return inherentFunctions;
	}

	public void setInherentFunctions(List<FunctionBean> inherentFunctions) {
		this.inherentFunctions = inherentFunctions;
		Set<Function> domainFunctions = new HashSet<Function>();
		for (FunctionBean functionBean : inherentFunctions) {
			domainFunctions.add(functionBean.getDomainFunction());
		}
		domainComposingElement.setInherentFunctionCollection(domainFunctions);
	}
}

@@ -1112,160 +1112,8 @@
 ) %7B%0A
-%09%09return inherentFunctions;%0A%09%7D%0A%0A%09public void setInherentFunctions(List%3CFunctionBean%3E inherentFunctions) %7B%0A%09%09this.inherentFunctions = inherentFunctions;%0A
 %09%09Se
@@ -1358,13 +1358,41 @@
 tions);%0A
+%09%09return inherentFunctions;%0A
 %09%7D%0A%7D%0A

remove setter