Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java @ 227:7f7f6d2c4b2c
We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
flys-client/trunk@1673 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 12 Apr 2011 13:46:33 +0000 |
parents | f8a5f2c5e2b7 |
children | c9549074ecd1 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java Tue Apr 12 13:11:46 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java Tue Apr 12 13:46:33 2011 +0000 @@ -9,6 +9,7 @@ import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.DefaultArtifact; +import de.intevation.flys.client.shared.model.WINFOArtifact; /** @@ -26,6 +27,9 @@ /** The XPath to the artifact's hash value.*/ public static final String XPATH_HASH = "/art:result/art:hash/@art:value"; + /** The XPath to the artifact's name value.*/ + public static final String XPATH_NAME = "/art:result/art:name/@art:value"; + /** * Creates a new instance of an {@link ArtifactCreator}. @@ -69,8 +73,23 @@ String hash = XMLUtils.xpathString( doc, XPATH_HASH, ArtifactNamespaceContext.INSTANCE); + String name = XMLUtils.xpathString( + doc, XPATH_NAME, ArtifactNamespaceContext.INSTANCE); + System.out.println("NEW Artifact UUID: " + uuid); System.out.println("NEW Artifact HASH: " + hash); + System.out.println("NEW Artifact NAME: " + name); + + if (name == null) { + return new DefaultArtifact(uuid, hash); + } + + name = name.trim(); + + if (name.length() > 0 && name.equals("winfo")) { + System.out.println("+++++ NEW WINFO ARTIFACT."); + return new WINFOArtifact(uuid, hash); + } return new DefaultArtifact(uuid, hash); }