comparison gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java @ 394:14eecfde4607

Render links to step back to previous states into gui. Added controller to advance back to these states. gnv/trunk@538 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 13 Jan 2010 22:17:02 +0000
parents ee8003fffc71
children b88e881e8e94
comparison
equal deleted inserted replaced
393:d812c5b62eb4 394:14eecfde4607
489 try { 489 try {
490 // 1 Feed 490 // 1 Feed
491 this.doFeed(artifactFactory, currentArtifact, inputParameter); 491 this.doFeed(artifactFactory, currentArtifact, inputParameter);
492 492
493 // 2. Noch einmal Describe um das jetzt zu erreichende Ziel zu ermitteln 493 // 2. Noch einmal Describe um das jetzt zu erreichende Ziel zu ermitteln
494 ArtifactDescription ad = this.getCurrentStepDescription(artifactFactory, 494 ArtifactDescription ad = getCurrentStepDescription(
495 new Artifact(currentArtifact.getId(), 495 artifactFactory,
496 currentArtifact.getHash()), 496 new Artifact(currentArtifact.getId(),
497 false); 497 currentArtifact.getHash()),
498 false
499 );
500
498 target = ad.getReachableStates().iterator().next(); 501 target = ad.getReachableStates().iterator().next();
499 502
500 // 3 Advance 503 // 3 Advance
501 String url = this.getArtifactUrl(artifactFactory, currentArtifact); 504 doAdvance(artifactFactory, currentArtifact, target);
502 Document advanceDocument = this.createAdvanceRequestBody( 505
503 currentArtifact, target);
504 InputStream advanceResult = this
505 .doPostRequest(url, advanceDocument);
506 this.check4ExceptionReport(new XMLUtils()
507 .readDocument(advanceResult));
508 // 3 Describe 506 // 3 Describe
509 return this.getCurrentStepDescription(artifactFactory, 507 return this.getCurrentStepDescription(artifactFactory,
510 currentArtifact,true); 508 currentArtifact,true);
511 } catch (IOException e) { 509 } catch (IOException e) {
512 log.error(e, e); 510 log.error(e, e);
513 throw new ArtifactDatabaseClientException(e); 511 throw new ArtifactDatabaseClientException(e);
514 } 512 }
513 }
514
515
516 public void doAdvance(
517 ArtifactObject factory,
518 ArtifactObject artifact,
519 String target
520 ) throws IOException, ArtifactDatabaseClientException {
521 String url = getArtifactUrl(factory, artifact);
522 Document advanceDocument = createAdvanceRequestBody(artifact, target);
523 InputStream advanceResult = doPostRequest(url, advanceDocument);
524 check4ExceptionReport(new XMLUtils().readDocument(advanceResult));
515 } 525 }
516 526
517 private Document createFeedRequestBody( 527 private Document createFeedRequestBody(
518 ArtifactObject currentArtifact, 528 ArtifactObject currentArtifact,
519 Collection<InputParameter> inputParameter) { 529 Collection<InputParameter> inputParameter) {

http://dive4elements.wald.intevation.org