001 /*
002 * Copyright 2011 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.kfs.gl.batch.service.impl;
017
018 import org.kuali.kfs.sys.KFSConstants;
019 import org.kuali.kfs.sys.context.SpringContext;
020 import org.kuali.rice.kns.service.KualiConfigurationService;
021
022 /**
023 * Base implementation for the enterprise feeder status
024 */
025 public abstract class EnterpriseFeederStatusBase implements EnterpriseFeederStatus {
026 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(EnterpriseFeederStatusBase.class);
027
028 /**
029 * Retrieves the description in ApplicationResources.properties
030 *
031 * @return the description for this class
032 * @see org.kuali.kfs.gl.batch.service.impl.EnterpriseFeederStatus#getStatusDescription()
033 */
034 public String getStatusDescription() {
035 try {
036 String description = SpringContext.getBean(KualiConfigurationService.class).getPropertyString(KFSConstants.ENTERPRISE_FEEDER_STATUS_DESCRIPTION_PREFIX + getClass().getName());
037 if (description == null) {
038 return getDefaultStatusDescription();
039 }
040 return description;
041 }
042 catch (RuntimeException e) {
043 LOG.error("Error occured trying to retrieve status description for class: " + getClass().getName(), e);
044 return getDefaultStatusDescription();
045 }
046 }
047
048 /**
049 * In case there's no entry for this class in ApplicationResources.properties (or an exception occurs), then just return a
050 * default class.
051 *
052 * @return the default description
053 */
054 protected String getDefaultStatusDescription() {
055 return "Status description unavailable for class name: " + getClass().getName();
056 }
057 }