Brought spring-webflow-sandbox code to formatting conventions
This commit is contained in:
@@ -10,7 +10,7 @@ import java.lang.reflect.Method;
|
||||
* @author Maxim Petrashev
|
||||
*/
|
||||
public abstract class AbstractResourceHolder<E> implements ResourceHolder<E>, MethodReplacer {// todo replace on
|
||||
// injector in config
|
||||
// injector in config
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object reimplement(Object aObj, Method aMethod, Object[] aArgs) throws Throwable {
|
||||
Object retVal = null;
|
||||
|
||||
@@ -60,9 +60,7 @@ public abstract class DefaultEntityManagerLifecycleController implements EntityM
|
||||
protected void unbind(EntityManager aEntityManager) {
|
||||
synchronized (_entityManagerFactory) {// todo is this need?
|
||||
Assert.isTrue(TransactionSynchronizationManager.hasResource(_entityManagerFactory)); // todo remove this
|
||||
// code. Resource
|
||||
// must be already
|
||||
// present.
|
||||
// code. Resource must be already present.
|
||||
TransactionSynchronizationManager.unbindResource(_entityManagerFactory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
package org.springframework.webflow.jpa.hibernate;
|
||||
|
||||
import org.springframework.webflow.jpa.DefaultEntityManagerLifecycleController;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.classic.Session;
|
||||
import org.hibernate.context.ManagedSessionContext;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityTransaction;
|
||||
|
||||
/**
|
||||
* Hibernate specific implementation of EntityManagerLifecycleController interface. Set for each new entity manager
|
||||
@@ -58,13 +50,13 @@ public class EntityManagerLifecycleController extends DefaultEntityManagerLifecy
|
||||
}
|
||||
|
||||
protected void beginTransaction(EntityManager aEntityManager) {// todo is it method need? May be transaction aspect
|
||||
// has to cover it?
|
||||
// has to cover it?
|
||||
// begin database transaction for taking available connection
|
||||
aEntityManager.getTransaction().begin();
|
||||
}
|
||||
|
||||
protected void disconnectSession(EntityManager aEntityManager) {// todo is it method need? May be transaction aspect
|
||||
// has to cover it?
|
||||
// has to cover it?
|
||||
EntityTransaction transaction = aEntityManager.getTransaction();
|
||||
transaction.commit();
|
||||
// todo is it need ? aSession.disconnect();
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.samples.sellitem;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.webflow.context.servlet.ServletExternalContext;
|
||||
import org.springframework.webflow.definition.StateDefinition;
|
||||
import org.springframework.webflow.execution.EnterStateVetoException;
|
||||
@@ -30,11 +27,7 @@ public class SellItemFlowExecutionListener extends FlowExecutionListenerAdapter
|
||||
String role = nextState.getAttributes().getString("role");
|
||||
if (StringUtils.hasText(role)) {
|
||||
HttpServletRequest request = ((ServletExternalContext) context.getExternalContext()).getRequest();// todo
|
||||
// remove
|
||||
// dependency
|
||||
// on
|
||||
// servlet
|
||||
// api
|
||||
// remove dependency on servlet api
|
||||
if (!request.isUserInRole(role)) {
|
||||
throw new EnterStateVetoException(context.getActiveFlow().getId(), context.getCurrentState().getId(),
|
||||
nextState.getId(), "State requires role '" + role
|
||||
|
||||
Reference in New Issue
Block a user