Java tutorial
/******************************************************************************* * Copyright (c) 2009 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.export.writer.ExportWriter; import com.sfs.whichdoctor.export.writer.TrainingSummaryWriter; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; /** * The Class TrainingSummaryExportHandler. */ public class TrainingSummaryExportHandler 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 style = (String) request.getAttribute("Style"); if (StringUtils.equalsIgnoreCase(style, "basic")) { // Set display bean options display.setParameter("MIN", true); display.setParameter("Person's Name", true); display.setParameter("Also Training Under", true); display.setParameter("Total Accreditation", true); display.setParameter("Rotation Description", true); display.setParameter("Start Date", true); display.setParameter("End Date", true); display.setParameter("Training Time", true); display.setParameter("Training Months", true); display.setParameter("Supervisor(s)", true); display.setParameter("Workplace(s)", true); } else { // Set display bean options display.setParameter("MIN", true); display.setParameter("Person's Name", true); display.setParameter("Preferred Name", true); display.setParameter("Last Name", true); display.setParameter("Membership Status", true); display.setParameter("Membership Type", true); display.setParameter("Also Training Under", true); display.setParameter("Total Accreditation", true); display.setParameter("Rotation Description", true); display.setParameter("Rotation Status", true); display.setParameter("Start Date", true); display.setParameter("End Date", true); display.setParameter("Training Time", true); display.setParameter("Training Months", true); display.setParameter("Training Days", true); display.setParameter("Supervisor(s)", true); display.setParameter("Workplace(s)", 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 TrainingSummaryWriter(CSV, CSV_BUNDLE); } /** * Gets the txt writer. * * @return the txt writer */ public final ExportWriter getTxtWriter() { return new TrainingSummaryWriter(TXT, TXT_BUNDLE); } /** * Gets the html writer. * * @return the html writer */ public final ExportWriter getHtmlWriter() { return new TrainingSummaryWriter(HTML, HTML_BUNDLE); } }