]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Pass user id instead of username into checkout method.
authorrkv <rkv@opencascade.com>
Wed, 5 Dec 2012 19:30:04 +0000 (19:30 +0000)
committerrkv <rkv@opencascade.com>
Wed, 5 Dec 2012 19:30:04 +0000 (19:30 +0000)
Workspace/Siman-Common/src/org/splat/service/ScenarioService.java
Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java
Workspace/Siman/src/org/splat/simer/CheckoutAction.java

index eb15f8632454a42e67fade04b2d08ebfd199a679..939a0ef5c78d76c017a73c2e85daf3513c109b49 100644 (file)
@@ -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;
 
        /**
index b230749b58b98cea9bb13f0ed29a2e789f2c4731..0c250e97db02268927f888256b5140a20134df7f 100644 (file)
@@ -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);
                }
        }
 
index ed95b20ac102fd9e6810876f5982b8258c92cfde..1d122d126f88497df7f326ecd809301c57c0b6ee 100644 (file)
@@ -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;
        }
 }