Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 1668:6566c7868456
Added facet and index information to theme which are stored at CollectionItems.
flys-artifacts/trunk@2880 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 04 Oct 2011 11:28:37 +0000 |
parents | 16c74ca3586e |
children | bdb05dc9b763 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java Tue Oct 04 07:37:05 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java Tue Oct 04 11:28:37 2011 +0000 @@ -291,6 +291,7 @@ art, outName, facetName, + theme.getIndex(), context)); } } @@ -457,6 +458,7 @@ String uuid, String outName, String facet, + int index, CallContext context) throws ArtifactDatabaseException { @@ -477,7 +479,7 @@ Document attr = db.getCollectionItemAttribute(identifier(), uuid, meta); if (attr == null) { - attr = initItemAttribute(uuid, facet, context); + attr = initItemAttribute(uuid, facet, index, context); if (attr == null) { return null; @@ -501,14 +503,15 @@ Node theme = (Node) XMLUtils.xpath( tmp, - "art:themes/theme[@name='" + themeName + "']", + "art:themes/theme[@facet='" + facet + + "' and @index='" + String.valueOf(index) + "']", XPathConstants.NODE, ArtifactNamespaceContext.INSTANCE); if (theme == null) { log.warn("Could not find the theme in attribute of: " + uuid); - Theme t = getThemeForFacet(uuid, facet, context); + Theme t = getThemeForFacet(uuid, facet, index, context); if (t == null) { log.warn("No theme found for facet: " + facet); @@ -601,11 +604,12 @@ protected Document initItemAttribute( String uuid, String facet, + int index, CallContext context) { log.info("FLYSArtifactCollection.initItemAttribute"); - Theme t = getThemeForFacet(uuid, facet, context); + Theme t = getThemeForFacet(uuid, facet, index, context); if (t == null) { log.info("Could not find theme for facet. Cancel initialization."); @@ -662,6 +666,7 @@ protected Theme getThemeForFacet( String uuid, String facet, + int index, CallContext context) { log.info("FLYSArtifactCollection.getThemeForFacet: " + facet); @@ -670,7 +675,14 @@ ? (FLYSContext) context : (FLYSContext) context.globalContext(); - return ThemeFactory.getTheme(flysContext, facet); + Theme t = ThemeFactory.getTheme(flysContext, facet); + + if (t != null) { + t.setFacet(facet); + t.setIndex(index); + } + + return t; }