From 4c212f41362792bdf82f2f86d1d794b40e25e348 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Mon, 30 Oct 2017 16:48:23 +0100
Subject: [PATCH] import generated code

---
 lib/IdPAccountManager/DB.pm                   | 18 +++++++++++++
 lib/IdPAccountManager/DB/Object.pm            | 11 ++++++++
 .../Data/Authenticationtoken.pm               | 27 +++++++++++++++++++
 .../Data/Authenticationtoken/Manager.pm       | 14 ++++++++++
 lib/IdPAccountManager/Data/Serviceprovider.pm | 23 ++++++++++++++++
 .../Data/Serviceprovider/Manager.pm           | 14 ++++++++++
 lib/IdPAccountManager/Data/Testaccount.pm     | 19 +++++++------
 7 files changed, 116 insertions(+), 10 deletions(-)
 create mode 100644 lib/IdPAccountManager/DB.pm
 create mode 100644 lib/IdPAccountManager/DB/Object.pm
 create mode 100644 lib/IdPAccountManager/Data/Authenticationtoken.pm
 create mode 100644 lib/IdPAccountManager/Data/Authenticationtoken/Manager.pm
 create mode 100644 lib/IdPAccountManager/Data/Serviceprovider.pm
 create mode 100644 lib/IdPAccountManager/Data/Serviceprovider/Manager.pm

