diff artifact-database/src/main/java/de/intevation/artifactdatabase/rest/CollectionResource.java @ 253:a2df2b48d2aa

Enabled the artifact database to handle requests specific to collection attributes and collection item attributes. artifacts/trunk@1746 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 26 Apr 2011 07:43:40 +0000
parents 6de74b0b878e
children 4edaf3073109
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/CollectionResource.java	Tue Apr 26 06:56:01 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/CollectionResource.java	Tue Apr 26 07:43:40 2011 +0000
@@ -66,13 +66,19 @@
     /** Action name for describing the collection.*/
     public static final String ACTION_DESCRIBE = "describe";
 
+    /** Action name for retrieving the attribute of a collection.*/
+    public static final String ACTION_GET_ATTRIBUTE = "getattribute";
+
     /** Action name for retrieving the attributes of an artifact stored in the
      * collection.*/
-    public static final String ACTION_GET_ATTRIBUTE = "getattribute";
+    public static final String ACTION_GET_ITEM_ATTRIBUTE = "getitemattribute";
+
+    /** Action name for setting the attribute of a collection.*/
+    public static final String ACTION_SET_ATTRIBUTE = "setattribute";
 
     /** Action name for setting the attribute for an artifact stored in the
      * collection.*/
-    public static final String ACTION_SET_ATTRIBUTE = "setattribute";
+    public static final String ACTION_SET_ITEM_ATTRIBUTE = "setitemattribute";
 
     /** Action name for adding a new artifact to the collection.*/
     public static final String ACTION_ADD_ARTIFACT = "addartifact";
@@ -135,12 +141,24 @@
             else if (action.equals(ACTION_SET_ATTRIBUTE)) {
                 String art = getArtifactIdentifier(source);
 
+                logger.info("Set attribute for collection '" + identifier + "'");
+                out = db.setCollectionAttribute(identifier, meta, source);
+            }
+            else if (action.equals(ACTION_SET_ITEM_ATTRIBUTE)) {
+                String art = getArtifactIdentifier(source);
+
                 logger.info("Set attribute for artifact '" + art + "'");
                 out = db.setCollectionItemAttribute(identifier, art, source, meta);
             }
             else if (action.equals(ACTION_GET_ATTRIBUTE)) {
                 String art = getArtifactIdentifier(source);
 
+                logger.info("Retrieve attribute of collection '" + identifier + "'");
+                out = db.getCollectionAttribute(identifier, meta);
+            }
+            else if (action.equals(ACTION_GET_ITEM_ATTRIBUTE)) {
+                String art = getArtifactIdentifier(source);
+
                 logger.info("Retrieve attribute of artifact '" + art + "'");
                 out = db.getCollectionItemAttribute(identifier, art, meta);
             }

http://dive4elements.wald.intevation.org