View Javadoc
1   /*
2    * Copyright 2008 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.coa.service.impl;
17  
18  import java.util.Map;
19  
20  import org.kuali.ole.coa.businessobject.ObjectCode;
21  import org.kuali.ole.sys.service.UniversityDateService;
22  import org.kuali.rice.krad.bo.BusinessObject;
23  import org.kuali.rice.krad.datadictionary.InactivationBlockingMetadata;
24  import org.kuali.rice.krad.service.impl.InactivationBlockingDetectionServiceImpl;
25  
26  /**
27   * This class overrides the base Inactivation Blocking Detection Service.  It is intended to be used with ObjectCode or ObjectCodeCurrent BOs when they
28   * represent the BLOCKED bo.
29   */
30  public class ObjectCodeCurrentInactivationBlockingDetectionServiceImpl extends InactivationBlockingDetectionServiceImpl {
31      private UniversityDateService universityDateService;
32      
33      @Override
34      protected Map<String, String> buildInactivationBlockerQueryMap(BusinessObject blockedBo, InactivationBlockingMetadata inactivationBlockingMetadata) {
35          ObjectCode blockedObjectCode = (ObjectCode) blockedBo;
36          if (universityDateService.getCurrentFiscalYear().equals(blockedObjectCode.getUniversityFiscalYear())) {
37              return super.buildInactivationBlockerQueryMap(blockedBo, inactivationBlockingMetadata);
38          }
39          return null;
40          
41      }
42  
43      public void setUniversityDateService(UniversityDateService universityDateService) {
44          this.universityDateService = universityDateService;
45      }
46  
47  }