package com.fitbank.common; import com.fitbank.common.exception.FitbankException; import com.fitbank.common.properties.PropertiesHandler; import com.fitbank.dto.management.Detail; import lombok.extern.slf4j.Slf4j; import org.apache.commons.configuration.Configuration; /** * Clase abstracta que implemente la evaluación de flujos * * @author Software House. */ @Slf4j public abstract class WorkFlow { private static final Configuration CONFIG = PropertiesHandler.getConfig("workflow"); public static Detail execute(Detail pDetail) throws Exception { String workFlowClass = CONFIG.getString(WorkFlow.class.getName() + ".MANAGEMENT_CLASS"); WorkFlow workFlow; log.info("Disparando evaluación de Flujos " + workFlowClass); try { workFlow = (WorkFlow) Class.forName(workFlowClass).newInstance(); } catch (Exception e) { throw new FitbankException("FIT070", "No se pudo cargar la evaluación de flujos {0} ", workFlowClass, e); } return workFlow.normalProcess(pDetail); } public abstract Detail normalProcess(Detail pDetail) throws Exception; }