changeset 3548:fed914a42a10

Merged revisions 5373,5377-5378 via svnmerge from file:///home/clients/bsh/bsh-generischer-viewer/Material/SVN/flys-client/trunk ........ r5373 | ingo | 2012-09-07 11:21:25 +0200 (Fr, 07 Sep 2012) | 1 line Tagged 'flys-client' as 2.9 ........ r5377 | bricks | 2012-09-07 13:37:00 +0200 (Fr, 07 Sep 2012) | 2 lines Move RemoteServiceServlet to server package ........ r5378 | bricks | 2012-09-07 13:58:11 +0200 (Fr, 07 Sep 2012) | 4 lines Refactor UserServiceImpl getCurrentUser method Return the logged in user in getCurrentUser method. ........ flys-client/tags/2.9@5381 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 07 Sep 2012 12:03:15 +0000
parents 8a16ff3b9a7f
children 6a8f83c538e3
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/services/RemoteServiceServlet.java flys-client/src/main/java/de/intevation/flys/client/server/ModuleServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/server/RemoteServiceServlet.java flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java
diffstat 6 files changed, 40 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Tue Sep 04 14:19:23 2012 +0000
+++ b/flys-client/ChangeLog	Fri Sep 07 12:03:15 2012 +0000
@@ -1,3 +1,21 @@
+2012-09-04	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/UserServiceImpl.java:
+	  Refactor getCurrentUser to return the logged in user and not the first
+	  user from the artifact database.
+
+2012-09-04	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/RemoteServiceServlet.java,
+	  src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/client/services/RemoteServiceServlet.java,
+	  src/main/java/de/intevation/flys/client/server/ModuleServiceImpl.java:
+	  Move RemoteServiceServlet to server package.
+
+2012-09-07  Ingo Weinzierl <ingo@intevation.de>
+
+	Tagged module as '2.9'.
+
 2012-09-04	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/FLYSConstants.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/services/RemoteServiceServlet.java	Tue Sep 04 14:19:23 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-package de.intevation.flys.client.client.services;
-
-import de.intevation.flys.client.server.auth.User;
-
-import javax.servlet.http.HttpSession;
-
-public class RemoteServiceServlet
-extends      com.google.gwt.user.server.rpc.RemoteServiceServlet
-{
-    /**
-     * Return the current logged in user from the HTTP Session
-    */
-    public User getUser() {
-        HttpSession session = this.getThreadLocalRequest().getSession();
-        return (User)session.getAttribute("user");
-    }
-}
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ModuleServiceImpl.java	Tue Sep 04 14:19:23 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ModuleServiceImpl.java	Fri Sep 07 12:03:15 2012 +0000
@@ -6,7 +6,6 @@
 import de.intevation.artifacts.httpclient.http.HttpClient;
 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
 import de.intevation.flys.client.client.services.ModuleService;
-import de.intevation.flys.client.client.services.RemoteServiceServlet;
 import de.intevation.flys.client.server.auth.User;
 import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.DefaultModule;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/RemoteServiceServlet.java	Fri Sep 07 12:03:15 2012 +0000
@@ -0,0 +1,17 @@
+package de.intevation.flys.client.server;
+
+import de.intevation.flys.client.server.auth.User;
+
+import javax.servlet.http.HttpSession;
+
+public class RemoteServiceServlet
+extends      com.google.gwt.user.server.rpc.RemoteServiceServlet
+{
+    /**
+     * Return the current logged in user from the HTTP Session
+    */
+    public User getUser() {
+        HttpSession session = this.getThreadLocalRequest().getSession();
+        return (User)session.getAttribute("user");
+    }
+}
--- a/flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java	Tue Sep 04 14:19:23 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java	Fri Sep 07 12:03:15 2012 +0000
@@ -5,7 +5,6 @@
 import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
 import de.intevation.artifacts.httpclient.http.HttpClient;
 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
-import de.intevation.flys.client.client.services.RemoteServiceServlet;
 import de.intevation.flys.client.client.services.RiverService;
 import de.intevation.flys.client.server.auth.User;
 import de.intevation.flys.client.shared.exceptions.ServerException;
--- a/flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java	Tue Sep 04 14:19:23 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java	Fri Sep 07 12:03:15 2012 +0000
@@ -8,21 +8,17 @@
 
 import org.apache.log4j.Logger;
 
-import com.google.gwt.user.server.rpc.RemoteServiceServlet;
-
 import de.intevation.artifacts.common.ArtifactNamespaceContext;
 import de.intevation.artifacts.common.utils.XMLUtils;
 
 import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
-import de.intevation.artifacts.httpclient.http.HttpClient;
-import de.intevation.artifacts.httpclient.http.HttpClientImpl;
 
 import de.intevation.flys.client.client.services.UserService;
+import de.intevation.flys.client.server.auth.UserClient;
 import de.intevation.flys.client.shared.exceptions.AuthenticationException;
 import de.intevation.flys.client.shared.model.DefaultUser;
 import de.intevation.flys.client.shared.model.User;
 
-
 /**
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
@@ -40,22 +36,13 @@
     {
         String url = getServletContext().getInitParameter("server-url");
 
-        HttpClient client = new HttpClientImpl(url);
+        UserClient client = new UserClient(url);
+        de.intevation.flys.client.server.auth.User loginuser = getUser();
 
         try {
-            Document users = (Document) client.listUsers();
-
-            String XPATH_USERS = "/art:users/art:user";
+            Element user = client.findUser(loginuser);
 
-            NodeList theUsers = (NodeList) XMLUtils.xpath(
-                users,
-                XPATH_USERS,
-                XPathConstants.NODESET,
-                ArtifactNamespaceContext.INSTANCE);
-
-            if (theUsers != null && theUsers.getLength() > 0) {
-                Element user = (Element)theUsers.item(0);
-
+            if (user != null) {
                 String uuid = user.getAttributeNS(
                         ArtifactNamespaceContext.NAMESPACE_URI, "uuid");
                 String name = user.getAttributeNS(

http://dive4elements.wald.intevation.org