// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/model/StatefulFSM.java
// public interface StatefulFSM<T> {
// 	
// 	/**
// 	 * Pass an event to the FSM for a non-existent Stateful Entity.  The StatefulJ framework will instiate a 
// 	 * new Stateful Event by invoking the {@link Factory}
// 	 * 
// 	 * @param event the Event
// 	 * @param parms Optional parameters passed into the Action method
// 	 * @return the returned Object from the Action Method
// 	 * @throws TooBusyException thrown if the FSM cannot process the event
// 	 */
// 	Object onEvent(String event, Object... parms)  throws TooBusyException ;
// 
// 	/**
// 	 * Pass an event to the FSM for existing Stateful Entity
// 	 * 
// 	 * @param stateful the Stateful Entity
// 	 * @param event the Event
// 	 * @param parms Optional parameters passed into the Action method
// 	 * @return the returned Object from the Action Method
// 	 * @throws TooBusyException thrown if the FSM cannot process the event
// 	 */
// 	Object onEvent(T stateful, String event, Object... parms)  throws TooBusyException ;
// 
// }
// 
// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/TooBusyException.java
// public class TooBusyException extends Exception {
// 
// 	private static final long serialVersionUID = 1L;
// 
// }
// 
// Path: statefulj-persistence/statefulj-persistence-jpa/src/main/java/org/statefulj/persistence/jpa/model/StatefulEntity.java
// @MappedSuperclass
// public abstract class StatefulEntity {
// 	
// 	/**
// 	 * Field be set on insert.  But updates must be done through the JPAPersister
// 	 * 
// 	 */
// 	@State
// 	@Column(insertable=true, updatable=false)
// 	private String state;
// 	
// 	public String getState() {
// 		return state;
// 	}
// }
// 
// Path: statefulj-framework/statefulj-framework-tests/src/test/java/org/statefulj/framework/tests/ddd/DomainEntity.java
// @Entity
// @Scope("prototype") 
// @StatefulController(
// 	clazz=DomainEntity.class,
// 	startState=STATE_A
// )
// public class DomainEntity extends StatefulEntity {
// 
// 	// States
// 	//
// 	public final static String STATE_A = "A";
// 	public final static String STATE_B = "B";
// 	
// 	// Internal Events
// 	//
// 	private final static String EVENT_X = "event-x";
// 	private final static String EVENT_Y = "event-y";
// 	private final static String SPRING_EVENT_X = "springmvc:/" + EVENT_X;
// 	private final static String SPRING_EVENT_Y = "springmvc:/" + EVENT_Y;
// 	
// 	@Id
// 	private Long id;
// 	
// 	private int value;
// 	
// 	@FSM
// 	@Transient
// 	private StatefulFSM<DomainEntity> fsm;
// 	
// 	public Long getId() {
// 		return id;
// 	}
// 
// 	public void setId(Long id) {
// 		this.id = id;
// 	}
// 
// 	public int getValue() {
// 		return value;
// 	}
// 
// 	public void setValue(int value) {
// 		this.value = value;
// 	}
// 	
// 	public void onEventX(int value) throws TooBusyException {
// 		fsm.onEvent(this, EVENT_X, value);
// 	}
// 
// 	public void onEventY(int value) throws TooBusyException {
// 		fsm.onEvent(this, EVENT_Y, value);
// 	}
// 
// 	@Transitions({
// 		@Transition(from=STATE_A, event=EVENT_X, to=STATE_B),
// 		@Transition(from=STATE_A, event=SPRING_EVENT_X, to=STATE_B),
// 	})
// 	protected DomainEntity actionAXB(String event, Integer value) {
// 		System.out.println("actionAXB");
// 		this.value = value;
// 		return this;
// 	}
// 
// 	@Transitions({
// 		@Transition(from=STATE_B, event=EVENT_Y, to=STATE_A),
// 		@Transition(from=STATE_B, event=SPRING_EVENT_Y, to=STATE_A),
// 	})
// 	protected DomainEntity actionBYA(String event, Integer value) {
// 		System.out.println("actionBYA");
// 		this.value = value;
// 		return this;
// 	}
// }


import static org.statefulj.framework.tests.ddd.DomainEntity.*;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;
import org.springframework.context.annotation.Scope;
import org.statefulj.framework.core.annotations.FSM;
import org.statefulj.framework.core.annotations.StatefulController;
import org.statefulj.framework.core.annotations.Transition;
import org.statefulj.framework.core.annotations.Transitions;
import org.statefulj.framework.core.model.StatefulFSM;
import org.statefulj.fsm.TooBusyException;
import org.statefulj.persistence.jpa.model.StatefulEntity;
	private final static String EVENT_X = "event-x";
	private final static String EVENT_Y = "event-y";
	private final static String SPRING_EVENT_X = "springmvc:/" + EVENT_X;
	private final static String SPRING_EVENT_Y = "springmvc:/" + EVENT_Y;
	
	@Id
	private Long id;
	
	private int value;
	
	@FSM
	@Transient
	private StatefulFSM<DomainEntity> fsm;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}
	
// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/model/StatefulFSM.java
// public interface StatefulFSM<T> {
// 	
// 	/**
// 	 * Pass an event to the FSM for a non-existent Stateful Entity.  The StatefulJ framework will instiate a 
// 	 * new Stateful Event by invoking the {@link Factory}
// 	 * 
// 	 * @param event the Event
// 	 * @param parms Optional parameters passed into the Action method
// 	 * @return the returned Object from the Action Method
// 	 * @throws TooBusyException thrown if the FSM cannot process the event
// 	 */
// 	Object onEvent(String event, Object... parms)  throws TooBusyException ;
// 
// 	/**
// 	 * Pass an event to the FSM for existing Stateful Entity
// 	 * 
// 	 * @param stateful the Stateful Entity
// 	 * @param event the Event
// 	 * @param parms Optional parameters passed into the Action method
// 	 * @return the returned Object from the Action Method
// 	 * @throws TooBusyException thrown if the FSM cannot process the event
// 	 */
// 	Object onEvent(T stateful, String event, Object... parms)  throws TooBusyException ;
// 
// }
// 
// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/TooBusyException.java
// public class TooBusyException extends Exception {
// 
// 	private static final long serialVersionUID = 1L;
// 
// }
// 
// Path: statefulj-persistence/statefulj-persistence-jpa/src/main/java/org/statefulj/persistence/jpa/model/StatefulEntity.java
// @MappedSuperclass
// public abstract class StatefulEntity {
// 	
// 	/**
// 	 * Field be set on insert.  But updates must be done through the JPAPersister
// 	 * 
// 	 */
// 	@State
// 	@Column(insertable=true, updatable=false)
// 	private String state;
// 	
// 	public String getState() {
// 		return state;
// 	}
// }
// 
// Path: statefulj-framework/statefulj-framework-tests/src/test/java/org/statefulj/framework/tests/ddd/DomainEntity.java
// @Entity
// @Scope("prototype") 
// @StatefulController(
// 	clazz=DomainEntity.class,
// 	startState=STATE_A
// )
// public class DomainEntity extends StatefulEntity {
// 
// 	// States
// 	//
// 	public final static String STATE_A = "A";
// 	public final static String STATE_B = "B";
// 	
// 	// Internal Events
// 	//
// 	private final static String EVENT_X = "event-x";
// 	private final static String EVENT_Y = "event-y";
// 	private final static String SPRING_EVENT_X = "springmvc:/" + EVENT_X;
// 	private final static String SPRING_EVENT_Y = "springmvc:/" + EVENT_Y;
// 	
// 	@Id
// 	private Long id;
// 	
// 	private int value;
// 	
// 	@FSM
// 	@Transient
// 	private StatefulFSM<DomainEntity> fsm;
// 	
// 	public Long getId() {
// 		return id;
// 	}
// 
// 	public void setId(Long id) {
// 		this.id = id;
// 	}
// 
// 	public int getValue() {
// 		return value;
// 	}
// 
// 	public void setValue(int value) {
// 		this.value = value;
// 	}
// 	
// 	public void onEventX(int value) throws TooBusyException {
// 		fsm.onEvent(this, EVENT_X, value);
// 	}
// 
// 	public void onEventY(int value) throws TooBusyException {
// 		fsm.onEvent(this, EVENT_Y, value);
// 	}
// 
// 	@Transitions({
// 		@Transition(from=STATE_A, event=EVENT_X, to=STATE_B),
// 		@Transition(from=STATE_A, event=SPRING_EVENT_X, to=STATE_B),
// 	})
// 	protected DomainEntity actionAXB(String event, Integer value) {
// 		System.out.println("actionAXB");
// 		this.value = value;
// 		return this;
// 	}
// 
// 	@Transitions({
// 		@Transition(from=STATE_B, event=EVENT_Y, to=STATE_A),
// 		@Transition(from=STATE_B, event=SPRING_EVENT_Y, to=STATE_A),
// 	})
// 	protected DomainEntity actionBYA(String event, Integer value) {
// 		System.out.println("actionBYA");
// 		this.value = value;
// 		return this;
// 	}
// }


// Path: statefulj-framework/statefulj-framework-tests/src/test/java/org/statefulj/framework/tests/ddd/DomainEntity.java
import static org.statefulj.framework.tests.ddd.DomainEntity.*;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;
import org.springframework.context.annotation.Scope;
import org.statefulj.framework.core.annotations.FSM;
import org.statefulj.framework.core.annotations.StatefulController;
import org.statefulj.framework.core.annotations.Transition;
import org.statefulj.framework.core.annotations.Transitions;
import org.statefulj.framework.core.model.StatefulFSM;
import org.statefulj.fsm.TooBusyException;
import org.statefulj.persistence.jpa.model.StatefulEntity;

	private final static String EVENT_X = "event-x";
	private final static String EVENT_Y = "event-y";
	private final static String SPRING_EVENT_X = "springmvc:/" + EVENT_X;
	private final static String SPRING_EVENT_Y = "springmvc:/" + EVENT_Y;
	
	@Id
	private Long id;
	
	private int value;
	
	@FSM
	@Transient
	private StatefulFSM<DomainEntity> fsm;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}
	
	public void onEventX(int value) throws TooBusyException {