changeset 429:48ae19f19f79

dummy merge for repo head
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:15:12 +0200
parents d01e9f6a3dc1 (diff) bf0c7b7e2b71 (current diff)
children bedc87d11596
files
diffstat 42 files changed, 647 insertions(+), 91 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun May 27 10:40:55 2012 +0000
+++ b/ChangeLog	Fri Sep 28 12:15:12 2012 +0200
@@ -1,3 +1,202 @@
+2012-09-26	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java:
+	  New method addOutput to allow subclasses to add Output object manually.
+
+2012-09-17  Ingo Weinzierl <ingo@intevation.de>
+
+	Tagged RELEASE 2.9.1
+
+2012-09-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifacts/pom.xml, pom.xml: source 1.5 -> 1.6
+	  (@Override annotations for interface implementations is 1.6).
+
+2012-09-07	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifact-database/src/main/resources/sql/org-h2-driver.properties,
+	  artifact-database/src/main/resources/sql/org-postgresql-driver.properties:
+	  Fix queries for finding a user.
+
+2012-09-07  Ingo Weinzierl <ingo@intevation.de>
+
+	Tagged RELEASE 2.9
+
+2012-08-30	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultSection.java:
+	  Use LinkedHashMap to keep insertion order of attributes.
+
+2012-08-27	Christian Lins	<christian.lins@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java,
+	  artifacts/src/main/java/de/intevation/artifacts/CallContext.java:
+	  Fix for NPE on empty user database.
+
+2012-08-24	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/rest/RestApp.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/rest/FindUserResource.java:
+	  Add REST service to be able to find a user by its account name.
+
+2012-08-24	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java,
+	  artifacts/src/main/java/de/intevation/artifacts/ArtifactDatabase.java:
+	  Implement findUser method. The findUser method in ArtifactDatabase
+	  converts a User object into its XML representation.
+
+2012-08-24	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java,
+	  artifact-database/src/main/resources/sql/org-h2-driver.properties,
+	  artifact-database/src/main/resources/sql/org-postgresql-driver.properties:
+	  Implement method to find/get a user by its account name.
+
+2012-08-23	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java:
+	  Also add the account information when listing users.
+
+2012-08-23	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java:
+	  Add account information to createUser
+
+2012-08-23	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java:
+	  Read the account information from the database.
+
+2012-08-23	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/LazyBackendUser.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUserFactory.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUser.java:
+	  Extend user class implementations to handle account information.
+
+2012-08-23	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifacts/src/main/java/de/intevation/artifacts/UserFactory.java,
+	  artifacts/src/main/java/de/intevation/artifacts/User.java:
+	  Extend user interfaces to handle account information.
+
+2012-08-23	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifact-database/src/main/resources/sql/org-h2-driver.properties,
+	  artifact-database/src/main/resources/sql/org-postgresql-driver.properties:
+	  Update sql user queries to add the account column.
+
+2012-08-23	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifact-database/doc/schema-pg.sql,
+	  artifact-database/doc/schema-h2.sql:
+	  Add a account column to the users table.
+
+2012-07-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/state/FacetActivity.java:
+	  Refactored registry to use a Chain-of-responsibility pattern. This allows
+	  de-centralized facet activity treatment like in the facet producing states.
+
+2012-07-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/state/FacetActivity.java:
+	  Made Registry.getInstance() access static.
+
+2012-07-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/state/FacetActivity.java:
+	  New. Implementors of this interface can decide if a facet should be initially
+	  active or not. Contains a registry singleton.
+
+2012-07-27  Ingo Weinzierl <ingo@intevation.de>
+
+	Tagged trunk as '2.8.1'
+
+2012-07-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java:
+	  Added concat() to join two String arrays.
+
+2012-07-17	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactCollection.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactCollectionFactory.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/transition/TransitionEngine.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/DatabaseCleaner.java:
+	  Doc fixes.
+
+2012-07-16  Ingo Weinzierl <ingo@intevation.de>
+
+	Tagged trunk as '2.8'
+
+2012-07-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java:
+	  Added concat() to join two String arrays.
+
+2012-07-17	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactCollection.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactCollectionFactory.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/transition/TransitionEngine.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/DatabaseCleaner.java:
+	  Doc fixes.
+
+2012-07-16  Ingo Weinzierl <ingo@intevation.de>
+
+	Tagged trunk as '2.8'
+
+2012-07-15	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultSettings.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultSection.java,
+	  artifacts/src/main/java/de/intevation/artifacts/DataProvider.java,
+	  artifacts/src/main/java/de/intevation/artifacts/ArtifactFactory.java:
+	  Removed same package imports.
+
+2012-07-03	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java:
+	  Added contains(String needle, String [] haystack) method.
+
+2012-07-03  Ingo Weinzierl <ingo@intevation.de>
+
+	* artifact-database/.settings/org.eclipse.jdt.core.prefs: Removed from
+	  version control (Eclipse configurations should not be in SVN!).
+
+2012-02-26	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/rest/UserResource.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactContext.java:
+	  Cosmetics, doc.
+
+2012-06-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/**/*.java:
+	  Removed trailing whitespace.
+
+2012-06-05  Ingo Weinzierl <ingo@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/DatabaseCleaner.java:
+	  Added some more debug output during the process of removing Artifacts
+	  and Collections with the DatabaseCleaner.
+
+2012-06-01	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java:
+	  Remove extra <map></map> from the XML generated by JSON lists containing only 
+	  objects.
+
 2012-05-27  Ingo Weinzierl <ingo@intevation.de>
 
 	Tagged trunk as '2.7'
