Java tutorial
/******************************************************************************* * Copyright (c) 2012 David Harrison. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl-3.0.html * * Contributors: * David Harrison - initial API and implementation ******************************************************************************/ package com.sfs.whichdoctor.export.prepare; import com.sfs.beans.BuilderBean; import com.sfs.beans.UserBean; import com.sfs.whichdoctor.beans.TrainingStatusAnalysisBean; import com.sfs.whichdoctor.export.writer.ExportWriter; import com.sfs.whichdoctor.export.writer.TrainingStatusWriter; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; /** * The Class TrainingSummaryExportHandler. */ public class TrainingStatusExportHandler extends ExportHandlerBase { /** * Gets the display options. * * @param request the request * * @return the display options */ public final BuilderBean getDisplayOptions(final HttpServletRequest request) { BuilderBean display = new BuilderBean(); String audience = (String) request.getParameter("Audience"); TrainingStatusAnalysisBean trainingStatus = (TrainingStatusAnalysisBean) request.getSession() .getAttribute("TrainingStatus"); String groupBy = ""; if (trainingStatus != null) { groupBy = trainingStatus.getGroupBy(); } if (!StringUtils.equalsIgnoreCase(groupBy, "Training program")) { display.setParameter("Training Program", true); } if (!StringUtils.equalsIgnoreCase(groupBy, "Training year")) { display.setParameter("Training Year", true); } if (!StringUtils.equalsIgnoreCase(groupBy, "Person")) { display.setParameter("MIN", true); display.setParameter("Preferred Name", true); display.setParameter("Last Name", true); } display.setParameter("PREP/pre-PREP", true); display.setParameter("Training Type", true); display.setParameter("Online Tools", true); if (StringUtils.equalsIgnoreCase(audience, "internal")) { display.setParameter("AT: Interim Report(s) I", true); } display.setParameter("AT: Final Supervisor Report(s)", true); if (StringUtils.equalsIgnoreCase(audience, "internal")) { display.setParameter("AT: Trainee's Report(s)", true); } display.setParameter("BT: Mid-Year Progress Report(s)", true); display.setParameter("BT: Annual Progress Report(s)", true); display.setParameter("Manual Assessments", true); display.setParameter("Written Exams", true); display.setParameter("Clinical Exams", true); return display; } /** * Gets the load options. * * @param displayVal the display * @param request the request * @param user the user * * @return the load options */ @Override public final BuilderBean getLoadOptions(final BuilderBean displayVal, final HttpServletRequest request, final UserBean user) { return new BuilderBean(); } /** * Gets the csv writer. * * @return the csv writer */ public final ExportWriter getCsvWriter() { return new TrainingStatusWriter(CSV, CSV_BUNDLE); } /** * Gets the txt writer. * * @return the txt writer */ public final ExportWriter getTxtWriter() { return new TrainingStatusWriter(TXT, TXT_BUNDLE); } /** * Gets the html writer. * * @return the html writer */ public final ExportWriter getHtmlWriter() { return new TrainingStatusWriter(HTML, HTML_BUNDLE); } }