package gov.va.med.esr.common.batchprocess;


import org.apache.commons.lang.StringUtils;
import gov.va.med.fw.io.FileNameAppender;
import gov.va.med.fw.service.AbstractComponent;

public class HandbookMailingResponseErrorFileProcessExceptionFileNameAppender extends 
             AbstractComponent implements FileNameAppender {

	private String inputExtension;

	private String outputExtension;

	/*
	 *
	 */
	public String getFileNameSuffix(Object obj) {
		String currentInputFileName = (String) obj;
		// case is not in the docs so be propared for both
		String resultFromReplacement = StringUtils.replace(currentInputFileName, inputExtension, outputExtension);
		if(currentInputFileName.equals(resultFromReplacement)) {
			resultFromReplacement = StringUtils.replace(currentInputFileName, inputExtension.toUpperCase(), outputExtension);
			if(currentInputFileName.equals(resultFromReplacement))
				resultFromReplacement = StringUtils.replace(currentInputFileName, inputExtension.toLowerCase(), outputExtension);
		}
		return resultFromReplacement;
	}

	/**
	 * @return Returns the inputExtension.
	 */
	public String getInputExtension() {
		return inputExtension;
	}

	/**
	 * @param inputExtension
	 *            The inputExtension to set.
	 */
	public void setInputExtension(String inputExtension) {
		this.inputExtension = inputExtension;
	}

	/**
	 * @return Returns the outputExtension.
	 */
	public String getOutputExtension() {
		return outputExtension;
	}

	/**
	 * @param outputExtension
	 *            The outputExtension to set.
	 */
	public void setOutputExtension(String outputExtension) {
		this.outputExtension = outputExtension;
	}	
	
}

