01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.gl.util;
17:
18: import org.kuali.core.service.KualiConfigurationService;
19: import org.kuali.kfs.KFSConstants;
20: import org.kuali.kfs.context.SpringContext;
21:
22: /**
23: * Base implementation for the enterprise feeder status
24: */
25: public abstract class EnterpriseFeederStatusBase implements
26: EnterpriseFeederStatus {
27: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
28: .getLogger(EnterpriseFeederStatusBase.class);
29:
30: /**
31: * Retrieves the description in ApplicationResources.properties
32: *
33: * @return the description for this class
34: * @see org.kuali.module.gl.util.EnterpriseFeederStatus#getStatusDescription()
35: */
36: public String getStatusDescription() {
37: try {
38: String description = SpringContext
39: .getBean(KualiConfigurationService.class)
40: .getPropertyString(
41: KFSConstants.ENTERPRISE_FEEDER_STATUS_DESCRIPTION_PREFIX
42: + getClass().getName());
43: if (description == null) {
44: return getDefaultStatusDescription();
45: }
46: return description;
47: } catch (RuntimeException e) {
48: LOG.error(
49: "Error occured trying to retrieve status description for class: "
50: + getClass().getName(), e);
51: return getDefaultStatusDescription();
52: }
53: }
54:
55: /**
56: * In case there's no entry for this class in ApplicationResources.properties (or an exception occurs), then just return a
57: * default class.
58: *
59: * @return the default description
60: */
61: protected String getDefaultStatusDescription() {
62: return "Status description unavailable for class name: "
63: + getClass().getName();
64: }
65: }
|