diff --git a/lib/IdPAccountManager/DB.pm b/lib/IdPAccountManager/DB.pm
new file mode 100644
index 0000000..1f412e4
--- /dev/null
+++ b/lib/IdPAccountManager/DB.pm
@@ -0,0 +1,18 @@
+package IdPAccountManager::DB;
+
+use strict;
+
+use base 'Rose::DB';
+
+__PACKAGE__->use_private_registry;
+
+__PACKAGE__->register_db
+(
+  connect_options => { AutoCommit => 1, ChopBlanks => 1 },
+  driver          => 'mysql',
+  dsn             => 'dbi:mysql:dbname=idp_account_manager;host=localhost',
+  password        => 'root',
+  username        => 'root',
+);
+
+1;
diff --git a/lib/IdPAccountManager/DB/Object.pm b/lib/IdPAccountManager/DB/Object.pm
new file mode 100644
index 0000000..b95451c
--- /dev/null
+++ b/lib/IdPAccountManager/DB/Object.pm
@@ -0,0 +1,11 @@
+package IdPAccountManager::DB::Object;
+
+use base 'Rose::DB::Object';
+
+use IdPAccountManager::DB;
+
+sub init_db {
+    IdPAccountManager::DB->new();
+}
+
+1;
diff --git a/lib/IdPAccountManager/Data/Authenticationtoken.pm b/lib/IdPAccountManager/Data/Authenticationtoken.pm
new file mode 100644
index 0000000..fbb7500
--- /dev/null
+++ b/lib/IdPAccountManager/Data/Authenticationtoken.pm
@@ -0,0 +1,27 @@
+package IdPAccountManager::Data::Authenticationtoken;
+
+use strict;
+
+use base 'IdPAccountManager::DB::Object';
+
+__PACKAGE__->meta->setup(
+    table   => 'authenticationtokens',
+
+    columns => [
+        id            => { type => 'bigserial', not_null => 1 },
+        token         => { type => 'varchar', length => 50, not_null => 1 },
+        email_address => { type => 'varchar', length => 200, not_null => 1 },
+        sp_entityid   => { type => 'varchar', length => 200, not_null => 1 },
+        creation_date => { type => 'integer' },
+    ],
+
+    primary_key_columns => [ 'id' ],
+
+    unique_keys => [
+        [ 'token' ],
+        [ 'email_address', 'sp_entityid' ],
+    ],
+);
+
+1;
+
diff --git a/lib/IdPAccountManager/Data/Authenticationtoken/Manager.pm b/lib/IdPAccountManager/Data/Authenticationtoken/Manager.pm
new file mode 100644
index 0000000..9d71c8e
--- /dev/null
+++ b/lib/IdPAccountManager/Data/Authenticationtoken/Manager.pm
@@ -0,0 +1,14 @@
+package IdPAccountManager::Data::Authenticationtoken::Manager;
+
+use strict;
+
+use base qw(Rose::DB::Object::Manager);
+
+use IdPAccountManager::Data::Authenticationtoken;
+
+sub object_class { 'IdPAccountManager::Data::Authenticationtoken' }
+
+__PACKAGE__->make_manager_methods('authenticationtokens');
+
+1;
+
diff --git a/lib/IdPAccountManager/Data/Serviceprovider.pm b/lib/IdPAccountManager/Data/Serviceprovider.pm
new file mode 100644
index 0000000..dc2046f
--- /dev/null
+++ b/lib/IdPAccountManager/Data/Serviceprovider.pm
@@ -0,0 +1,23 @@
+package IdPAccountManager::Data::Serviceprovider;
+
+use strict;
+
+use base 'IdPAccountManager::DB::Object';
+
+__PACKAGE__->meta->setup(
+    table   => 'serviceproviders',
+
+    columns => [
+        id          => { type => 'bigserial', not_null => 1 },
+        entityid    => { type => 'varchar', length => 200, not_null => 1 },
+        displayname => { type => 'varchar', length => 500 },
+        contacts    => { type => 'varchar', length => 2000 },
+    ],
+
+    primary_key_columns => [ 'id' ],
+
+    unique_key => [ 'entityid' ],
+);
+
+1;
+
diff --git a/lib/IdPAccountManager/Data/Serviceprovider/Manager.pm b/lib/IdPAccountManager/Data/Serviceprovider/Manager.pm
new file mode 100644
index 0000000..e23db29
--- /dev/null
+++ b/lib/IdPAccountManager/Data/Serviceprovider/Manager.pm
@@ -0,0 +1,14 @@
+package IdPAccountManager::Data::Serviceprovider::Manager;
+
+use strict;
+
+use base qw(Rose::DB::Object::Manager);
+
+use IdPAccountManager::Data::Serviceprovider;
+
+sub object_class { 'IdPAccountManager::Data::Serviceprovider' }
+
+__PACKAGE__->make_manager_methods('serviceproviders');
+
+1;
+
diff --git a/lib/IdPAccountManager/Data/Testaccount.pm b/lib/IdPAccountManager/Data/Testaccount.pm
index 3ecd53e..ad57af7 100644
--- a/lib/IdPAccountManager/Data/Testaccount.pm
+++ b/lib/IdPAccountManager/Data/Testaccount.pm
@@ -2,22 +2,21 @@ package IdPAccountManager::Data::Testaccount;
 
 use strict;
 
-use base qw(IdPAccountManager::Data::DB::Object::AutoBase2);
+use base 'IdPAccountManager::DB::Object';
 
 __PACKAGE__->meta->setup(
-    table => 'testaccounts',
+    table   => 'testaccounts',
 
     columns => [
-        id => { type => 'bigserial', not_null => 1 },
-        user_password_hash =>
-          { type => 'varchar', length => 50, not_null => 1 },
-        creation_date   => { type => 'integer' },
-        expiration_date => { type => 'integer' },
-        account_profile => { type => 'varchar', length => 100, not_null => 1 },
-        sp_entityid     => { type => 'varchar', length => 250, not_null => 1 },
+        id                 => { type => 'bigserial', not_null => 1 },
+        user_password_hash => { type => 'varchar', length => 50, not_null => 1 },
+        creation_date      => { type => 'integer' },
+        expiration_date    => { type => 'integer' },
+        account_profile    => { type => 'varchar', length => 100, not_null => 1 },
+        sp_entityid        => { type => 'varchar', length => 250, not_null => 1 },
     ],
 
-    primary_key_columns => ['id'],
+    primary_key_columns => [ 'id' ],
 );
 
 1;
-- 
GitLab