comparison artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java @ 5867:59ff03ff48f1

River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 28 Apr 2013 15:23:01 +0200
parents 9a6741ccf6d4
children af13ceeba52a
comparison
equal deleted inserted replaced
5866:9a6741ccf6d4 5867:59ff03ff48f1
32 import org.dive4elements.artifacts.CallContext; 32 import org.dive4elements.artifacts.CallContext;
33 import org.dive4elements.artifacts.CallMeta; 33 import org.dive4elements.artifacts.CallMeta;
34 import org.dive4elements.artifacts.common.ArtifactNamespaceContext; 34 import org.dive4elements.artifacts.common.ArtifactNamespaceContext;
35 import org.dive4elements.artifacts.common.utils.ClientProtocolUtils; 35 import org.dive4elements.artifacts.common.utils.ClientProtocolUtils;
36 import org.dive4elements.artifacts.common.utils.XMLUtils; 36 import org.dive4elements.artifacts.common.utils.XMLUtils;
37 import org.dive4elements.river.artifacts.FLYSArtifact; 37 import org.dive4elements.river.artifacts.D4EArtifact;
38 import org.dive4elements.river.artifacts.context.RiverContext; 38 import org.dive4elements.river.artifacts.context.RiverContext;
39 import org.dive4elements.river.artifacts.model.ManagedDomFacet; 39 import org.dive4elements.river.artifacts.model.ManagedDomFacet;
40 import org.dive4elements.river.artifacts.model.ManagedFacet; 40 import org.dive4elements.river.artifacts.model.ManagedFacet;
41 import org.dive4elements.river.themes.Theme; 41 import org.dive4elements.river.themes.Theme;
42 import org.dive4elements.river.themes.ThemeFactory; 42 import org.dive4elements.river.themes.ThemeFactory;
68 throws IOException 68 throws IOException
69 { 69 {
70 boolean debug = log.isDebugEnabled(); 70 boolean debug = log.isDebugEnabled();
71 71
72 if (debug) { 72 if (debug) {
73 log.debug("FLYSArtifactCollection.doOut: " + outName); 73 log.debug("D4EArtifactCollection.doOut: " + outName);
74 } 74 }
75 75
76 ThemeList themeList = new ThemeList(attributes); 76 ThemeList themeList = new ThemeList(attributes);
77 77
78 int size = themeList.size(); 78 int size = themeList.size();
156 { 156 {
157 boolean debug = log.isDebugEnabled(); 157 boolean debug = log.isDebugEnabled();
158 158
159 if (debug) { 159 if (debug) {
160 log.debug( 160 log.debug(
161 "FLYSArtifactCollection.getFacetThemeFromAttribute(facet=" 161 "D4EArtifactCollection.getFacetThemeFromAttribute(facet="
162 + facet + ", index=" + index + ")"); 162 + facet + ", index=" + index + ")");
163 } 163 }
164 164
165 ArtifactDatabase db = context.getDatabase(); 165 ArtifactDatabase db = context.getDatabase();
166 CallMeta meta = context.getMeta(); 166 CallMeta meta = context.getMeta();
237 String uuid, 237 String uuid,
238 Document attr, 238 Document attr,
239 Theme t, 239 Theme t,
240 CallContext context) 240 CallContext context)
241 { 241 {
242 log.debug("FLYSArtifactCollection.addThemeToAttribute: " + uuid); 242 log.debug("D4EArtifactCollection.addThemeToAttribute: " + uuid);
243 243
244 if (t == null) { 244 if (t == null) {
245 log.warn("Theme is empty - cancel adding it to attribute!"); 245 log.warn("Theme is empty - cancel adding it to attribute!");
246 return; 246 return;
247 } 247 }
336 log.warn("A ManagedFacet in ThemeList is null."); 336 log.warn("A ManagedFacet in ThemeList is null.");
337 continue; 337 continue;
338 } 338 }
339 String uuid = theme.getArtifact(); 339 String uuid = theme.getArtifact();
340 Artifact artifact = getArtifact(uuid, context); 340 Artifact artifact = getArtifact(uuid, context);
341 FLYSArtifact flys = (FLYSArtifact) artifact; 341 D4EArtifact flys = (D4EArtifact) artifact;
342 342
343 ArtifactAndFacet artifactAndFacet = new ArtifactAndFacet( 343 ArtifactAndFacet artifactAndFacet = new ArtifactAndFacet(
344 artifact, 344 artifact,
345 flys.getNativeFacet(theme)); 345 flys.getNativeFacet(theme));
346 346
369 * @return an Artifact. 369 * @return an Artifact.
370 */ 370 */
371 protected Artifact getArtifact(String uuid, CallContext context) 371 protected Artifact getArtifact(String uuid, CallContext context)
372 throws ArtifactDatabaseException 372 throws ArtifactDatabaseException
373 { 373 {
374 log.debug("FLYSArtifactCollection.getArtifact"); 374 log.debug("D4EArtifactCollection.getArtifact");
375 375
376 Backend backend = Backend.getInstance(); 376 Backend backend = Backend.getInstance();
377 PersistentArtifact persistent = backend.getArtifact(uuid); 377 PersistentArtifact persistent = backend.getArtifact(uuid);
378 378
379 return persistent != null ? persistent.getArtifact() : null; 379 return persistent != null ? persistent.getArtifact() : null;
398 CallContext context) 398 CallContext context)
399 { 399 {
400 boolean debug = log.isDebugEnabled(); 400 boolean debug = log.isDebugEnabled();
401 401
402 if (debug) { 402 if (debug) {
403 log.debug("FLYSArtifactCollection.initItemAttribute"); 403 log.debug("D4EArtifactCollection.initItemAttribute");
404 } 404 }
405 405
406 Theme t = getThemeForFacet(uuid, facet, pattern, index, outName, context); 406 Theme t = getThemeForFacet(uuid, facet, pattern, index, outName, context);
407 407
408 if (t == null) { 408 if (t == null) {
436 String pattern, 436 String pattern,
437 int index, 437 int index,
438 String outName, 438 String outName,
439 CallContext context) 439 CallContext context)
440 { 440 {
441 log.info("FLYSArtifactCollection.getThemeForFacet: " + facet); 441 log.info("D4EArtifactCollection.getThemeForFacet: " + facet);
442 442
443 RiverContext flysContext = context instanceof RiverContext 443 RiverContext flysContext = context instanceof RiverContext
444 ? (RiverContext) context 444 ? (RiverContext) context
445 : (RiverContext) context.globalContext(); 445 : (RiverContext) context.globalContext();
446 446
447 // Push artifact in flysContext. 447 // Push artifact in flysContext.
448 ArtifactDatabase db = context.getDatabase(); 448 ArtifactDatabase db = context.getDatabase();
449 try { 449 try {
450 FLYSArtifact artifact = (FLYSArtifact) db.getRawArtifact(uuid); 450 D4EArtifact artifact = (D4EArtifact) db.getRawArtifact(uuid);
451 log.debug("Got raw artifact"); 451 log.debug("Got raw artifact");
452 flysContext.put(RiverContext.ARTIFACT_KEY, artifact); 452 flysContext.put(RiverContext.ARTIFACT_KEY, artifact);
453 } 453 }
454 catch (ArtifactDatabaseException dbe) { 454 catch (ArtifactDatabaseException dbe) {
455 log.error("Exception caught when trying to get art.", dbe); 455 log.error("Exception caught when trying to get art.", dbe);

http://dive4elements.wald.intevation.org