package md.usm.master.dssmedical.faces.admin.managesymptom;

import javax.faces.bean.ManagedProperty;

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

import md.usm.master.dssengine.exception.DSSEngineException;
import md.usm.master.dssmedical.entities.nonmanaged.AbstractConversionEntity;
import md.usm.master.dssmedical.exception.ApplicationException;
import md.usm.master.dssmedical.faces.admin.common.AbstractTreeNodeBean;

public abstract class AbstractSymptomNodeBean<E extends AbstractConversionEntity> extends AbstractTreeNodeBean<E> {

	private static final Logger LOG = LoggerFactory.getLogger(AbstractSymptomNodeBean.class);

	@ManagedProperty("#{symptomTreeBean}")
	private SymptomTreeBean symptomTreeBean;

	@Override
	public void updateTree() {
		try {
			symptomTreeBean.buildTree();
		} catch (ApplicationException | DSSEngineException ex) {
			LOG.error("Error updating tree", ex);
		}
	}

	/*
	 * Getters and setters.
	 */
	public SymptomTreeBean getSymptomTreeBean() {
		return symptomTreeBean;
	}

	public void setSymptomTreeBean(SymptomTreeBean symptomTreeBean) {
		this.symptomTreeBean = symptomTreeBean;
	}

}