--- a/artifact-database/.settings/org.eclipse.jdt.core.prefs	Sun May 27 10:40:55 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-#Tue Sep 08 09:33:09 CEST 2009
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.source=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
--- a/artifact-database/doc/schema-h2.sql	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/doc/schema-h2.sql	Fri Sep 28 12:15:12 2012 +0200
@@ -23,7 +23,8 @@
 CREATE TABLE users (
     id   INT PRIMARY KEY NOT NULL,
     gid  UUID            NOT NULL UNIQUE,
-    name VARCHAR(256)    NOT NULL UNIQUE,
+    name VARCHAR(256)    NOT NULL,
+    account VARCHAR(256) NOT NULL UNIQUE,
     role BINARY
 );
 
--- a/artifact-database/doc/schema-pg.sql	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/doc/schema-pg.sql	Fri Sep 28 12:15:12 2012 +0200
@@ -23,7 +23,8 @@
 CREATE TABLE users (
     id   int PRIMARY KEY NOT NULL,
     gid  uuid            NOT NULL UNIQUE,
-    name VARCHAR(256)    NOT NULL UNIQUE,
+    name VARCHAR(256)    NOT NULL,
+    account VARCHAR(256) NOT NULL UNIQUE,
     role bytea
 );
 
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java	Fri Sep 28 12:15:12 2012 +0200
@@ -59,9 +59,9 @@
     /**
      * The default constructor of this abstract CallContext.
      *
+     * @param artifactDatabase The artifact database.
      * @param action The action.
      * @param callMeta The CallMeta object.
-     * @param context The global context.
      */
     public AbstractCallContext(
         ArtifactDatabaseImpl artifactDatabase,
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java	Fri Sep 28 12:15:12 2012 +0200
@@ -197,6 +197,14 @@
     public static final String XPATH_USERROLE =
         "/art:action/art:user/art:role";
 
+    /** XPath to figure out the account of a new user.*/
+    public static final String XPATH_USERACCOUNT =
+        "/art:action/art:user/art:account/@name";
+
+    /** XPath to figure out the account of when searching for a user .*/
+    public static final String XPATH_USERACCOUNT_FIND =
+        "/art:action/art:account/@name";
+
     /** Error message if a specified user does not exist.*/
     public static final String NO_SUCH_USER =
         "No such user";
@@ -205,6 +213,10 @@
     public static final String NO_USERNAME =
         "Invalid username";
 
+    /** Error message if no user account is given for user creation.*/
+    public static final String NO_USERACCOUNT =
+        "Invalid user account name";
+
     // Collection constants
 
     /**
@@ -1180,6 +1192,7 @@
 
     // User API
 
+    /** Returns user(s) elements. */
     public Document listUsers(CallMeta callMeta)
         throws ArtifactDatabaseException
     {
@@ -1205,20 +1218,74 @@
         Element root = ec.create("users");
         result.appendChild(root);
 
-        for (User user: users) {
-            Element ue = ec.create("user");
+        if(users != null) {
+            for (User user: users) {
+                Element ue = ec.create("user");
+                ec.addAttr(ue, "uuid", user.identifier(), true);
+                ec.addAttr(ue, "name", user.getName(), true);
+                Element ua = ec.create("account");
+                ec.addAttr(ua, "name", user.getAccount(), true);
+                ue.appendChild(ua);
+
+                Document role = user.getRole();
+
+                if (role != null) {
+                    ue.appendChild(result.importNode(role.getFirstChild(), true));
+                }
+
+                root.appendChild(ue);
+            }
+        }
+
+        return result;
+    }
+
+    /** Search for a user. */
+    public Document findUser(Document data, CallMeta callMeta)
+        throws ArtifactDatabaseException
+    {
+        UserFactory factory = getUserFactory();
+
+        if (factory == null) {
+            throw new ArtifactDatabaseException(NO_SUCH_FACTORY);
+        }
+
+        String account = XMLUtils.xpathString(
+            data, XPATH_USERACCOUNT_FIND, ArtifactNamespaceContext.INSTANCE);
+
+        if (account == null || account.length() == 0) {
+            logger.warn("Can't find user without account!");
+            throw new ArtifactDatabaseException(NO_USERACCOUNT);
+        }
+
+        User user = backend.findUser(account, factory, context);
+
+        Document result = XMLUtils.newDocument();
+
+        XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
+            result,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        Element ue = ec.create("user");
+
+        if (user != null) {
+            logger.debug(user + " user found in the backend.");
+
             ec.addAttr(ue, "uuid", user.identifier(), true);
             ec.addAttr(ue, "name", user.getName(), true);
+            Element ua = ec.create("account");
+            ec.addAttr(ua, "name", user.getAccount(), true);
+            ue.appendChild(ua);
 
             Document role = user.getRole();
 
             if (role != null) {
                 ue.appendChild(result.importNode(role.getFirstChild(), true));
             }
+        }
 
-            root.appendChild(ue);
-
-        }
+        result.appendChild(ue);
 
         return result;
     }
@@ -1240,6 +1307,14 @@
             throw new ArtifactDatabaseException(NO_USERNAME);
         }
 
