diff artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java @ 410:f456d9d55541

Read the account information from the database artifacts/trunk@5246 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Thu, 23 Aug 2012 13:45:16 +0000
parents b7831cefbb62
children f5ecca16f601
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java	Thu Aug 23 13:42:41 2012 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java	Thu Aug 23 13:45:16 2012 +0000
@@ -809,6 +809,7 @@
 
     public User createUser(
         final String      name,
+        final String      account,
         final Document    role,
         final UserFactory factory,
         final Object      context
@@ -838,19 +839,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 +967,13 @@
                 }
                 // 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;
             }
         };
@@ -993,11 +996,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;

http://dive4elements.wald.intevation.org