comparison flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 3242:1dca41dba135

Move annotation code to base class ChartGenerator flys-artifacts/trunk@4874 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Wed, 04 Jul 2012 22:28:44 +0000
parents 1203e12c97a6
children dd3ddc8ecb14
comparison
equal deleted inserted replaced
3241:da3e58694cae 3242:1dca41dba135
729 String pattern, 729 String pattern,
730 int index, 730 int index,
731 CallContext context) 731 CallContext context)
732 throws ArtifactDatabaseException 732 throws ArtifactDatabaseException
733 { 733 {
734 log.debug("FLYSArtifactCollection.getFacetThemeFromAttribute"); 734 log.debug("FLYSArtifactCollection.getFacetThemeFromAttribute(facet=" + facet + ", index=" + index);
735 735
736 ArtifactDatabase db = context.getDatabase(); 736 ArtifactDatabase db = context.getDatabase();
737 CallMeta meta = context.getMeta(); 737 CallMeta meta = context.getMeta();
738 738
739 FLYSContext flysContext = context instanceof FLYSContext 739 FLYSContext flysContext = context instanceof FLYSContext
765 765
766 log.debug("Search theme for facet '" + facet + "' in attribute."); 766 log.debug("Search theme for facet '" + facet + "' in attribute.");
767 767
768 Node theme = (Node) XMLUtils.xpath( 768 Node theme = (Node) XMLUtils.xpath(
769 tmp, 769 tmp,
770 "art:themes/theme[@facet='" + facet + 770 "art:themes/theme[@facet='" + facet +
771 "' and @index='" + String.valueOf(index) + "']", 771 "' and @index='" + String.valueOf(index) + "']",
772 XPathConstants.NODE, 772 XPathConstants.NODE,
773 ArtifactNamespaceContext.INSTANCE); 773 ArtifactNamespaceContext.INSTANCE);
774 774
775 if (theme == null) { 775 if (theme == null) {
776 log.warn("Could not find the theme in attribute of: " + uuid); 776 log.warn("Could not find the theme in attribute of: " + facet + " " + uuid);
777 777
778 Theme t = getThemeForFacet( 778 Theme t = getThemeForFacet(
779 uuid, facet, pattern, index, outName, context); 779 uuid, facet, pattern, index, outName, context);
780 780
781 if (t == null) { 781 if (t == null) {
784 } 784 }
785 785
786 addThemeToAttribute(uuid, attr, t, context); 786 addThemeToAttribute(uuid, attr, t, context);
787 theme = t.toXML().getFirstChild(); 787 theme = t.toXML().getFirstChild();
788 } 788 }
789 /*else {
790 log.debug("getFacetThemeFromAttribute: " + XMLUtils.toString(theme));
791 }*/
789 792
790 Document doc = XMLUtils.newDocument(); 793 Document doc = XMLUtils.newDocument();
791 doc.appendChild(doc.importNode(theme, true)); 794 doc.appendChild(doc.importNode(theme, true));
792 795
793 return doc; 796 return doc;
845 themes.appendChild(attr.importNode(t.toXML().getFirstChild(), true)); 848 themes.appendChild(attr.importNode(t.toXML().getFirstChild(), true));
846 849
847 try { 850 try {
848 setCollectionItemAttribute(uuid, attr, context); 851 setCollectionItemAttribute(uuid, attr, context);
849 852
850 log.debug("Successfully added theme to item attribute."); 853 //log.debug("addThemeToAttribute: Successfully added theme to item attribute: " + XMLUtils.toString(attr));
851 } 854 }
852 catch (ArtifactDatabaseException e) { 855 catch (ArtifactDatabaseException e) {
853 // do nothing 856 // do nothing
854 log.warn("Cannot set attribute of item: " + uuid); 857 log.warn("Cannot set attribute of item: " + uuid);
855 } 858 }
882 log.info("Could not find theme for facet. Cancel initialization."); 885 log.info("Could not find theme for facet. Cancel initialization.");
883 return null; 886 return null;
884 } 887 }
885 888
886 Document attr = XMLUtils.newDocument(); 889 Document attr = XMLUtils.newDocument();
887
888 addThemeToAttribute(uuid, attr, t, context); 890 addThemeToAttribute(uuid, attr, t, context);
889 891
892 log.debug("initItemAttribute for facet " + facet + ": " + XMLUtils.toString(attr));
893
890 return attr; 894 return attr;
891 } 895 }
892 896
893 897
894 /** 898 /**
947 // Push artifact in flysContext. 951 // Push artifact in flysContext.
948 ArtifactDatabase db = context.getDatabase(); 952 ArtifactDatabase db = context.getDatabase();
949 try { 953 try {
950 FLYSArtifact artifact = (FLYSArtifact) db.getRawArtifact(uuid); 954 FLYSArtifact artifact = (FLYSArtifact) db.getRawArtifact(uuid);
951 log.debug("Got raw artifact"); 955 log.debug("Got raw artifact");
952 flysContext.put(flysContext.ARTIFACT_KEY, artifact); 956 flysContext.put(FLYSContext.ARTIFACT_KEY, artifact);
953 } 957 }
954 catch (ArtifactDatabaseException dbe) { 958 catch (ArtifactDatabaseException dbe) {
955 log.error("Exception caught when trying to get art.", dbe); 959 log.error("Exception caught when trying to get art.", dbe);
956 } 960 }
957 961

http://dive4elements.wald.intevation.org