Mercurial > dive4elements > river
changeset 3496:f1814efec714
Replaced another attribute fetching XPath with a simple DOM getAttributeNS() call.
flys-client/trunk@5215 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 16 Aug 2012 08:14:09 +0000 |
parents | e1ac8f5a2139 |
children | 88feb3347aa5 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java |
diffstat | 2 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Wed Aug 15 14:20:51 2012 +0000 +++ b/flys-client/ChangeLog Thu Aug 16 08:14:09 2012 +0000 @@ -1,3 +1,9 @@ +2012-08-16 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java: + Replaced another attribute fetching XPath with a simple DOM + getAttributeNS() call. + 2012-08-15 Björn Ricks <bjoern.ricks@intevation.de> * src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java Wed Aug 15 14:20:51 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java Thu Aug 16 08:14:09 2012 +0000 @@ -7,7 +7,7 @@ import org.w3c.dom.Document; import org.w3c.dom.NodeList; -import org.w3c.dom.Node; +import org.w3c.dom.Element; import org.apache.log4j.Logger; @@ -50,6 +50,7 @@ /** Get river list. */ + @Override public River[] list(String locale) throws ServerException { @@ -80,24 +81,23 @@ } int count = rivers.getLength(); - int rcount = 0; List<River> theRivers = new ArrayList<River>(count); User user = this.getUser(); for (int i = 0; i < count; i++) { - Node tmp = rivers.item(i); + Element tmp = (Element)rivers.item(i); - String name = XMLUtils.xpathString( - tmp, "@art:name", ArtifactNamespaceContext.INSTANCE); + String name = tmp.getAttributeNS( + ArtifactNamespaceContext.NAMESPACE_URI, "name"); - if (user == null || user.canUseFeature("river:" + name)) { + if (name.length() > 0 + && (user == null || user.canUseFeature("river:" + name))) { theRivers.add(new DefaultRiver(name)); - rcount++; } } - return theRivers.toArray(new River[rcount]); + return theRivers.toArray(new River[theRivers.size()]); } catch (ConnectionException ce) { logger.error(ce, ce);