<commit_before>package edu.duke.cabig.c3pr.web.study;

import edu.duke.cabig.c3pr.domain.Study;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.validation.Errors;

/**
 * Created by IntelliJ IDEA. User: kherm Date: Jun 13, 2007 Time: 7:27:09 PM To
 * change this template use File | Settings | File Templates.
 */
class StudyDetailsTab extends StudyTab {

	public StudyDetailsTab() {
		super("Study Details", "Details", "study/study_details");
	}

	@Override
	public Map<String, Object> referenceData(HttpServletRequest request,
			Study study) {
		Map<String, Object> refdata = super.referenceData();
		addConfigMapToRefdata(refdata, "studySearchType");
		addConfigMapToRefdata(refdata, "diseaseCodeRefData");
		addConfigMapToRefdata(refdata, "monitorCodeRefData");
		addConfigMapToRefdata(refdata, "phaseCodeRefData");
		addConfigMapToRefdata(refdata, "sponsorCodeRefData");
		addConfigMapToRefdata(refdata, "statusRefData");
		addConfigMapToRefdata(refdata, "typeRefData");
		addConfigMapToRefdata(refdata, "coordinatingCenters");
		addConfigMapToRefdata(refdata, "yesNo");

		if (request.getAttribute("amendFlow") != null
				&& request.getAttribute("amendFlow").toString().equals("true")) {
			if (request.getSession().getAttribute(DISABLE_FORM_DETAILS) != null) {
				refdata.put("disableForm", request.getSession().getAttribute(
						DISABLE_FORM_DETAILS));
			} else {
				refdata.put("disableForm", new Boolean(false));
			}
		} else {
			refdata.put("mandatory", "true");
		}
		return refdata;
	}

	@Override
	public void postProcess(HttpServletRequest request, Study study,
			Errors errors) {
		// TODO Auto-generated method stub
		super.postProcess(request, study, errors);
		if (request.getParameter("deletedSponsor") != null) {
			if (study.getFundingSponsorIdentifierIndex() != -1) {
				study.getOrganizationAssignedIdentifiers().remove(
						study.getFundingSponsorIdentifierIndex());
			}
			if ((study.getStudyFundingSponsors().get(0) != null)
					&& (study.getStudyFundingSponsors().get(0)
							.getHealthcareSite() != null)) {
				study.getStudyFundingSponsors().remove(0);
			}
		} else if (request.getParameter("deletedSponsorIdentifier") != null) {
			if (study.getFundingSponsorIdentifierIndex() != -1) {
				study.getOrganizationAssignedIdentifiers().remove(
						study.getFundingSponsorIdentifierIndex());
			}

		}
	}

}<commit_msg>updated postProcess<commit_after>package edu.duke.cabig.c3pr.web.study;

import edu.duke.cabig.c3pr.domain.Study;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.validation.Errors;

/**
 * Created by IntelliJ IDEA. User: kherm Date: Jun 13, 2007 Time: 7:27:09 PM To
 * change this template use File | Settings | File Templates.
 */
class StudyDetailsTab extends StudyTab {

	public StudyDetailsTab() {
		super("Study Details", "Details", "study/study_details");
	}

	@Override
	public Map<String, Object> referenceData(HttpServletRequest request,
			Study study) {
		Map<String, Object> refdata = super.referenceData();
		addConfigMapToRefdata(refdata, "studySearchType");
		addConfigMapToRefdata(refdata, "diseaseCodeRefData");
		addConfigMapToRefdata(refdata, "monitorCodeRefData");
		addConfigMapToRefdata(refdata, "phaseCodeRefData");
		addConfigMapToRefdata(refdata, "sponsorCodeRefData");
		addConfigMapToRefdata(refdata, "statusRefData");
		addConfigMapToRefdata(refdata, "typeRefData");
		addConfigMapToRefdata(refdata, "coordinatingCenters");
		addConfigMapToRefdata(refdata, "yesNo");

		if (request.getAttribute("amendFlow") != null
				&& request.getAttribute("amendFlow").toString().equals("true")) {
			if (request.getSession().getAttribute(DISABLE_FORM_DETAILS) != null) {
				refdata.put("disableForm", request.getSession().getAttribute(
						DISABLE_FORM_DETAILS));
			} else {
				refdata.put("disableForm", new Boolean(false));
			}
		} else {
			refdata.put("mandatory", "true");
		}
		return refdata;
	}

	@Override
	public void postProcess(HttpServletRequest request, Study study,
			Errors errors) {
		// TODO Auto-generated method stub
		super.postProcess(request, study, errors);
		if (request.getParameter("deletedSponsor") != null) {
			if (study.getFundingSponsorIdentifierIndex() != -1) {
				study.getOrganizationAssignedIdentifiers().remove(
						study.getFundingSponsorIdentifierIndex());
			}
			if ((study.getStudyFundingSponsors().size() > 0)) {
				study.getStudyFundingSponsors().remove(0);
			}
		} else if (request.getParameter("deletedSponsorIdentifier") != null) {
			if (study.getFundingSponsorIdentifierIndex() != -1) {
				study.getOrganizationAssignedIdentifiers().remove(
						study.getFundingSponsorIdentifierIndex());
			}

		}
	}

}
{'fraction_non_alphanumeric': 0.13134077036413386, 'fraction_numerical': 0.007366870132603663, 'mean_word_length': 5.336, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, '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': '262406', 'n_tokens_mistral': 1756, 'n_tokens_neox': 1511, 'n_words': 260}