changeset 316:0ca9b1073ccf

Added dummy user to fresh created collections to have it available in the backend listeners. artifacts/trunk@2451 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 02 Aug 2011 13:10:56 +0000
parents 03e508e57b85
children 824051dff018
files ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUser.java
diffstat 3 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Aug 02 11:41:11 2011 +0000
+++ b/ChangeLog	Tue Aug 02 13:10:56 2011 +0000
@@ -1,3 +1,12 @@
+2011-08-02	Sascha L. Teichmann	<teichmann@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUser.java:
+	  Added constructor only with the identifier of the owner.
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java:
+	  Added dummy user to fresh created collection to have it accessible in the
+	  listeners.
+	
 2011-08-02	Sascha L. Teichmann	<teichmann@intevation.de>
 
 	* artifact-database/src/main/java/de/intevation/artifactdatabase/DatabaseCleaner.java:
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java	Tue Aug 02 11:41:11 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java	Tue Aug 02 13:10:56 2011 +0000
@@ -1103,6 +1103,11 @@
                 collection[0] = factory.createCollection(
                     identifier, name, creationTime, ttl, attribute, context);
 
+                if (collection[0] != null) {
+                    // XXX: Little hack to make the listeners happy
+                    collection[0].setUser(new DefaultUser(ownerIdentifier));
+                }
+
                 return true;
             }
         };
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUser.java	Tue Aug 02 11:41:11 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUser.java	Tue Aug 02 13:10:56 2011 +0000
@@ -35,6 +35,9 @@
     public DefaultUser() {
     }
 
+    public DefaultUser(String identifier) {
+        this.identifier = identifier;
+    }
 
     /**
      * A constructor that creates a new user.

http://dive4elements.wald.intevation.org