Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java @ 3502:3a8884e06aaa
Avoid using XPath queries for getting attributes of a node
flys-client/trunk@5241 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Thu, 23 Aug 2012 13:27:42 +0000 |
parents | bc06a671ef60 |
children | fed914a42a10 |
comparison
equal
deleted
inserted
replaced
3501:0de0ef04bcdc | 3502:3a8884e06aaa |
---|---|
1 package de.intevation.flys.client.server; | 1 package de.intevation.flys.client.server; |
2 | 2 |
3 import javax.xml.xpath.XPathConstants; | 3 import javax.xml.xpath.XPathConstants; |
4 | 4 |
5 import org.w3c.dom.Document; | 5 import org.w3c.dom.Document; |
6 import org.w3c.dom.Node; | 6 import org.w3c.dom.Element; |
7 import org.w3c.dom.NodeList; | 7 import org.w3c.dom.NodeList; |
8 | 8 |
9 import org.apache.log4j.Logger; | 9 import org.apache.log4j.Logger; |
10 | 10 |
11 import com.google.gwt.user.server.rpc.RemoteServiceServlet; | 11 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
52 XPATH_USERS, | 52 XPATH_USERS, |
53 XPathConstants.NODESET, | 53 XPathConstants.NODESET, |
54 ArtifactNamespaceContext.INSTANCE); | 54 ArtifactNamespaceContext.INSTANCE); |
55 | 55 |
56 if (theUsers != null && theUsers.getLength() > 0) { | 56 if (theUsers != null && theUsers.getLength() > 0) { |
57 Node user = theUsers.item(0); | 57 Element user = (Element)theUsers.item(0); |
58 | 58 |
59 String uuid = XMLUtils.xpathString( | 59 String uuid = user.getAttributeNS( |
60 user, "@art:uuid", ArtifactNamespaceContext.INSTANCE); | 60 ArtifactNamespaceContext.NAMESPACE_URI, "uuid"); |
61 String name = XMLUtils.xpathString( | 61 String name = user.getAttributeNS( |
62 user, "@art:name", ArtifactNamespaceContext.INSTANCE); | 62 ArtifactNamespaceContext.NAMESPACE_URI, "name"); |
63 | 63 |
64 return new DefaultUser(uuid, name); | 64 return new DefaultUser(uuid, name); |
65 } | 65 } |
66 } | 66 } |
67 catch (ConnectionException ce) { | 67 catch (ConnectionException ce) { |