+        String account = XMLUtils.xpathString(
+            data, XPATH_USERACCOUNT, ArtifactNamespaceContext.INSTANCE);
+
+        if (account == null || account.length() == 0) {
+            logger.warn("User without account not accepted!");
+            throw new ArtifactDatabaseException(NO_USERACCOUNT);
+        }
+
         Node tmp = (Node) XMLUtils.xpath(
             data,
             XPATH_USERROLE,
@@ -1256,7 +1331,7 @@
         User newUser = null;
 
         try {
-            newUser = backend.createUser(name, role, userFactory, context);
+            newUser = backend.createUser(name, account, role, userFactory, context);
         }
         catch (Exception e) {
             logger.error(e.getMessage(), e);
@@ -1867,7 +1942,7 @@
     }
 
     @Override
-    public void loadAllArtifacts(ArtifactLoadedCallback callback) 
+    public void loadAllArtifacts(ArtifactLoadedCallback callback)
         throws ArtifactDatabaseException
     {
         logger.debug("loadAllArtifacts");
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java	Fri Sep 28 12:15:12 2012 +0200
@@ -96,6 +96,7 @@
     public String SQL_USERS_INSERT;
     public String SQL_USERS_SELECT_ID_BY_GID;
     public String SQL_USERS_SELECT_GID;
+    public String SQL_USERS_SELECT_ACCOUNT;
     public String SQL_USERS_DELETE_ID;
     public String SQL_USERS_DELETE_COLLECTIONS;
     public String SQL_USERS_SELECT_ALL;
@@ -311,6 +312,7 @@
         SQL_USERS_INSERT = sql.get("users.insert");
         SQL_USERS_SELECT_ID_BY_GID = sql.get("users.select.id.by.gid");
         SQL_USERS_SELECT_GID = sql.get("users.select.gid");
+        SQL_USERS_SELECT_ACCOUNT = sql.get("users.select.account");
         SQL_USERS_DELETE_ID = sql.get("users.delete.id");
         SQL_USERS_DELETE_COLLECTIONS = sql.get("users.delete.collections");
         SQL_USERS_SELECT_ALL = sql.get("users.select.all");
@@ -809,6 +811,7 @@
 
     public User createUser(
         final String      name,
+        final String      account,
         final Document    role,
         final UserFactory factory,
         final Object      context
@@ -838,19 +841,20 @@
                 stmnt.setInt(1, id);
                 stmnt.setString(2, identifier);
                 stmnt.setString(3, name);
+                stmnt.setString(4, account);
 
                 if (roleData == null) {
-                    stmnt.setNull(4, Types.BIGINT);
+                    stmnt.setNull(5, Types.BIGINT);
                 }
                 else {
-                    stmnt.setBytes(4, roleData);
+                    stmnt.setBytes(5, roleData);
                 }
 
                 stmnt.execute();
                 conn.commit();
 
                 user[0] = factory.createUser(
-                    identifier, name, role, context);
+                    identifier, name, account, role, context);
                 return true;
             }
         };
@@ -965,12 +969,50 @@
                 }
                 // omit id
                 String  name     = result.getString(2);
-                byte [] roleData = result.getBytes(3);
+                String account   = result.getString(3);
+                byte [] roleData = result.getBytes(4);
 
                 Document role = XMLUtils.fromByteArray(roleData, true);
 
                 user[0] = factory.createUser(
-                    identifier, name, role, context);
+                    identifier, name, account, role, context);
+                return true;
+            }
+        };
+
+        return exec.runRead() ? user[0] : null;
+    }
+
+    /**
+     * Find/Get user by account
+     */
+    public User findUser(
+        final String      account,
+        final UserFactory factory,
+        final Object      context
+    ) {
+
+        final User [] user = new User[1];
+        logger.debug("Tying to find user by account " + account);
+
+        SQLExecutor.Instance exec = sqlExecutor.new Instance() {
+            public boolean doIt() throws SQLException {
+                prepareStatement(SQL_USERS_SELECT_ACCOUNT);
+                stmnt.setString(1, account);
+                result = stmnt.executeQuery();
+                if (!result.next()) { // no such user
+                    logger.debug("No user found.");
+                    return false;
+                }
+                String  identifier = result.getString(1);
+                String  name     = result.getString(2);
+                String account   = result.getString(3);
+                byte [] roleData = result.getBytes(4);
+
+                Document role = XMLUtils.fromByteArray(roleData, true);
+
+                user[0] = factory.createUser(
+                    identifier, name, account, role, context);
                 return true;
             }
         };
@@ -993,11 +1035,12 @@
                     // omit id
                     String  identifier = result.getString(2);
                     String  name       = result.getString(3);
-                    byte [] roleData   = result.getBytes(4);
+                    String  account    = result.getString(4);
+                    byte [] roleData   = result.getBytes(5);
 
                     Document role = XMLUtils.fromByteArray(roleData, true);
                     User user = factory.createUser(
-                        identifier, name, role, context);
+                        identifier, name, account, role, context);
                     users.add(user);
                 }
                 return true;
@@ -1308,6 +1351,8 @@
                 reset();
 
                 // outdate artifacts that are only in this collection
+                logger.info("Outdate Artifacts that belong to collection: " + id);
+
                 prepareStatement(SQL_OUTDATE_ARTIFACTS_COLLECTION);
                 stmnt.setInt(1, id);
                 stmnt.setInt(2, id);
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DBConfig.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DBConfig.java	Fri Sep 28 12:15:12 2012 +0200
@@ -57,7 +57,7 @@
     }
 
     private static DBConfig createInstance() {
-        
+
         String driver = Config.getStringXPath(
             DB_DRIVER, DBConnection.DEFAULT_DRIVER);
 
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DatabaseCleaner.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DatabaseCleaner.java	Fri Sep 28 12:15:12 2012 +0200
@@ -171,7 +171,6 @@
      * Living artifacts are artifacts which are currently active
      * inside the artifact database. Deleting them in this state
      * would create severe internal problems.
-     * @param filter
      */
     public void setLockedIdsProvider(LockedIdsProvider lockedIdsProvider) {
         this.lockedIdsProvider = lockedIdsProvider;
@@ -219,7 +218,7 @@
         }
     } // class IdIdentifier
 
