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.gl.service.impl;
17  
18  import org.kuali.ole.gl.service.PreScrubberService;
19  import org.kuali.ole.sys.service.DocumentNumberAwareReportWriterService;
20  import org.kuali.ole.sys.service.impl.ScrubberListingReportWriterTextServiceImpl;
21  
22  public class PreScrubberReportWriterTextServiceImpl extends ScrubberListingReportWriterTextServiceImpl implements DocumentNumberAwareReportWriterService {
23      protected boolean enabled;
24      protected PreScrubberService preScrubberService;
25      
26      @Override
27      public void destroy() {
28          enabled = true;
29          super.destroy();
30      }
31  
32      @Override
33      public void initialize() {
34          if (preScrubberService.deriveChartOfAccountsCodeIfSpaces()) {
35              enabled = true;
36              super.initialize();
37          }
38          else {
39              enabled = false;
40          }
41      }
42  
43      @Override
44      public void pageBreak() {
45          if (enabled) {
46              super.pageBreak();
47          }
48      }
49  
50      @Override
51      public void writeFormattedMessageLine(String format, Object... args) {
52          if (enabled) {
53              super.writeFormattedMessageLine(format, args);
54          }
55      }
56  
57      public void setPreScrubberService(PreScrubberService preScrubberService) {
58          this.preScrubberService = preScrubberService;
59      }
60  }