diff artifact-database/src/main/java/de/intevation/artifactdatabase/rest/BaseOutResource.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 b2115f484edb
children
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/BaseOutResource.java	Fri May 27 08:47:31 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/BaseOutResource.java	Tue May 31 14:53:36 2011 +0000
@@ -77,6 +77,7 @@
         Request request = getRequest();
 
         String identifier = getIdentifier();
+        String outType    = getType();
 
         if (logger.isDebugEnabled()) {
             logger.debug("looking for artifact id '" + identifier + "'");
@@ -101,7 +102,7 @@
         try {
             return new OutRepresentation(
                 mimeType,
-                doOut(identifier, inputDocument, db, getCallMeta()));
+                doOut(identifier, outType, inputDocument, db, getCallMeta()));
         }
         catch (ArtifactDatabaseException adbe) {
             Response response = getResponse();
@@ -118,11 +119,20 @@
      */
     protected abstract String getIdentifier();
 
+
+    /**
+     * Returns the concrete output type of the artifact or collection.
+     *
+     * @return the output type.
+     */
+    protected abstract String getType();
+
     /**
      * This method is called to process the operation on artifacts or
      * collections.
      *
      * @param identifier The identifier of the artifact or collection.
+     * @param type The output type.
      * @param input The input document of the request.
      * @param db The artifact database.
      * @param meta The CallMeta object.
@@ -131,6 +141,7 @@
      */
     protected abstract ArtifactDatabase.DeferredOutput doOut(
         String           identifier,
+        String           type,
         Document         input,
         ArtifactDatabase db,
         CallMeta         meta)

http://dive4elements.wald.intevation.org