001 /*
002 * Copyright 2011 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.kfs.sys.service.impl;
017
018 import java.io.File;
019
020 import org.apache.commons.lang.StringUtils;
021 import org.kuali.kfs.sys.service.DocumentNumberAwareReportWriterService;
022 import org.kuali.rice.kns.util.KNSConstants;
023
024 public class ScrubberListingReportWriterTextServiceImpl extends ReportWriterTextServiceImpl implements DocumentNumberAwareReportWriterService {
025 private String documentNumber;
026
027 /**
028 * @see org.kuali.kfs.sys.service.impl.ReportWriterTextServiceImpl#destroy()
029 */
030 @Override
031 public void destroy() {
032 super.destroy();
033
034 documentNumber = KNSConstants.EMPTY_STRING;
035 }
036
037 /**
038 * @see org.kuali.kfs.sys.service.impl.ReportWriterTextServiceImpl#initialize()
039 */
040 @Override
041 public void initialize() {
042 super.initialize();
043 }
044
045 /**
046 * @see org.kuali.kfs.sys.service.DocumentNumberAwareReportWriterService#setDocumentNumber(java.lang.String)
047 */
048 public void setDocumentNumber(String documentNumber) {
049 this.documentNumber = documentNumber;
050 }
051
052 @Override
053 protected String generateFullFilePath() {
054 String fullFilePath = filePath + File.separator;
055 if (StringUtils.isNotBlank(documentNumber) && isAggregationModeOn()) {
056 fullFilePath += documentNumber + "_";
057 }
058 fullFilePath += this.fileNamePrefix;
059 if (StringUtils.isNotBlank(documentNumber) && !isAggregationModeOn()) {
060 fullFilePath += documentNumber + "_";
061 }
062 if (!isAggregationModeOn()) {
063 fullFilePath += dateTimeService.toDateTimeStringForFilename(dateTimeService.getCurrentDate());
064 }
065 fullFilePath += fileNameSuffix;
066
067 return fullFilePath;
068 }
069 }