From c8a2791e605bd4cf7ff7ddff1b39d0d51b8ace88 Mon Sep 17 00:00:00 2001 From: Ben Hale Date: Wed, 15 Aug 2007 12:50:45 +0000 Subject: [PATCH] Brought spring-webflow-sandbox code to formatting conventions --- .../springframework/util/AbstractResourceHolder.java | 2 +- .../jpa/DefaultEntityManagerLifecycleController.java | 4 +--- .../hibernate/EntityManagerLifecycleController.java | 12 ++---------- .../sellitem/SellItemFlowExecutionListener.java | 9 +-------- 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/util/AbstractResourceHolder.java b/spring-webflow-sandbox/src/main/java/org/springframework/util/AbstractResourceHolder.java index 3d002671..4653cc35 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/util/AbstractResourceHolder.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/util/AbstractResourceHolder.java @@ -10,7 +10,7 @@ import java.lang.reflect.Method; * @author Maxim Petrashev */ public abstract class AbstractResourceHolder implements ResourceHolder, 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; diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/DefaultEntityManagerLifecycleController.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/DefaultEntityManagerLifecycleController.java index 6d462cc7..77aa92bc 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/DefaultEntityManagerLifecycleController.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/DefaultEntityManagerLifecycleController.java @@ -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); } } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/hibernate/EntityManagerLifecycleController.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/hibernate/EntityManagerLifecycleController.java index 07c8e7b9..676472c7 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/hibernate/EntityManagerLifecycleController.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/hibernate/EntityManagerLifecycleController.java @@ -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(); diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionListener.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionListener.java index 94545c27..f061d510 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionListener.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionListener.java @@ -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