View Javadoc
1   /*
2    * Copyright 2009 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.sys.service.impl;
17  
18  import java.io.File;
19  
20  import org.apache.commons.lang.StringUtils;
21  import org.kuali.ole.sys.service.DocumentNumberAwareReportWriterService;
22  import org.kuali.rice.krad.util.KRADConstants;
23  
24  public class ScrubberListingReportWriterTextServiceImpl extends ReportWriterTextServiceImpl implements DocumentNumberAwareReportWriterService {
25      private String documentNumber;
26      
27      /**
28       * @see org.kuali.ole.sys.service.impl.ReportWriterTextServiceImpl#destroy()
29       */
30      @Override
31      public void destroy() {
32          super.destroy();
33          
34          documentNumber = KRADConstants.EMPTY_STRING;
35      }
36  
37      /**
38       * @see org.kuali.ole.sys.service.impl.ReportWriterTextServiceImpl#initialize()
39       */
40      @Override
41      public void initialize() {
42          super.initialize();
43      }
44  
45      /**
46       * @see org.kuali.ole.sys.service.DocumentNumberAwareReportWriterService#setDocumentNumber(java.lang.String)
47       */
48      public void setDocumentNumber(String documentNumber) {
49          this.documentNumber = documentNumber;
50      }
51  
52      @Override
53      protected String generateFullFilePath() {
54          String fullFilePath = filePath + File.separator;
55          if (StringUtils.isNotBlank(documentNumber) && isAggregationModeOn()) {
56              fullFilePath += documentNumber + "_";
57          }
58          fullFilePath += this.fileNamePrefix;
59          if (StringUtils.isNotBlank(documentNumber) && !isAggregationModeOn()) {
60              fullFilePath += documentNumber + "_";
61          }
62          if (!isAggregationModeOn()) {
63              fullFilePath += dateTimeService.toDateTimeStringForFilename(dateTimeService.getCurrentDate());
64          }
65          fullFilePath += fileNameSuffix;
66          
67          return fullFilePath;
68      }
69  }