Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 1717:755a890ecf0e
FLYSArtifactCollection.ThemeList makes now use of ManagedDomFacet to read all attributes of a Facet.
flys-artifacts/trunk@2995 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 17 Oct 2011 15:53:59 +0000 |
parents | a70e0cbc5e02 |
children | defe2cfeefa5 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java Mon Oct 17 15:53:03 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java Mon Oct 17 15:53:59 2011 +0000 @@ -33,6 +33,7 @@ import de.intevation.flys.artifacts.context.FLYSContext; import de.intevation.flys.artifacts.model.ManagedFacet; +import de.intevation.flys.artifacts.model.ManagedDomFacet; import de.intevation.flys.exports.OutGenerator; import de.intevation.flys.themes.Theme; import de.intevation.flys.themes.ThemeFactory; @@ -775,13 +776,13 @@ } protected void parse(Document output) { - NodeList themes = (NodeList) XMLUtils.xpath( + NodeList themeList = (NodeList) XMLUtils.xpath( output, "art:output/art:facet", XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE); - int num = themes != null ? themes.getLength() : 0; + int num = themeList != null ? themeList.getLength() : 0; logger.debug("Output has " + num + " elements."); @@ -792,50 +793,10 @@ String uri = ArtifactNamespaceContext.NAMESPACE_URI; for (int i = 0; i < num; i++) { - Element theme = (Element) themes.item(i); - - String name = theme.getAttributeNS(uri, "facet"); - String uuid = theme.getAttributeNS(uri, "artifact"); - String pos = theme.getAttributeNS(uri, "pos"); - String active = theme.getAttributeNS(uri, "active"); - String idx = theme.getAttributeNS(uri, "index"); - String desc = theme.getAttributeNS(uri, "description"); - String visible = theme.getAttributeNS(uri, "visible"); - - addTheme(uuid, name, idx, pos, active, desc, visible); - } - } + Element theme = (Element) themeList.item(i); - protected void addTheme( - String uuid, - String name, - String index, - String position, - String active, - String desc, - String visible) - { - if (logger.isDebugEnabled()) { - logger.debug("Add theme: "); - logger.debug(".. name: " + name); - logger.debug(".. uuid: " + uuid); - logger.debug(".. position: " + position); - logger.debug(".. active: " + active); - logger.debug(".. visible: " + visible); - } - - try { - int pos = Integer.parseInt(position); - int act = Integer.parseInt(active); - int idx = Integer.parseInt(index); - int vis = Integer.parseInt(visible); - - themes.put( - new Integer(pos-1), - new ManagedFacet(name, idx, desc, uuid, pos, act, vis)); - } - catch (NumberFormatException nfe) { - logger.warn(nfe, nfe); + ManagedDomFacet facet = new ManagedDomFacet(theme); + themes.put(new Integer(facet.getPosition()-1), facet); } }