diff artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java @ 269:d9a99b28a847

Added support for the 'type' parameter of artifacts and collections out() call. artifacts/trunk@2030 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 31 May 2011 14:53:36 +0000
parents 4edaf3073109
children 22a90706d32d
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java	Fri May 27 08:47:31 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java	Tue May 31 14:53:36 2011 +0000
@@ -235,6 +235,10 @@
          */
         protected PersistentArtifact artifact;
         /**
+         * The output type.
+         */
+        protected String type;
+        /**
          * The input document for the artifact's out() call.
          */
         protected Document           format;
@@ -259,10 +263,12 @@
          */
         public DeferredOutputImpl(
             PersistentArtifact artifact,
+            String             type,
             Document           format,
             CallMeta           callMeta
         ) {
             this.artifact = artifact;
+            this.type     = type;
             this.format   = format;
             this.callMeta = callMeta;
         }
@@ -276,7 +282,7 @@
                 artifact);
 
             try {
-                artifact.getArtifact().out(format, output, cc);
+                artifact.getArtifact().out(type, format, output, cc);
             }
             finally {
                 cc.postCall();
@@ -297,6 +303,10 @@
          */
         protected ArtifactCollection collection;
         /**
+         * The output type.
+         */
+        protected String type;
+        /**
          * The input document for the collection's out() call.
          */
         protected Document format;
@@ -321,10 +331,12 @@
          */
         public DeferredCollectionOutputImpl(
             ArtifactCollection collection,
+            String             type,
             Document           format,
             CallMeta           callMeta
         ) {
             this.collection = collection;
+            this.type       = type;
             this.format     = format;
             this.callMeta   = callMeta;
         }
@@ -338,7 +350,7 @@
                 collection);
 
             try {
-                collection.out(format, output, cc);
+                collection.out(type, format, output, cc);
             }
             finally {
                 cc.postCall();
@@ -750,6 +762,16 @@
     public DeferredOutput out(
         String   identifier,
         Document format,
+        CallMeta callMeta)
+    throws ArtifactDatabaseException
+    {
+        return out(identifier, null, format, callMeta);
+    }
+
+    public DeferredOutput out(
+        String   identifier,
+        String   type,
+        Document format,
         CallMeta callMeta
     )
     throws ArtifactDatabaseException
@@ -761,7 +783,7 @@
             throw new ArtifactDatabaseException(NO_SUCH_ARTIFACT);
         }
 
-        return new DeferredOutputImpl(artifact, format, callMeta);
+        return new DeferredOutputImpl(artifact, type, format, callMeta);
     }
 
     public Document exportArtifact(String artifact, CallMeta callMeta)
@@ -1463,9 +1485,21 @@
         return result;
     }
 
-    public DeferredOutput outCollection(String collectionId,
-        Document format, CallMeta callMeta)
-        throws ArtifactDatabaseException
+    public DeferredOutput outCollection(
+        String   collectionId,
+        Document format,
+        CallMeta callMeta)
+    throws ArtifactDatabaseException
+    {
+        return outCollection(collectionId, null, format, callMeta);
+    }
+
+    public DeferredOutput outCollection(
+        String   collectionId,
+        String   type,
+        Document format,
+        CallMeta callMeta)
+    throws ArtifactDatabaseException
     {
         ArtifactCollectionFactory acf = getArtifactCollectionFactory();
 
@@ -1493,7 +1527,7 @@
             c);
 
         try {
-            return new DeferredCollectionOutputImpl(c, format, callMeta);
+            return new DeferredCollectionOutputImpl(c, type, format, callMeta);
         }
         finally {
             cc.postCall();

http://dive4elements.wald.intevation.org