Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 694:68c6c75a6f7c facets-slt
Add index and description of facets to collections describe document.
flys-artifacts/branches/facets-slt@2136 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 16 Jun 2011 14:10:49 +0000 |
parents | 44175d4720f8 |
children | 45cd58a2a2bb |
comparison
equal
deleted
inserted
replaced
693:af393c5eb2c8 | 694:68c6c75a6f7c |
---|---|
717 | 717 |
718 if (num == 0) { | 718 if (num == 0) { |
719 return; | 719 return; |
720 } | 720 } |
721 | 721 |
722 String uri = ArtifactNamespaceContext.NAMESPACE_URI; | |
723 | |
722 for (int i = 0; i < num; i++) { | 724 for (int i = 0; i < num; i++) { |
723 Node theme = themes.item(i); | 725 Element theme = (Element) themes.item(i); |
724 | 726 |
725 String name = XMLUtils.xpathString( | 727 String name = theme.getAttributeNS(uri, "facet"); |
726 theme, "@art:facet", ArtifactNamespaceContext.INSTANCE); | 728 String uuid = theme.getAttributeNS(uri, "artifact"); |
727 | 729 String pos = theme.getAttributeNS(uri, "pos"); |
728 String uuid = XMLUtils.xpathString( | 730 String active = theme.getAttributeNS(uri, "active"); |
729 theme, "@art:artifact", ArtifactNamespaceContext.INSTANCE); | 731 String idx = theme.getAttributeNS(uri, "index"); |
730 | 732 String desc = theme.getAttributeNS(uri, "description"); |
731 String pos = XMLUtils.xpathString( | 733 |
732 theme, "@art:pos", ArtifactNamespaceContext.INSTANCE); | 734 addTheme(uuid, name, idx, pos, active, desc); |
733 | |
734 String active = XMLUtils.xpathString( | |
735 theme, "@art:active", ArtifactNamespaceContext.INSTANCE); | |
736 | |
737 addTheme(uuid, name, pos, active); | |
738 } | 735 } |
739 } | 736 } |
740 | 737 |
741 protected void addTheme( | 738 protected void addTheme( |
742 String uuid, | 739 String uuid, |
743 String name, | 740 String name, |
741 String index, | |
744 String position, | 742 String position, |
745 String active) | 743 String active, |
744 String description) | |
746 { | 745 { |
747 if (logger.isDebugEnabled()) { | 746 if (logger.isDebugEnabled()) { |
748 logger.debug("Add theme: "); | 747 logger.debug("Add theme: "); |
749 logger.debug(".. name: " + name); | 748 logger.debug(".. name: " + name); |
750 logger.debug(".. uuid: " + uuid); | 749 logger.debug(".. uuid: " + uuid); |
753 } | 752 } |
754 | 753 |
755 try { | 754 try { |
756 int pos = Integer.parseInt(position); | 755 int pos = Integer.parseInt(position); |
757 int act = Integer.parseInt(active); | 756 int act = Integer.parseInt(active); |
757 int idx = Integer.parseInt(index); | |
758 | 758 |
759 themes.put( | 759 themes.put( |
760 new Integer(pos-1), | 760 new Integer(pos-1), |
761 new ManagedFacet(name, null, uuid, pos, act)); | 761 new ManagedFacet(name, idx, description, uuid, pos, act)); |
762 } | 762 } |
763 catch (NumberFormatException nfe) { | 763 catch (NumberFormatException nfe) { |
764 logger.warn(nfe, nfe); | 764 logger.warn(nfe, nfe); |
765 } | 765 } |
766 } | 766 } |