81 lines
2.0 KiB
Plaintext
Executable File
81 lines
2.0 KiB
Plaintext
Executable File
package com.fp.bpm.actions;
|
|
|
|
import com.fp.bpm.ActionExecutor;
|
|
|
|
/**
|
|
* Enumeracion en la que se define las clases que resuleven o ejecutan una accion.
|
|
* @author Jorge Vaca.
|
|
* @version 2.1
|
|
*/
|
|
public enum ActionTypes {
|
|
|
|
QUERY("query","com.fp.bpm.actions.QueryAction"),
|
|
SAVE("save","com.fp.bpm.actions.SaveAction"),
|
|
LOGON("logon","com.fp.bpm.actions.LogonAction");
|
|
|
|
/**
|
|
* Codig de accion al cual se asocia la clase de ejecucion.
|
|
*/
|
|
private String actionCode;
|
|
/**
|
|
* Clase especifica que procesa un codigo de accion.
|
|
*/
|
|
private String actionClass;
|
|
|
|
/**
|
|
* Crea una instancia de de ActionTypes.
|
|
* @param pActionCode Codigo de accion.
|
|
* @param pActionClass Clase que procesa la accion..
|
|
*/
|
|
private ActionTypes(String pActionCode,String pActionClass) {
|
|
actionCode = pActionCode;
|
|
actionClass = pActionClass;
|
|
}
|
|
|
|
/**
|
|
* Entraga un objeto ActionTypes dado el codigo de accion.
|
|
* @param pActionCode Código de accion.
|
|
* @return ActionTypes
|
|
* @throws Exception
|
|
*/
|
|
public static ActionTypes getActionTypes(String pActionCode) throws Exception{
|
|
ActionTypes [] at = null;
|
|
at = ActionTypes.values();
|
|
ActionTypes actiontypes = null;
|
|
for(ActionTypes obj : at){
|
|
if(obj.actionCode.compareTo(pActionCode) == 0){
|
|
actiontypes = obj;
|
|
}
|
|
}
|
|
return actiontypes;
|
|
}
|
|
|
|
/**
|
|
* Entrega una instancia de la clase que maneja datos por cada accion.
|
|
* @return ActionExecutor
|
|
* @throws Exception
|
|
*/
|
|
public ActionExecutor getInstanceOfAction() throws Exception{
|
|
return (ActionExecutor)Class.forName(actionClass).newInstance();
|
|
}
|
|
|
|
/**
|
|
* Entrega el valor de actionCode.
|
|
* @return String
|
|
* @throws Exception
|
|
*/
|
|
public String getActionCode() throws Exception {
|
|
return actionCode;
|
|
}
|
|
|
|
/**
|
|
* Entrega el valor de actionClass.
|
|
* @return String
|
|
* @throws Exception
|
|
*/
|
|
public String getActionClass() throws Exception {
|
|
return actionClass;
|
|
}
|
|
|
|
}
|