package com.visual.modeler; import java.lang.*; import java.lang.reflect.*; import java.math.BigDecimal; import java.util.Collections; import java.util.Map; import org.jspresso.framework.action.ActionContextConstants; import org.jspresso.framework.action.IActionHandler; import org.jspresso.framework.model.entity.IEntity; import org.jspresso.framework.application.backend.action.BackendAction; import org.jspresso.framework.util.exception.NestedRuntimeException; import org.jspresso.framework.application.backend.action.Transactional; @Transactional public class SubmitStateAction extends BackendAction { String destinationState; String entityClassName; @Override public boolean execute(IActionHandler actionHandler, Map context) { Method mySetStateMethod; Class entityClass; //IEntity copiedEntity = (IEntity)getController(context).cloneInUnitOfWork((IEntity)getSelectedModel(context)); // I think I should replace this by the line below: IEntity theEntity = (IEntity)getSelectedModel(context); //if (copiedEntity != null) { if (theEntity != null) { try { entityClass= Class.forName(entityClassName); mySetStateMethod = entityClass.getMethod("setS_state", String.class); //mySetStateMethod.invoke(copiedEntity,destinationState); mySetStateMethod.invoke(theEntity,destinationState); }catch (Throwable ex) { throw new NestedRuntimeException(ex); } //setActionParameter(Collections.singletonList(copiedEntity), context); //boolean nextRet = super.execute(actionHandler, context); //getController(context).clearPendingOperations(); //return nextRet; return super.execute(actionHandler, context); } return true; } public void setDestinationState(String newS) {destinationState=newS;} public String getDestinationState(){return destinationState;} public void setEntityClassName(String newS) {entityClassName=newS;} public String getEntityClassName(){return entityClassName;} }