<commit_before>package gov.nih.nci.calab.ui.workflow;

/**
 * This class saves the association between a run and the user selected aliquot IDs and comments .
 * 
 * @author pansu
 */

/* CVS $Id: UseAliquotAction.java,v 1.9 2006-04-18 15:21:07 zengje Exp $*/

import gov.nih.nci.calab.service.workflow.ExecuteWorkflowService;
import gov.nih.nci.calab.ui.core.AbstractBaseAction;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.validator.DynaValidatorForm;

public class UseAliquotAction extends AbstractBaseAction {
	private static Logger logger = Logger.getLogger(UseAliquotAction.class);

	public ActionForward executeTask(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ActionForward forward = null;
		String runId=null;
		HttpSession session = request.getSession();
		try {
			DynaValidatorForm theForm = (DynaValidatorForm) form;
			runId = (String) theForm.get("runId");
			String[] aliquotIds = (String[]) theForm.get("aliquotIds");
			String comments = (String) theForm.get("comments");

			ExecuteWorkflowService executeWorkflowService = new ExecuteWorkflowService();
			executeWorkflowService.saveRunAliquots(runId, aliquotIds, comments,
							(String)session.getAttribute("creator"),(String)session.getAttribute("creationDate") );
			ActionMessages msgs = new ActionMessages();
			ActionMessage msg = new ActionMessage("message.useAliquot", runId);
			msgs.add("message", msg);
			saveMessages(request, msgs);
			session.setAttribute("newWorkflowCreated", "true");
			forward = mapping.findForward("success");
		} catch (Exception e) {
			logger.error("Caught exception when saving selected aliquot IDs.",
					e);
			ActionMessages errors = new ActionMessages();
			ActionMessage error = new ActionMessage("error.useAliquot", runId);
			errors.add("error", error);
			saveMessages(request, errors);
			forward = mapping.getInputForward();
		}
		return forward;
	}

	public boolean loginRequired() {
		return true;
	}

}<commit_msg>updated to display runName in the message<commit_after>package gov.nih.nci.calab.ui.workflow;

/**
 * This class saves the association between a run and the user selected aliquot IDs and comments .
 * 
 * @author pansu
 */

/* CVS $Id: UseAliquotAction.java,v 1.10 2006-04-27 15:56:15 pansu Exp $*/

import gov.nih.nci.calab.service.util.StringUtils;
import gov.nih.nci.calab.service.workflow.ExecuteWorkflowService;
import gov.nih.nci.calab.ui.core.AbstractBaseAction;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.validator.DynaValidatorForm;

public class UseAliquotAction extends AbstractBaseAction {
	private static Logger logger = Logger.getLogger(UseAliquotAction.class);

	public ActionForward executeTask(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ActionForward forward = null;
		String runId=null;
		String runName=null;
		String[] aliquotIds=null;
		HttpSession session = request.getSession();
		try {
			DynaValidatorForm theForm = (DynaValidatorForm) form;
			runId = (String) theForm.get("runId");
			runName = (String) theForm.get("runName");
			aliquotIds = (String[]) theForm.get("aliquotIds");
			String comments = (String) theForm.get("comments");

			ExecuteWorkflowService executeWorkflowService = new ExecuteWorkflowService();
			executeWorkflowService.saveRunAliquots(runId, aliquotIds, comments,
							(String)session.getAttribute("creator"),(String)session.getAttribute("creationDate") );
			ActionMessages msgs = new ActionMessages();
			ActionMessage msg = new ActionMessage("message.useAliquot", runName);
			msgs.add("message", msg);
			saveMessages(request, msgs);
			session.setAttribute("newWorkflowCreated", "true");
			forward = mapping.findForward("success");
		} catch (Exception e) {
			logger.error("Caught exception when saving selected aliquot IDs.",
					e);
			ActionMessages errors = new ActionMessages();
			ActionMessage error = new ActionMessage("error.useAliquot", runName);
			errors.add("error", error);
			saveMessages(request, errors);
			forward = mapping.getInputForward();
		}
		return forward;
	}

	public boolean loginRequired() {
		return true;
	}

}
{'fraction_non_alphanumeric': 0.1107754279959718, 'fraction_numerical': 0.007049345417925478, 'mean_word_length': 5.350383631713555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1559990', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1454, 'n_words': 326}