# HG changeset patch # User Ingo Weinzierl # Date 1318866839 0 # Node ID 755a890ecf0e7b3b0681646db77165d4c1483a45 # Parent 3ca999f507b72a18d5eacdad61b7c686cf60acf1 FLYSArtifactCollection.ThemeList makes now use of ManagedDomFacet to read all attributes of a Facet. flys-artifacts/trunk@2995 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 3ca999f507b7 -r 755a890ecf0e flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Oct 17 15:53:03 2011 +0000 +++ b/flys-artifacts/ChangeLog Mon Oct 17 15:53:59 2011 +0000 @@ -1,3 +1,9 @@ +2011-10-17 Ingo Weinzierl + + * src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java: + The inner class ThemeList makes now use of ManagedDomFacet to read the + attributes of Facets saved in the Collection's attribute. + 2011-10-17 Sascha L. Teichmann flys/issue314: Variables in datacage are now case insensitive. diff -r 3ca999f507b7 -r 755a890ecf0e flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java --- 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); } }