View Javadoc

1   /*
2    * Copyright 2007 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.batch.service.impl;
17  
18  import org.kuali.ole.sys.OLEConstants;
19  import org.kuali.ole.sys.context.SpringContext;
20  import org.kuali.rice.core.api.config.property.ConfigurationService;
21  
22  /**
23   * Base implementation for the enterprise feeder status
24   */
25  public abstract class EnterpriseFeederStatusBase implements EnterpriseFeederStatus {
26      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(EnterpriseFeederStatusBase.class);
27  
28      /**
29       * Retrieves the description in ApplicationResources.properties
30       * 
31       * @return the description for this class
32       * @see org.kuali.ole.gl.batch.service.impl.EnterpriseFeederStatus#getStatusDescription()
33       */
34      public String getStatusDescription() {
35          try {
36              String description = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(OLEConstants.ENTERPRISE_FEEDER_STATUS_DESCRIPTION_PREFIX + getClass().getName());
37              if (description == null) {
38                  return getDefaultStatusDescription();
39              }
40              return description;
41          }
42          catch (RuntimeException e) {
43              LOG.error("Error occured trying to retrieve status description for class: " + getClass().getName(), e);
44              return getDefaultStatusDescription();
45          }
46      }
47  
48      /**
49       * In case there's no entry for this class in ApplicationResources.properties (or an exception occurs), then just return a
50       * default class.
51       * 
52       * @return the default description
53       */
54      protected String getDefaultStatusDescription() {
55          return "Status description unavailable for class name: " + getClass().getName();
56      }
57  }