# HG changeset patch # User Ingo Weinzierl # Date 1299746285 0 # Node ID ebb1cb69d84706889f004fe3728453018186b1e8 # Parent d3b8b0b1d0101338896f33a7d662517abe772d65 The operations feed() and advance() return the current description of the artifact now. flys-artifacts/trunk@1449 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r d3b8b0b1d010 -r ebb1cb69d847 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Thu Mar 10 05:56:17 2011 +0000 +++ b/flys-artifacts/ChangeLog Thu Mar 10 08:38:05 2011 +0000 @@ -1,3 +1,11 @@ +2011-03-10 Ingo Weinzierl + + * src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: The + operations feed() and advance() return the description of the artifact + using the describe() operation. This avoids additional server round trips + in the client - the clients gets to know about the new state of the + artifact immediately. + 2011-03-10 Ingo Weinzierl * src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: diff -r d3b8b0b1d010 -r ebb1cb69d847 flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Thu Mar 10 05:56:17 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Thu Mar 10 08:38:05 2011 +0000 @@ -144,6 +144,8 @@ */ @Override public Document feed(Document target, CallContext context) { + logger.info("FLYSArtifact.feed()"); + Document doc = XMLUtils.newDocument(); XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( @@ -156,7 +158,7 @@ try { saveData(target, XPATH_FEED_INPUT); - creator.addAttr(result, "type", OPERATION_SUCCESSFUL, true); + return describe(target, context); } catch (IllegalArgumentException iae) { creator.addAttr(result, "type", OPERATION_FAILED, true); @@ -180,6 +182,8 @@ * @return a document that contains a SUCCESS or FAILURE message. */ public Document advance(Document target, CallContext context) { + logger.info("FLYSArtifact.advance()"); + Document doc = XMLUtils.newDocument(); XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( @@ -188,7 +192,6 @@ ArtifactNamespaceContext.NAMESPACE_PREFIX); Element result = ec.create("result"); - doc.appendChild(result); String targetState = XMLUtils.xpathString( target, XPATH_ADVANCE_TARGET, ArtifactNamespaceContext.INSTANCE); @@ -201,16 +204,15 @@ setCurrentStateId(targetState); - ec.addAttr(result, "type", OPERATION_SUCCESSFUL, true); - - return doc; + return describe(target, context); } // TODO IMPLEMENT STEP BACK! logger.warn("Advance: Cannot advance to '" + targetState + "'"); + ec.addAttr(result, "type", OPERATION_FAILED, true); - ec.addAttr(result, "type", OPERATION_FAILED, true); + doc.appendChild(result); return doc; }