package beaform;

import java.util.concurrent.Callable;

import javax.transaction.NotSupportedException;
import javax.transaction.SystemException;

import beaform.entities.Formula;
import beaform.entities.FormulaDAO;

/**
 * A search task to find formulas.
 *
 * @author Steven Post
 *
 */
public final class SearchFormulaTask implements Callable<Formula> {

	/**
	 * The name of the formula to search for
	 */
	private final transient String name;

	/**
	 * Constructor.
	 *
	 * @param searchForName the name of the formula to search for
	 */
	public SearchFormulaTask(final String searchForName) {
		this.name = searchForName;
	}

	/**
	 * Called when the task is executed.
	 *
	 * @return the found formula, or null if none was found
	 */
	@Override
	public Formula call() throws NotSupportedException, SystemException {

		final FormulaDAO formulaDAO = new FormulaDAO();

		Formula result = formulaDAO.findFormulaByName(this.name);


		return result;

	}
}
@@ -868,19 +868,24 @@
 aDAO();%0A
-%0A
 %09%09
+final 
 Formula 
@@ -935,17 +935,16 @@
 name);%0A%0A
-%0A
 %09%09return

Mark variable as final