comparison flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 1828:9562ca537143

Added new optional condition for theme-mappings: the output name. flys-artifacts/trunk@3158 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 04 Nov 2011 08:59:42 +0000
parents 6ed439ff61bf
children 0585bf8af41b
comparison
equal deleted inserted replaced
1827:03f129fa0256 1828:9562ca537143
523 : (FLYSContext) context.globalContext(); 523 : (FLYSContext) context.globalContext();
524 524
525 Document attr = db.getCollectionItemAttribute(identifier(), uuid, meta); 525 Document attr = db.getCollectionItemAttribute(identifier(), uuid, meta);
526 526
527 if (attr == null) { 527 if (attr == null) {
528 attr = initItemAttribute(uuid, facet, pattern, index, context); 528 attr = initItemAttribute(uuid, facet, pattern, index, outName, context);
529 529
530 if (attr == null) { 530 if (attr == null) {
531 return null; 531 return null;
532 } 532 }
533 } 533 }
555 ArtifactNamespaceContext.INSTANCE); 555 ArtifactNamespaceContext.INSTANCE);
556 556
557 if (theme == null) { 557 if (theme == null) {
558 log.warn("Could not find the theme in attribute of: " + uuid); 558 log.warn("Could not find the theme in attribute of: " + uuid);
559 559
560 Theme t = getThemeForFacet(uuid, facet, pattern, index, context); 560 Theme t = getThemeForFacet(
561 uuid, facet, pattern, index, outName, context);
561 562
562 if (t == null) { 563 if (t == null) {
563 log.warn("No theme found for facet: " + facet); 564 log.warn("No theme found for facet: " + facet);
564 return null; 565 return null;
565 } 566 }
566 567
567 addThemeToAttribute(uuid, attr, t, context); 568 addThemeToAttribute(uuid, attr, t, context);
568 theme = t.toXML().getFirstChild(); 569 theme = t.toXML().getFirstChild();
569 } 570 }
570 571
571 Document doc = XMLUtils.newDocument(); 572 Document doc = XMLUtils.newDocument();
572 doc.appendChild(doc.importNode(theme, true)); 573 doc.appendChild(doc.importNode(theme, true));
573 574
650 protected Document initItemAttribute( 651 protected Document initItemAttribute(
651 String uuid, 652 String uuid,
652 String facet, 653 String facet,
653 String pattern, 654 String pattern,
654 int index, 655 int index,
656 String outName,
655 CallContext context) 657 CallContext context)
656 { 658 {
657 log.info("FLYSArtifactCollection.initItemAttribute"); 659 log.info("FLYSArtifactCollection.initItemAttribute");
658 660
659 Theme t = getThemeForFacet(uuid, facet, pattern, index, context); 661 Theme t = getThemeForFacet(uuid, facet, pattern, index, outName, context);
660 662
661 if (t == null) { 663 if (t == null) {
662 log.info("Could not find theme for facet. Cancel initialization."); 664 log.info("Could not find theme for facet. Cancel initialization.");
663 return null; 665 return null;
664 } 666 }
713 protected Theme getThemeForFacet( 715 protected Theme getThemeForFacet(
714 String uuid, 716 String uuid,
715 String facet, 717 String facet,
716 String pattern, 718 String pattern,
717 int index, 719 int index,
720 String outName,
718 CallContext context) 721 CallContext context)
719 { 722 {
720 log.info("FLYSArtifactCollection.getThemeForFacet: " + facet); 723 log.info("FLYSArtifactCollection.getThemeForFacet: " + facet);
721 724
722 FLYSContext flysContext = context instanceof FLYSContext 725 FLYSContext flysContext = context instanceof FLYSContext
732 } 735 }
733 catch (Exception e) { 736 catch (Exception e) {
734 log.error("Exception caught when trying to get art.", e); 737 log.error("Exception caught when trying to get art.", e);
735 } 738 }
736 739
737 Theme t = ThemeFactory.getTheme(flysContext, facet, pattern); 740 Theme t = ThemeFactory.getTheme(flysContext, facet, pattern, outName);
738 741
739 if (t != null) { 742 if (t != null) {
740 t.setFacet(facet); 743 t.setFacet(facet);
741 t.setIndex(index); 744 t.setIndex(index);
742 } 745 }

http://dive4elements.wald.intevation.org