Revisited the persistence layer.
Simplified schema to focus on user and node. Now possible to have sqlite via ODBC and/or mysql support, and select using configuration file. Updated demo example.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
note
|
||||
description : "tests application root class"
|
||||
date : "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
|
||||
revision : "$Revision: 95678 $"
|
||||
date : "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
|
||||
revision : "$Revision: 96542 $"
|
||||
|
||||
class
|
||||
APPLICATION
|
||||
@@ -17,78 +17,25 @@ feature {NONE} -- Initialization
|
||||
make
|
||||
-- Run application.
|
||||
local
|
||||
user: USER_DATA_PROVIDER
|
||||
node: NODE_DATA_PROVIDER
|
||||
l_security: SECURITY_PROVIDER
|
||||
l_profile, l_db_profile: CMS_USER_PROFILE
|
||||
l_cursor: TABLE_ITERATION_CURSOR [READABLE_STRING_8, READABLE_STRING_8]
|
||||
l_list: LIST[CMS_NODE]
|
||||
storage: CMS_STORAGE
|
||||
l_node: CMS_NODE
|
||||
do
|
||||
create connection.login_with_schema ("cms_dev", "root", "")
|
||||
-- create user.make (connection)
|
||||
-- create node.make (connection)
|
||||
|
||||
(create {CLEAN_DB}).clean_db(connection)
|
||||
|
||||
create {CMS_STORAGE_MYSQL} storage.make (connection)
|
||||
l_node := custom_node ("Content", "Summary", "Title")
|
||||
storage.save_user (default_user)
|
||||
storage.save_user (custom_user ("u2", "p2", "e2"))
|
||||
storage.new_user (default_user)
|
||||
storage.new_user (custom_user ("u2", "p2", "e2"))
|
||||
l_node.set_author (storage.user_by_email (default_user.email))
|
||||
storage.save_node (l_node)
|
||||
if attached {CMS_NODE} storage.node (1) as ll_node then
|
||||
storage.new_node (l_node)
|
||||
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
|
||||
storage.update_node_title (2,ll_node.id, "New Title")
|
||||
check
|
||||
attached {CMS_NODE} storage.node (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary
|
||||
attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary
|
||||
end
|
||||
end
|
||||
|
||||
-- user.new_user ("test", "test","test@admin.com")
|
||||
-- if attached {CMS_USER} user.user_by_name ("test") as l_user then
|
||||
-- create l_profile.make
|
||||
-- l_profile.force ("Eiffel", "language")
|
||||
-- l_profile.force ("Argentina", "country")
|
||||
-- l_profile.force ("GMT-3", "time zone")
|
||||
-- user.save_profile (l_user.id, l_profile)
|
||||
-- l_db_profile := user.user_profile (l_user.id)
|
||||
-- from
|
||||
-- l_cursor := l_db_profile.new_cursor
|
||||
-- until
|
||||
-- l_cursor.after
|
||||
-- loop
|
||||
-- print (l_cursor.item + " - " + l_cursor.key + "%N")
|
||||
-- l_cursor.forth
|
||||
-- end
|
||||
|
||||
-- create {ARRAYED_LIST[CMS_NODE]} l_list.make (0)
|
||||
-- node.new_node (default_node)
|
||||
-- node.new_node (custom_node ("content1", "summary1", "title1"))
|
||||
-- node.new_node (custom_node ("content2", "summary2", "title2"))
|
||||
-- node.new_node (custom_node ("content3", "summary3", "title3"))
|
||||
-- user.new_user ("u1", "u1", "email")
|
||||
-- if attached user.user_by_name ("u1") as ll_user then
|
||||
-- node.add_collaborator (ll_user.id, 1)
|
||||
-- node.add_collaborator (ll_user.id, 2)
|
||||
-- node.add_collaborator (ll_user.id, 3)
|
||||
-- node.add_collaborator (ll_user.id, 4)
|
||||
|
||||
-- across node.collaborator_nodes (l_user.id) as c loop
|
||||
-- print (c.item.title)
|
||||
-- end
|
||||
|
||||
-- end
|
||||
|
||||
|
||||
-- if attached user.user_by_name ("u1") as ll_user then
|
||||
-- node.add_author (ll_user.id, 1)
|
||||
-- if attached node.node_author (1) as l_author then
|
||||
-- print (l_author.name)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
|
||||
-- end
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user