-    private static final class IdData 
+    private static final class IdData
     extends IdIdentifier
     {
         byte [] data;
@@ -227,7 +226,7 @@
 
         public IdData(
             int     id,
-            String  factoryName, 
+            String  factoryName,
             byte [] data,
             String  identifier
         ) {
@@ -307,6 +306,7 @@
             stmnt = connection.prepareStatement(SQL_DELETE_COLLECTION_ITEMS);
 
             for (IdIdentifier id: cs) {
+                logger.debug("Mark collection for deletion: " + id.id);
                 stmnt.setInt(1, id.id);
                 stmnt.execute();
             }
@@ -355,17 +355,23 @@
                         idData.factoryName, idData.data);
                     idData.data = null;
 
+                    logger.debug("Prepare Artifact (id="
+                        + idData.id + ") for deletion.");
+
                     stmnt.setInt(1, idData.id);
                     stmnt.execute();
                     connection.commit();
 
                     try {
                         if (artifact != null) {
+                            logger.debug("Call endOfLife for Artifact: "
+                                + artifact.identifier());
+
                             artifact.endOfLife(context);
                         }
                     }
                     catch (Exception e) {
-                        logger.error(e.getLocalizedMessage(), e);
+                        logger.error(e.getMessage(), e);
                     }
 
                     deletedArtifacts.add(idData.identifier);
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactCollection.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactCollection.java	Fri Sep 28 12:15:12 2012 +0200
@@ -141,7 +141,7 @@
 
     /**
      * Name of this collection.
-     * @return Returns the name of this collection
+     * @param name the name of this collection
      */
     public void setName(String name) {
         this.name = name;
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactCollectionFactory.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactCollectionFactory.java	Fri Sep 28 12:15:12 2012 +0200
@@ -103,8 +103,6 @@
 
     /**
      * Returns the time to live of the given artifact.
-     *
-     * @param artifact
      */
     public Long timeToLiveUntouched(
         ArtifactCollection collection,
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactContext.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactContext.java	Fri Sep 28 12:15:12 2012 +0200
@@ -30,7 +30,7 @@
     /**
      * Custom key/value pairs to be used globally in the whole server.
      */
-    protected HashMap  map;
+    protected HashMap map;
 
     /**
      * Default constructor
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUser.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUser.java	Fri Sep 28 12:15:12 2012 +0200
@@ -25,6 +25,9 @@
     /** The name of the user.*/
     protected String name;
 
+    /** The account name of the user.*/
+    protected String account;
+
     /** The role of the user.*/
     protected Document role;
 
@@ -44,12 +47,15 @@
      *
      * @param identifier The uuid of the user.
      * @param name The name of the user.
+     * @param account The account name of the user.
      * @param role The role of the user.
      */
-    public DefaultUser(String identifier, String name, Document role) {
+    public DefaultUser(String identifier, String name, String account,
+                       Document role) {
         this.identifier = identifier;
         this.name       = name;
         this.role       = role;
+        this.account    = account;
     }
 
 
@@ -58,6 +64,7 @@
      *
      * @return the identifier of this user.
      */
+    @Override
     public String identifier() {
         return identifier;
     }
@@ -68,6 +75,7 @@
      *
      * @return the name of the user.
      */
+    @Override
     public String getName() {
         return name;
     }
@@ -78,6 +86,7 @@
      *
      * @param name The name for this user.
      */
+    @Override
     public void setName(String name) {
         this.name = name;
     }
@@ -88,6 +97,7 @@
      *
      * @param identifier The new identifier.
      */
+    @Override
     public void setIdentifier(String identifier) {
         this.identifier = identifier;
     }
@@ -98,6 +108,7 @@
      *
      * @param role The new role of the user.
      */
+    @Override
     public void setRole(Document role) {
         this.role = role;
     }
@@ -108,8 +119,19 @@
      *
      * @return the role of the user.
      */
+    @Override
     public Document getRole() {
         return role;
     }
+
+    /**
+     * Returns the account of the user.
+     *
+     * @return the account name of the user.
+     */
+    @Override
+    public String getAccount() {
+        return account;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUserFactory.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUserFactory.java	Fri Sep 28 12:15:12 2012 +0200
@@ -47,17 +47,19 @@
      *
      * @param identifier The identifier for the new user.
      * @param name The name for the new user.
+     * @param account The name of the new users account.
      * @param role The role for the new user.
      * @param context The CallContext.
      */
     public User createUser(
         String   identifier,
         String   name,
+        String   account,
         Document role,
         Object   context)
     {
         logger.debug("DefaultUserFactory.createUser: " + name);
-        return new DefaultUser(identifier, name, role);
+        return new DefaultUser(identifier, name, account, role);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/LazyBackendUser.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/LazyBackendUser.java	Fri Sep 28 12:15:12 2012 +0200
@@ -43,28 +43,39 @@
         return user;
     }
 
+    @Override
     public String identifier() {
         return getUser().identifier();
     }
 
+    @Override
     public String getName() {
         return getUser().getName();
     }
 
+    @Override
     public void setName(String name) {
         getUser().setName(name);
     }
 
+    @Override
     public void setIdentifier(String identifier) {
         getUser().setIdentifier(identifier);
     }
 
+    @Override
     public Document getRole() {
         return getUser().getRole();
     }
 
+    @Override
     public void setRole(Document document) {
         getUser().setRole(document);
     }
+
+    @Override
+    public String getAccount() {
+        return getUser().getAccount();
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java	Fri Sep 28 12:15:12 2012 +0200
@@ -157,7 +157,7 @@
      * This method appends a node for each Output in the <i>outputs</i> list to
      * <i>out</i>. Note: an output node includes its provided facets!
      *
-     * @param creator The ElementCreator used to create new elements.
+     * @param doc The document to which to add new elements.
      * @param out The parent node for new elements.
      * @param outputs The list of reachable outputs.
      */
@@ -195,7 +195,7 @@
      * This method appends a node for each Facet in the <i>facets</i> list to
      * <i>facet</i>.
      *
-     * @param creator The ElementCreator used to create new elements.
+     * @param doc The document to wich to add new elements.
      * @param facet The root node for new elements.
      * @param facets The list of facets.
      */
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/db/SQL.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/db/SQL.java	Fri Sep 28 12:15:12 2012 +0200
@@ -50,7 +50,7 @@
         Class  clazz,
         String resourcePath,
         String driver
-    ) { 
+    ) {
         logger.debug("loadStatements");
 
         Properties properties = new Properties();
@@ -105,7 +105,7 @@
         }
 
         if (debug) {
-            logger.debug("-> '" + sql + "'"); 
+            logger.debug("-> '" + sql + "'");
         }
 
         return sql;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/FindUserResource.java	Fri Sep 28 12:15:12 2012 +0200
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2011 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+package de.intevation.artifactdatabase.rest;
+
+import java.io.IOException;
+
+import org.apache.log4j.Logger;
+
+import org.restlet.data.MediaType;
+import org.restlet.data.Status;
+import org.restlet.ext.xml.DomRepresentation;
+import org.restlet.representation.EmptyRepresentation;
+import org.restlet.representation.Representation;
+import org.restlet.resource.ResourceException;
+import org.restlet.Response;
+
+import org.w3c.dom.Document;
+
+import de.intevation.artifacts.ArtifactDatabase;
+import de.intevation.artifacts.ArtifactDatabaseException;
+
+/**
+ * A Rest resource that finds the user provided by the artifact database.
+ *
+ */
+public class FindUserResource
+extends      BaseResource
+{
+    /** The logger that is used in this class.*/
+    private static Logger logger = Logger.getLogger(FindUserResource.class);
+
+    /** server URL where to reach the resource.*/
+    public static final String PATH = "/find-user";
+
+
+    @Override
+    protected Representation innerPost(Representation requestRepr)
+    throws    ResourceException
+    {
+        Document input = null;
+
+        try {
+            DomRepresentation in = new DomRepresentation(requestRepr);
+            in.setNamespaceAware(true);
+            input = in.getDocument();
+        }
+        catch (IOException ioe) {
+            logger.error(ioe.getLocalizedMessage(), ioe);
+
+            Response response = getResponse();
+            response.setStatus(Status.CLIENT_ERROR_BAD_REQUEST, ioe);
+            return new EmptyRepresentation();
+        }
+
+        ArtifactDatabase db = getArtifactDatabase();
+
+        try {
+            logger.info(PATH);
+
+            return new DomRepresentation(
+                MediaType.APPLICATION_XML,
+                db.findUser(input, getCallMeta()));
+        }
+        catch (ArtifactDatabaseException adbe) {
+            logger.warn(adbe.getLocalizedMessage(), adbe);
+
+            Response response = getResponse();
+            response.setStatus(
+                Status.CLIENT_ERROR_UNPROCESSABLE_ENTITY, adbe.getMessage());
+            return new EmptyRepresentation();
+        }
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/RestApp.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/RestApp.java	Fri Sep 28 12:15:12 2012 +0200
@@ -81,6 +81,7 @@
         router.attach(CreateUserResource.PATH,  CreateUserResource.class);
         router.attach(ListUsersResource.PATH,   ListUsersResource.class);
         router.attach(UserResource.PATH,        UserResource.class);
+        router.attach(FindUserResource.PATH,    FindUserResource.class);
         router.attach(
             CreateCollectionResource.PATH, CreateCollectionResource.class);
         router.attach(
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/UserResource.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/UserResource.java	Fri Sep 28 12:15:12 2012 +0200
@@ -35,10 +35,10 @@
 public class UserResource
 extends      BaseResource
 {
-    /** The logger that is used in this class.*/
+    /** The logger that is used in this class. */
     private static Logger logger = Logger.getLogger(UserResource.class);
 
-    /** server URL where to reach the resource.*/
+    /** server URL where to reach the resource. */
     public static final String PATH = "/user/{uuid}";
 
     /**
@@ -47,13 +47,13 @@
      */
     public static final String XPATH_ACTION = "/art:action/art:type/@name";
 
-    /** Error message if no action was given.*/
+    /** Error message if no action was given. */
     public static final String NO_ACTION_MSG = "no action given";
 
-    /** Error message if a unknown action was given.*/
+    /** Error message if a unknown action was given. */
     public static final String NO_SUCH_ACTION_MSG = "no such action";
 
-    /** Action name for deleting users.*/
+    /** Action name for deleting users. */
     public static final String ACTION_DELETE = "delete";
 
 
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java	Fri Sep 28 12:15:12 2012 +0200
@@ -194,7 +194,7 @@
      * with the key <i>name</i>, this object is overwritten by the new value.
      *
      * @param name The name of the data object.
-     * @param StateData The data object.
+     * @param data The data object.
      */
     public void addData(String name, StateData data) {
         if (this.data == null) {
@@ -274,10 +274,18 @@
         int size = outs.getLength();
 
         for (int i = 0; i < size; i++) {
-            outputs.add(buildOutput(outs.item(i)));
+            addOutput(buildOutput(outs.item(i)));
         }
     }
 
+    /**
+     * This methods allows subclasses to manually add outputs
+     *
+     * @param out The output to add
+     */
+    protected void addOutput(Output out) {
+        outputs.add(out);
+    }
 
     /**
      * A helper method that creates an Output object based on the <i>out</i>
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultSection.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultSection.java	Fri Sep 28 12:15:12 2012 +0200
@@ -1,7 +1,7 @@
 package de.intevation.artifactdatabase.state;
 
 import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -10,11 +10,8 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-import de.intevation.artifactdatabase.state.Attribute;
-import de.intevation.artifactdatabase.state.Section;
-
-
 /**
+ * Attributes keep the order in which they were inserted.
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class DefaultSection implements Section {
@@ -23,6 +20,7 @@
 
     protected List<Section> subsections;
 
+    /** Attribute-map. */
     protected Map<String, Attribute> attributes;
 
 
@@ -32,7 +30,8 @@
      */
     public DefaultSection(String id) {
         this.id          = id;
-        this.attributes  = new HashMap<String, Attribute>();
+        // Use LinkedHashMap to keep insertion order.
+        this.attributes  = new LinkedHashMap<String, Attribute>();
         this.subsections = new ArrayList<Section>();
     }
 
@@ -67,6 +66,7 @@
     }
 
 
+    /** Adding attribute to end of list. */
     @Override
     public void addAttribute(String key, Attribute attribute) {
         if (key != null && key.length() > 0 && attribute != null) {
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultSettings.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultSettings.java	Fri Sep 28 12:15:12 2012 +0200
@@ -7,9 +7,6 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-import de.intevation.artifactdatabase.state.Section;
-import de.intevation.artifactdatabase.state.Settings;
-
 
 /**
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/state/FacetActivity.java	Fri Sep 28 12:15:12 2012 +0200
@@ -0,0 +1,80 @@
+package de.intevation.artifactdatabase.state;
+
+import de.intevation.artifacts.Artifact;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public interface FacetActivity
+{
+    public static final FacetActivity ACTIVE = new FacetActivity() {
+        @Override
+        public Boolean isInitialActive(
+            Artifact artifact,
+            Facet    facet,
+            String   output
+        ) {
+            return Boolean.TRUE;
+        }
+    };
+
+    public static final FacetActivity INACTIVE = new FacetActivity() {
+        @Override
+        public Boolean isInitialActive(
+            Artifact artifact,
+            Facet    facet,
+            String   output
+        ) {
+            return Boolean.FALSE;
+        }
+    };
+
+    Boolean isInitialActive(Artifact artifact, Facet facet, String output);
+
+    public static final class Registry {
+
+        private static final Registry INSTANCE = new Registry();
+
+        private Map<String, List<FacetActivity>> activities;
+
+        private Registry() {
+            activities = new HashMap<String, List<FacetActivity>>();
+        }
+
+        public static Registry getInstance() {
+            return INSTANCE;
+        }
+
+        public synchronized boolean isInitialActive(
+            String   key,
+            Artifact artifact,
+            Facet    facet,
+            String   output
+        ) {
+            List<FacetActivity> activityList = activities.get(key);
+            if (activityList == null) {
+                return true;
+            }
+            for (FacetActivity activity: activityList) {
+                Boolean isActive =
+                    activity.isInitialActive(artifact, facet, output);
+                if (isActive != null) {
+                    return isActive;
+                }
+            }
+            return true;
+        }
+
+        public synchronized void register(String key, FacetActivity activity) {
+            List<FacetActivity> activityList = activities.get(key);
+            if (activityList == null) {
+                activityList = new ArrayList<FacetActivity>(3);
+                activities.put(key, activityList);
+            }
+            activityList.add(activity);
+        }
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/transition/TransitionEngine.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/transition/TransitionEngine.java	Fri Sep 28 12:15:12 2012 +0200
@@ -44,7 +44,7 @@
      * Add new transitions for a specific artifact.
      *
      * @param stateId the name of the Artifact.
-     * @param transitions the list of transition of the artifact.
+     * @param transition the list of transition of the artifact.
      *
      * @return true, if the transitions were added, otherwise false.
      */
--- a/artifact-database/src/main/resources/sql/org-h2-driver.properties	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/resources/sql/org-h2-driver.properties	Fri Sep 28 12:15:12 2012 +0200
@@ -33,16 +33,17 @@
 
 users.id.nextval=SELECT NEXTVAL('USERS_ID_SEQ')
 
-users.insert=INSERT INTO users (id, gid, name, role) VALUES (?, ?, ?, ?)
+users.insert=INSERT INTO users (id, gid, name, account, role) VALUES (?, ?, ?, ?, ?)
 
 users.select.id.by.gid=SELECT id FROM users WHERE gid = ?
-users.select.gid=SELECT id, name, role FROM users WHERE gid = ?
+users.select.gid=SELECT id, name, account, role FROM users WHERE gid = ?
+users.select.account=SELECT gid, name, account, role FROM users WHERE account = ?
 
 users.delete.id=DELETE FROM users WHERE id = ?
 
 users.delete.collections=DELETE FROM collections where owner_id = ?
 
-users.select.all=SELECT id, gid, name, role FROM users
+users.select.all=SELECT id, gid, name, account, role FROM users
 
 collection.check.artifact=SELECT id FROM collection_items \
     WHERE artifact_id = ? AND collection_id = ?
--- a/artifact-database/src/main/resources/sql/org-postgresql-driver.properties	Sun May 27 10:40:55 2012 +0000
+++ b/artifact-database/src/main/resources/sql/org-postgresql-driver.properties	Fri Sep 28 12:15:12 2012 +0200
@@ -33,16 +33,17 @@
 
 users.id.nextval=SELECT NEXTVAL('USERS_ID_SEQ')
 
-users.insert=INSERT INTO users (id, gid, name, role) VALUES (?, ?::uuid, ?, ?)
+users.insert=INSERT INTO users (id, gid, name, account, role) VALUES (?, ?::uuid, ?, ?, ?)
 
 users.select.id.by.gid=SELECT id FROM users WHERE gid = ?::uuid
-users.select.gid=SELECT id, name, role FROM users WHERE gid = ?::uuid
+users.select.gid=SELECT id, name, account, role FROM users WHERE gid = ?::uuid
+users.select.account=SELECT gid, name, account, role FROM users WHERE account = ?
 
 users.delete.id=DELETE FROM users WHERE id = ?
 
 users.delete.collections=DELETE FROM collections where owner_id = ?
 
-users.select.all=SELECT id, gid, name, role FROM users
+users.select.all=SELECT id, gid, name, account, role FROM users
 
 collection.check.artifact=SELECT id FROM collection_items \
     WHERE artifact_id = ? AND collection_id = ?
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/FileTools.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/FileTools.java	Fri Sep 28 12:15:12 2012 +0200
@@ -125,7 +125,7 @@
         return curr;
     }
 
-    public static class HashedFile 
+    public static class HashedFile
     implements Comparable<HashedFile>
     {
         protected File    file;
@@ -202,7 +202,7 @@
 
         @Override
         public boolean equals(Object other) {
-            return other instanceof HashedFile 
+            return other instanceof HashedFile
                 && ((HashedFile)other).compareTo(this) == 0;
         }
 
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/JSON.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/JSON.java	Fri Sep 28 12:15:12 2012 +0200
@@ -26,7 +26,7 @@
     }
 
     public static final boolean isWhitespace(int c) {
-        return c == ' '  || c == '\n' || c == '\r' 
+        return c == ' '  || c == '\n' || c == '\r'
             || c == '\t' || c == '\f';
     }
 
@@ -160,8 +160,8 @@
         out.print(']');
     }
 
-    public static Map<String, Object> parse(String in) 
-    throws IOException 
+    public static Map<String, Object> parse(String in)
+    throws IOException
     {
         return parse(asInputStream(in));
     }
@@ -178,14 +178,14 @@
         return new ByteArrayInputStream(bytes);
     }
 
-    public static Map<String, Object> parse(InputStream in) 
-    throws IOException 
+    public static Map<String, Object> parse(InputStream in)
+    throws IOException
     {
         return parseObject(new PushbackInputStream(in, 1));
     }
 
-    public static Map<String, Object> parse(PushbackInputStream in) 
-    throws IOException 
+    public static Map<String, Object> parse(PushbackInputStream in)
+    throws IOException
     {
         return parseObject(in);
     }
@@ -266,7 +266,7 @@
 
     private static final Boolean parseTrue(InputStream in)
     throws IOException
-    { 
+    {
         match('t', eof(in));
         match('r', eof(in));
         match('u', eof(in));
@@ -276,7 +276,7 @@
 
     private static final Boolean parseFalse(InputStream in)
     throws IOException
-    { 
+    {
         match('f', eof(in));
         match('a', eof(in));
         match('l', eof(in));
@@ -287,7 +287,7 @@
 
     private static final Object parseNull(InputStream in)
     throws IOException
-    { 
+    {
         match('n', eof(in));
         match('u', eof(in));
         match('l', eof(in));
@@ -415,7 +415,7 @@
         pairs.put(string, value);
     }
 
-    private static Map<String, Object> parseObject(PushbackInputStream in) 
+    private static Map<String, Object> parseObject(PushbackInputStream in)
     throws IOException
     {
         Map<String, Object> pairs = new LinkedHashMap<String, Object>();
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/LRUCache.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/LRUCache.java	Fri Sep 28 12:15:12 2012 +0200
@@ -4,7 +4,7 @@
 import java.util.LinkedHashMap;
 
 public class LRUCache<K, V>
-extends      LinkedHashMap<K, V> 
+extends      LinkedHashMap<K, V>
 {
     public static final int DEFAULT_MAX_CAPACITY = 25;
 
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java	Fri Sep 28 12:15:12 2012 +0200
@@ -115,7 +115,7 @@
             }
         }
         return d;
-    }    
+    }
 
     public static String join(String sep, String [] strings) {
         StringBuilder sb = new StringBuilder();
@@ -125,5 +125,24 @@
         }
         return sb.toString();
     }
+
+    public static final String [] join(String [] a, String [] b) {
+        if (a == null && b == null) return null;
+        if (a == null) return b;
+        if (b == null) return a;
+        String [] dst = new String[a.length + b.length];
+        System.arraycopy(a, 0, dst, 0, a.length);
+        System.arraycopy(b, 0, dst, a.length, b.length);
+        return dst;
+    }
+
+    public static final boolean contains(String needle, String [] haystack) {
+        for (String stray: haystack) {
+            if (needle.equals(stray)) {
+                return true;
+            }
+        }
+        return false;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XMLUtils.java	Fri Sep 28 12:15:12 2012 +0200
@@ -507,6 +507,14 @@
         void add(String key, Object value) {
             attributes.put(key, value != null ? value.toString() : "null");
         }
+
+        int numChildren() {
+            return children.size();
+        }
+
+        Node firstChild() {
+            return children.get(0);
+        }
     } // class BuildResult
 
     private static BuildResult recursiveBuild(
@@ -516,11 +524,16 @@
         BuildResult result = new BuildResult();
         for (Object entry: list) {
             if (entry instanceof Map) {
-                Element element = document.createElement("map");
                 BuildResult subResult = recursiveBuild(
                     (Map<String, Object>)entry, document);
-                subResult.finish(element);
-                result.add(element);
+                if (subResult.numChildren() == 1) {
+                    result.add(subResult.firstChild());
+                }
+                else {
+                    Element element = document.createElement("map");
+                    subResult.finish(element);
+                    result.add(element);
+                }
             }
             else if (entry instanceof List) {
                 Element element = document.createElement("list");
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XSLTransformer.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/XSLTransformer.java	Fri Sep 28 12:15:12 2012 +0200
@@ -21,7 +21,7 @@
 
 import org.w3c.dom.Node;
 
-public class XSLTransformer { 
+public class XSLTransformer {
 
     private static Logger log = Logger.getLogger(XSLTransformer.class);
 
--- a/artifacts/pom.xml	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts/pom.xml	Fri Sep 28 12:15:12 2012 +0200
@@ -22,8 +22,8 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>2.0.2</version>
         <configuration>
-          <source>1.5</source>
-          <target>1.5</target>
+          <source>1.6</source>
+          <target>1.6</target>
         </configuration>
       </plugin>
       <plugin>
--- a/artifacts/src/main/java/de/intevation/artifacts/ArtifactDatabase.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts/src/main/java/de/intevation/artifacts/ArtifactDatabase.java	Fri Sep 28 12:15:12 2012 +0200
@@ -215,6 +215,9 @@
     Document listUsers(CallMeta callMeta)
         throws ArtifactDatabaseException;
 
+    Document findUser(Document data, CallMeta callMeta)
+        throws ArtifactDatabaseException;
+
     Document createUser(Document data, CallMeta callMeta)
         throws ArtifactDatabaseException;
 
--- a/artifacts/src/main/java/de/intevation/artifacts/ArtifactFactory.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts/src/main/java/de/intevation/artifacts/ArtifactFactory.java	Fri Sep 28 12:15:12 2012 +0200
@@ -13,8 +13,6 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
-import de.intevation.artifacts.GlobalContext;
-
 
 /**
  * Interface of an artifact producing factory.
--- a/artifacts/src/main/java/de/intevation/artifacts/ArtifactNamespaceContext.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts/src/main/java/de/intevation/artifacts/ArtifactNamespaceContext.java	Fri Sep 28 12:15:12 2012 +0200
@@ -86,7 +86,7 @@
      */
     @Override
     public String getPrefix(String uri) {
-        
+
         if (uri == null) {
             throw new IllegalArgumentException("Null uri");
         }
--- a/artifacts/src/main/java/de/intevation/artifacts/CallContext.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts/src/main/java/de/intevation/artifacts/CallContext.java	Fri Sep 28 12:15:12 2012 +0200
@@ -8,8 +8,8 @@
 
 package de.intevation.artifacts;
 
+import java.util.LinkedList;
 import java.util.List;
-import java.util.LinkedList;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -110,7 +110,7 @@
      * Each call context has a clipboard.
      * getContextValue is used to fetch data from this board.
      * @param key Key of the requested item.
-     * @return The value stored for the secified value, null if
+     * @return The value stored for the specified value, null if
      *         no item with this key exists.
      */
     Object getContextValue(Object key);
--- a/artifacts/src/main/java/de/intevation/artifacts/DataProvider.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts/src/main/java/de/intevation/artifacts/DataProvider.java	Fri Sep 28 12:15:12 2012 +0200
@@ -1,7 +1,5 @@
 package de.intevation.artifacts;
 
-import de.intevation.artifacts.CallContext;
-
 /**
  * DataProviders register on a Blackboard with a key (basically shouting
  * "I can or know X!").
--- a/artifacts/src/main/java/de/intevation/artifacts/User.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts/src/main/java/de/intevation/artifacts/User.java	Fri Sep 28 12:15:12 2012 +0200
@@ -25,5 +25,7 @@
     void setRole(Document role);
 
     Document getRole();
+
+    String getAccount();
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/de/intevation/artifacts/UserFactory.java	Sun May 27 10:40:55 2012 +0000
+++ b/artifacts/src/main/java/de/intevation/artifacts/UserFactory.java	Fri Sep 28 12:15:12 2012 +0200
@@ -14,6 +14,7 @@
 {
     void setup(Document config, Node factoryNode);
 
-    User createUser(String identifier, String name, Document role, Object context);
+    User createUser(String identifier, String name, String account,
+                    Document role, Object context);
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/pom.xml	Sun May 27 10:40:55 2012 +0000
+++ b/pom.xml	Fri Sep 28 12:15:12 2012 +0200
@@ -27,8 +27,8 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>2.0.2</version>
         <configuration>
-          <source>1.5</source>
-          <target>1.5</target>
+          <source>1.6</source>
+          <target>1.6</target>
         </configuration>
       </plugin>
       <plugin>

http://dive4elements.wald.intevation.org