<commit_before>
package edu.wustl.catissuecore.action;

import java.util.HashMap;

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

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import edu.wustl.catissuecore.actionForm.CreateSpecimenForm;
import edu.wustl.catissuecore.domain.CollectionProtocol;
import edu.wustl.catissuecore.domain.CollectionProtocolRegistration;
import edu.wustl.catissuecore.domain.Specimen;
import edu.wustl.catissuecore.domain.SpecimenCollectionGroup;
import edu.wustl.catissuecore.util.global.Constants;
import edu.wustl.catissuecore.util.global.Utility;
import edu.wustl.common.action.SecureAction;
import edu.wustl.common.actionForm.AbstractActionForm;

//import edu.wustl.common.action.SecureAction;

public class MultipleSpecimenFlexInitAction extends SecureAction
{
	public ActionForward executeSecureAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
	{
		//Gets the value of the operation parameter.
		String operation = request.getParameter(Constants.OPERATION);

		String mode = Constants.ADD;
		if (operation != null && operation.equals(Constants.EDIT))
			mode = Constants.EDIT;

		String showParentSelection = "false";
		String showLabel = "true";
		String showBarcode = "true";

		String parentType = request.getParameter("parentType");
		if (parentType == null)
		{
			parentType = Constants.NEW_SPECIMEN_TYPE;
			showParentSelection = "true";

		}
		String numberOfSpecimens = getNumberOfSpecimens(request);
		String parentName = getParentName(request, parentType);

		if (edu.wustl.catissuecore.util.global.Variables.isSpecimenLabelGeneratorAvl)
		{
			showLabel = "false";
		}
		if (edu.wustl.catissuecore.util.global.Variables.isSpecimenBarcodeGeneratorAvl)
		{
			showBarcode = "false";
		}
		setMSPRequestParame(request, mode, parentType, parentName, numberOfSpecimens, showParentSelection, showLabel, showBarcode);

		String pageOf = (String) request.getParameter("pageOf");
		if (pageOf != null)
		{
			request.setAttribute(Constants.PAGEOF, pageOf);
			return mapping.findForward(pageOf);
		}
		else if(Constants.EDIT.equals(mode))
		{
			request.setAttribute(Constants.PAGEOF,"pageOfMultipleSpWithMenu");
		}
			
		return mapping.findForward("success");
	}

	private void setMSPRequestParame(HttpServletRequest request, String mode, String parentType, String parentName, String numberOfSpecimens,
			String showParentSelection, String showLabel, String showBarcode)
	{

		request.setAttribute("MODE", mode);
		request.setAttribute("PARENT_TYPE", parentType);
		request.setAttribute("PARENT_NAME", parentName);
		request.setAttribute("SP_COUNT", numberOfSpecimens);
		request.setAttribute("SHOW_PARENT_SELECTION", showParentSelection);
		request.setAttribute("SHOW_LABEL", showLabel);
		request.setAttribute("SHOW_BARCODE", showBarcode);
	}

	private String getParentName(HttpServletRequest request, String parentType)
	{
		HashMap forwardToHashMap = (HashMap) request.getAttribute("forwardToHashMap");
		if (forwardToHashMap != null)
		{<commit_msg>making the comparision case insensitive<commit_after>
package edu.wustl.catissuecore.action;

import java.util.HashMap;

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

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import edu.wustl.catissuecore.actionForm.CreateSpecimenForm;
import edu.wustl.catissuecore.domain.CollectionProtocol;
import edu.wustl.catissuecore.domain.CollectionProtocolRegistration;
import edu.wustl.catissuecore.domain.Specimen;
import edu.wustl.catissuecore.domain.SpecimenCollectionGroup;
import edu.wustl.catissuecore.util.global.Constants;
import edu.wustl.catissuecore.util.global.Utility;
import edu.wustl.common.action.SecureAction;
import edu.wustl.common.actionForm.AbstractActionForm;

//import edu.wustl.common.action.SecureAction;

public class MultipleSpecimenFlexInitAction extends SecureAction
{
	public ActionForward executeSecureAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
	{
		//Gets the value of the operation parameter.
		String operation = request.getParameter(Constants.OPERATION);

		String mode = Constants.ADD;
		if (operation != null && operation.equalsIgnoreCase(Constants.EDIT))
			mode = Constants.EDIT;

		String showParentSelection = "false";
		String showLabel = "true";
		String showBarcode = "true";

		String parentType = request.getParameter("parentType");
		if (parentType == null)
		{
			parentType = Constants.NEW_SPECIMEN_TYPE;
			showParentSelection = "true";

		}
		String numberOfSpecimens = getNumberOfSpecimens(request);
		String parentName = getParentName(request, parentType);

		if (edu.wustl.catissuecore.util.global.Variables.isSpecimenLabelGeneratorAvl)
		{
			showLabel = "false";
		}
		if (edu.wustl.catissuecore.util.global.Variables.isSpecimenBarcodeGeneratorAvl)
		{
			showBarcode = "false";
		}
		setMSPRequestParame(request, mode, parentType, parentName, numberOfSpecimens, showParentSelection, showLabel, showBarcode);

		String pageOf = (String) request.getParameter("pageOf");
		if (pageOf != null)
		{
			request.setAttribute(Constants.PAGEOF, pageOf);
			return mapping.findForward(pageOf);
		}
		else if(Constants.EDIT.equalsIgnoreCase(mode))
		{
			request.setAttribute(Constants.PAGEOF,"pageOfMultipleSpWithMenu");
		}
			
		return mapping.findForward("success");
	}

	private void setMSPRequestParame(HttpServletRequest request, String mode, String parentType, String parentName, String numberOfSpecimens,
			String showParentSelection, String showLabel, String showBarcode)
	{

		request.setAttribute("MODE", mode);
		request.setAttribute("PARENT_TYPE", parentType);
		request.setAttribute("PARENT_NAME", parentName);
		request.setAttribute("SP_COUNT", numberOfSpecimens);
		request.setAttribute("SHOW_PARENT_SELECTION", showParentSelection);
		request.setAttribute("SHOW_LABEL", showLabel);
		request.setAttribute("SHOW_BARCODE", showBarcode);
	}

	private String getParentName(HttpServletRequest request, String parentType)
	{
		HashMap forwardToHashMap = (HashMap) request.getAttribute("forwardToHashMap");
		if (forwardToHashMap != null)
		{
{'fraction_non_alphanumeric': 0.10067319461444309, 'fraction_numerical': 0.0, 'mean_word_length': 6.175631174533479, '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': '3753575', 'n_tokens_mistral': 2093, 'n_tokens_neox': 1995, 'n_words': 356}