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.fp.document.service.impl;
17  
18  import org.kuali.ole.fp.document.service.TransferOfFundsService;
19  import org.kuali.ole.sys.context.SpringContext;
20  import org.kuali.ole.sys.document.validation.impl.AccountingDocumentRuleBaseConstants.APPLICATION_PARAMETER;
21  import org.kuali.ole.sys.service.impl.OleParameterConstants;
22  import org.kuali.rice.core.api.parameter.ParameterEvaluator;
23  import org.kuali.rice.core.api.parameter.ParameterEvaluatorService;
24  import org.kuali.rice.coreservice.framework.parameter.ParameterService;
25  
26  /**
27   * The default implementation of the TransferOfFundsService
28   */
29  public class TransferOfFundsServiceImpl implements TransferOfFundsService {
30      private ParameterService parameterService;
31  
32      /**
33       * @see org.kuali.ole.fp.document.service.TransferOfFundsService#isMandatoryTransfersSubType(java.lang.String)
34       */
35      public boolean isMandatoryTransfersSubType(String objectSubTypeCode) {
36          return checkMandatoryTransfersSubType(objectSubTypeCode, APPLICATION_PARAMETER.MANDATORY_TRANSFER_SUBTYPE_CODES);
37      }
38  
39      /**
40       * @see org.kuali.ole.fp.document.service.TransferOfFundsService#isNonMandatoryTransfersSubType(java.lang.String)
41       */
42      public boolean isNonMandatoryTransfersSubType(String objectSubTypeCode) {
43          return checkMandatoryTransfersSubType(objectSubTypeCode, APPLICATION_PARAMETER.NONMANDATORY_TRANSFER_SUBTYPE_CODES);
44      }
45      
46      /**
47       * Helper method for checking the isMandatoryTransfersSubType() and isNonMandatoryTransfersSubType().
48       * 
49       * @param objectSubTypeCode
50       * @param parameterName
51       * @return boolean
52       */
53      protected boolean checkMandatoryTransfersSubType(String objectSubTypeCode, String parameterName) {
54          if (objectSubTypeCode == null) {
55              throw new IllegalArgumentException("An illegal argument has been passed. Cannot allow (null) subtypes.");
56          }
57          ParameterEvaluator evaluator = /*REFACTORME*/SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(OleParameterConstants.FINANCIAL_PROCESSING_DOCUMENT.class, parameterName, objectSubTypeCode);
58          boolean returnboolean = evaluator.evaluationSucceeds();
59          return returnboolean;
60      }
61  
62      /**
63       * Gets the parameterService attribute. 
64       * @return Returns the parameterService.
65       */
66      public ParameterService getParameterService() {
67          return parameterService;
68      }
69  
70      /**
71       * Sets the parameterService attribute value.
72       * @param parameterService The parameterService to set.
73       */
74      public void setParameterService(ParameterService parameterService) {
75          this.parameterService = parameterService;
76      }
77  }