changeset 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 4748949c4f19
children 20f12944c710
files ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java
diffstat 2 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Aug 23 13:42:41 2012 +0000
+++ b/ChangeLog	Thu Aug 23 13:45:16 2012 +0000
@@ -1,4 +1,10 @@
 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:
--- 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