From: rkv Date: Wed, 5 Dec 2012 19:30:04 +0000 (+0000) Subject: Pass user id instead of username into checkout method. X-Git-Tag: Root_Delivery1_2012_12_06~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=794cc73a03015511ea3fec55544e672e5b4bca8a;p=tools%2Fsiman.git Pass user id instead of username into checkout method. --- diff --git a/Workspace/Siman-Common/src/org/splat/service/ScenarioService.java b/Workspace/Siman-Common/src/org/splat/service/ScenarioService.java index eb15f86..939a0ef 100644 --- a/Workspace/Siman-Common/src/org/splat/service/ScenarioService.java +++ b/Workspace/Siman-Common/src/org/splat/service/ScenarioService.java @@ -161,14 +161,14 @@ public interface ScenarioService { * * @param scenarioId * the scenario id - * @param username - * the username of the user performing the check out + * @param userId + * the id of the user performing the check out * @throws InvalidPropertyException * if the user or the scenario is not found in the database * @throws NotApplicableException * if the given user can not check out the scenario */ - public void checkout(final long scenarioId, final String username) + public void checkout(final long scenarioId, final long userId) throws InvalidPropertyException, NotApplicableException; /** diff --git a/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java index b230749..0c250e9 100644 --- a/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java @@ -723,21 +723,21 @@ public class ScenarioServiceImpl implements ScenarioService { * * @param scenarioId * the scenario id - * @param username - * the username of the user performing the check out + * @param userId + * the id of the user performing the check out * @throws InvalidPropertyException * if the user or the scenario is not found in the database * @throws NotApplicableException * if the given user can not check out the scenario */ @Transactional - public void checkout(final long scenarioId, final String username) + public void checkout(final long scenarioId, final long userId) throws InvalidPropertyException, NotApplicableException { - User aUser = getUserService().selectUser(username); + User aUser = getUserService().selectUser(userId); if (aUser == null) { // User not found throw new InvalidPropertyException(MessageKeyEnum.USR_000001 - .toString(), username); + .toString(), userId); } Scenario aScenario = getScenarioDAO().get(scenarioId); if (aScenario == null) { @@ -749,7 +749,7 @@ public class ScenarioServiceImpl implements ScenarioService { aUser); if (res) { if (aScenario.isCheckedout() - && (!aScenario.getUser().getUsername().equals(username))) { + && (!aScenario.getUser().getUsername().equals(aUser.getUsername()))) { throw new NotApplicableException(MessageKeyEnum.SCN_000008 .toString(), scenarioId, aScenario.getUser() .getUsername()); @@ -759,7 +759,7 @@ public class ScenarioServiceImpl implements ScenarioService { } else { // User doesn't participate in the scenario throw new NotApplicableException(MessageKeyEnum.SCN_000007 - .toString(), username, scenarioId); + .toString(), aUser.getUsername(), scenarioId); } } diff --git a/Workspace/Siman/src/org/splat/simer/CheckoutAction.java b/Workspace/Siman/src/org/splat/simer/CheckoutAction.java index ed95b20..1d122d1 100644 --- a/Workspace/Siman/src/org/splat/simer/CheckoutAction.java +++ b/Workspace/Siman/src/org/splat/simer/CheckoutAction.java @@ -45,7 +45,7 @@ public class CheckoutAction extends ActionSupport { /** * User login name action parameter. Defines the user who performs check out. */ - private String _user; + private long _user; /** * Injected scenario service. */ @@ -133,7 +133,7 @@ public class CheckoutAction extends ActionSupport { * * @return the user */ - public String getUser() { + public long getUser() { return _user; } @@ -143,7 +143,7 @@ public class CheckoutAction extends ActionSupport { * @param user * the user to set */ - public void setUser(final String user) { + public void setUser(final long user) { _user = user; } }