// Path: tcslackbuildnotifier-core/src/main/java/slacknotifications/teamcity/Loggers.java
// public final class Loggers {
// 	
// 	private Loggers(){}
// 	public static final Logger SERVER 		= Logger.getInstance("jetbrains.buildServer.SERVER");
// 	public static final Logger ACTIVITIES  	= Logger.getInstance("jetbrains.buildServer.ACTIVITIES");
// }


import org.apache.commons.beanutils.PropertyUtils;
import slacknotifications.teamcity.Loggers;
import slacknotifications.teamcity.payload.util.TemplateMatcher.VariableResolver;
import java.lang.reflect.InvocationTargetException;
package slacknotifications.teamcity.payload.util;



/**
 * This is a VariableResolver for the TemplateMatcher
 * 
 * It resolves the values of variables from javaBean objects using 
 * org.apache.commons.beanutils.PropertyUtils 
 * 
 * @author NetWolfUK
 *
 */

public class SlackNotificationBeanUtilsVariableResolver implements VariableResolver {
	
	private static final String EXCEPTION_MESSAGE = " thrown when trying to resolve value for ";
	
	Object bean;
	
	public SlackNotificationBeanUtilsVariableResolver(Object javaBean) {
		this.bean = javaBean;
	}
	
	@Override
	public String resolve(String variableName) {
		String value = "UNRESOLVED";
		try {
			value = (String) PropertyUtils.getProperty(bean, variableName);
		} catch (IllegalAccessException e) {
// Path: tcslackbuildnotifier-core/src/main/java/slacknotifications/teamcity/Loggers.java
// public final class Loggers {
// 	
// 	private Loggers(){}
// 	public static final Logger SERVER 		= Logger.getInstance("jetbrains.buildServer.SERVER");
// 	public static final Logger ACTIVITIES  	= Logger.getInstance("jetbrains.buildServer.ACTIVITIES");
// }


// Path: tcslackbuildnotifier-core/src/main/java/slacknotifications/teamcity/payload/util/SlackNotificationBeanUtilsVariableResolver.java
import org.apache.commons.beanutils.PropertyUtils;
import slacknotifications.teamcity.Loggers;
import slacknotifications.teamcity.payload.util.TemplateMatcher.VariableResolver;
import java.lang.reflect.InvocationTargetException;

package slacknotifications.teamcity.payload.util;



/**
 * This is a VariableResolver for the TemplateMatcher
 * 
 * It resolves the values of variables from javaBean objects using 
 * org.apache.commons.beanutils.PropertyUtils 
 * 
 * @author NetWolfUK
 *
 */

public class SlackNotificationBeanUtilsVariableResolver implements VariableResolver {
	
	private static final String EXCEPTION_MESSAGE = " thrown when trying to resolve value for ";
	
	Object bean;
	
	public SlackNotificationBeanUtilsVariableResolver(Object javaBean) {
		this.bean = javaBean;
	}
	
	@Override
	public String resolve(String variableName) {
		String value = "UNRESOLVED";
		try {
			value = (String) PropertyUtils.getProperty(bean, variableName);
		} catch (IllegalAccessException e) {
			Loggers.SERVER.warn(this.getClass().getSimpleName() + " :: " + e.getClass() + EXCEPTION_MESSAGE + variableName); 