1 /* 2 * The Kuali Financial System, a comprehensive financial management system for higher education. 3 * 4 * Copyright 2005-2014 The Kuali Foundation 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Affero General Public License as 8 * published by the Free Software Foundation, either version 3 of the 9 * License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Affero General Public License for more details. 15 * 16 * You should have received a copy of the GNU Affero General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 package org.kuali.kfs.gl.batch.service.impl; 20 21 import org.kuali.kfs.sys.KFSConstants; 22 import org.kuali.kfs.sys.context.SpringContext; 23 import org.kuali.rice.core.api.config.property.ConfigurationService; 24 25 /** 26 * Base implementation for the enterprise feeder status 27 */ 28 public abstract class EnterpriseFeederStatusBase implements EnterpriseFeederStatus { 29 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(EnterpriseFeederStatusBase.class); 30 31 /** 32 * Retrieves the description in ApplicationResources.properties 33 * 34 * @return the description for this class 35 * @see org.kuali.kfs.gl.batch.service.impl.EnterpriseFeederStatus#getStatusDescription() 36 */ 37 public String getStatusDescription() { 38 try { 39 String description = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(KFSConstants.ENTERPRISE_FEEDER_STATUS_DESCRIPTION_PREFIX + getClass().getName()); 40 if (description == null) { 41 return getDefaultStatusDescription(); 42 } 43 return description; 44 } 45 catch (RuntimeException e) { 46 LOG.error("Error occured trying to retrieve status description for class: " + getClass().getName(), e); 47 return getDefaultStatusDescription(); 48 } 49 } 50 51 /** 52 * In case there's no entry for this class in ApplicationResources.properties (or an exception occurs), then just return a 53 * default class. 54 * 55 * @return the default description 56 */ 57 protected String getDefaultStatusDescription() { 58 return "Status description unavailable for class name: " + getClass().getName(); 59 } 60 }