Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java @ 8856:5e38e2924c07 3.2.x
Fix code style.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:12:01 +0100 |
parents | 994995baa32b |
children | 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8855:d7c005e12af0 | 8856:5e38e2924c07 |
---|---|
229 | 229 |
230 Document doc = attribute.toXML(); | 230 Document doc = attribute.toXML(); |
231 | 231 |
232 try { | 232 try { |
233 // Save the merged document into database. | 233 // Save the merged document into database. |
234 getArtifactDB().setCollectionAttribute(identifier(), getContext().getMeta(), doc); | 234 getArtifactDB().setCollectionAttribute( |
235 identifier(), getContext().getMeta(), doc); | |
235 | 236 |
236 log.info("Saving CollectionAttribute was successful."); | 237 log.info("Saving CollectionAttribute was successful."); |
237 | 238 |
238 return true; | 239 return true; |
239 } | 240 } |
323 | 324 |
324 if (outGen == null) { | 325 if (outGen == null) { |
325 return null; | 326 return null; |
326 } | 327 } |
327 | 328 |
328 // XXX NOTE: the outGen is not able to process its generate() operation, | 329 // XXX NOTE: outGen is not able to process its generate() operation, |
329 // because it has no OutputStream set! | 330 // because it has no OutputStream set! |
330 Document dummy = XMLUtils.newDocument(); | 331 Document dummy = XMLUtils.newDocument(); |
331 outGen.init(out, dummy, null, getContext()); | 332 outGen.init(out, dummy, null, getContext()); |
332 D4EArtifact master = getMasterArtifact(); | 333 D4EArtifact master = getMasterArtifact(); |
333 prepareMasterArtifact(master, outGen); | 334 prepareMasterArtifact(master, outGen); |
380 } | 381 } |
381 | 382 |
382 // If type contains 'chartinfo' use a generator that | 383 // If type contains 'chartinfo' use a generator that |
383 // just allow access to width, height etc. | 384 // just allow access to width, height etc. |
384 | 385 |
385 String key = type != null && !type.isEmpty() && type.indexOf("chartinfo") > 0 | 386 String key = type != null |
387 && !type.isEmpty() | |
388 && type.indexOf("chartinfo") > 0 | |
386 ? type | 389 ? type |
387 : name; | 390 : name; |
388 | 391 |
389 OutGenerator generator = RiverContext.getOutGenerator(context, key); | 392 OutGenerator generator = RiverContext.getOutGenerator(context, key); |
390 | 393 |
438 /** | 441 /** |
439 * Sets the master Artifact at the given <i>generator</i>. | 442 * Sets the master Artifact at the given <i>generator</i>. |
440 * | 443 * |
441 * @param generator The generator that gets a master Artifact. | 444 * @param generator The generator that gets a master Artifact. |
442 */ | 445 */ |
443 protected void prepareMasterArtifact(D4EArtifact master, OutGenerator generator) { | 446 protected void prepareMasterArtifact( |
447 D4EArtifact master, | |
448 OutGenerator generator | |
449 ) { | |
444 // Get master artifact. | 450 // Get master artifact. |
445 if (master != null) { | 451 if (master != null) { |
446 log.debug("Set master Artifact to uuid: " + master.identifier()); | 452 log.debug("Set master Artifact to uuid: " + master.identifier()); |
447 generator.setMasterArtifact(master); | 453 generator.setMasterArtifact(master); |
448 } | 454 } |
462 CallMeta callMeta = getContext().getMeta(); | 468 CallMeta callMeta = getContext().getMeta(); |
463 Document document = db.getCollectionsMasterArtifact( | 469 Document document = db.getCollectionsMasterArtifact( |
464 identifier(), callMeta); | 470 identifier(), callMeta); |
465 | 471 |
466 String masterUUID = XMLUtils.xpathString( | 472 String masterUUID = XMLUtils.xpathString( |
467 document, XPATH_MASTER_UUID, ArtifactNamespaceContext.INSTANCE); | 473 document, |
474 XPATH_MASTER_UUID, | |
475 ArtifactNamespaceContext.INSTANCE); | |
468 D4EArtifact masterArtifact = | 476 D4EArtifact masterArtifact = |
469 (D4EArtifact) getArtifact(masterUUID); | 477 (D4EArtifact) getArtifact(masterUUID); |
470 return masterArtifact; | 478 return masterArtifact; |
471 } | 479 } |
472 catch (ArtifactDatabaseException ade) { | 480 catch (ArtifactDatabaseException ade) { |
572 | 580 |
573 /** | 581 /** |
574 * This method returns the list of artifact UUIDs that this collections | 582 * This method returns the list of artifact UUIDs that this collections |
575 * contains. | 583 * contains. |
576 * | 584 * |
577 * @param context The CallContext that is necessary to get information about | 585 * @param context CallContext that is necessary to get information about |
578 * the ArtifactDatabase. | 586 * the ArtifactDatabase. |
579 * | 587 * |
580 * @return a list of uuids. | 588 * @return a list of uuids. |
581 */ | 589 */ |
582 protected String[] getArtifactUUIDs() | 590 protected String[] getArtifactUUIDs() |
664 log.debug("Searching for Artifacts: " + name); | 672 log.debug("Searching for Artifacts: " + name); |
665 List<Artifact> ret = new ArrayList<Artifact>(); | 673 List<Artifact> ret = new ArrayList<Artifact>(); |
666 try { | 674 try { |
667 for (String uuid: getArtifactUUIDs()) { | 675 for (String uuid: getArtifactUUIDs()) { |
668 D4EArtifact subArt = (D4EArtifact) getArtifact(uuid); | 676 D4EArtifact subArt = (D4EArtifact) getArtifact(uuid); |
669 if (subArt.getName() != null && subArt.getName().equals(name)) { | 677 if ( |
678 subArt.getName() != null && subArt.getName().equals(name) | |
679 ) { | |
670 ret.add(subArt); | 680 ret.add(subArt); |
671 } | 681 } |
672 } | 682 } |
673 } catch (ArtifactDatabaseException e) { | 683 } catch (ArtifactDatabaseException e) { |
674 log.error("Unexpected Error!", e); | 684 log.error("Unexpected Error!", e); |