Updated Example (API) to use the new CMS_STORAGE interface.

This commit is contained in:
jvelilla
2014-09-21 15:53:09 -03:00
parent fb9157dbb4
commit 588827b495
10 changed files with 63 additions and 23 deletions
@@ -45,11 +45,13 @@ feature -- User Nodes
user_collaborator_nodes (a_id: like {CMS_USER}.id): LIST[CMS_NODE]
-- Possible list of nodes where the user identified by `a_id', is a collaborator.
do
create {ARRAYED_LIST[CMS_NODE]} Result.make (0)
end
user_author_nodes (a_id: like {CMS_USER}.id): LIST[CMS_NODE]
-- Possible list of nodes where the user identified by `a_id', is the author.
do
create {ARRAYED_LIST[CMS_NODE]} Result.make (0)
end
feature -- Change: user
@@ -67,6 +69,7 @@ feature -- Access: roles and permissions
user_roles: LIST [CMS_USER_ROLE]
do
create {ARRAYED_LIST[CMS_USER_ROLE]} Result.make (0)
end
@@ -104,6 +107,7 @@ feature -- Access: node
node_collaborators (a_id: like {CMS_NODE}.id): LIST [CMS_USER]
-- Possible list of node's collaborator.
do
create {ARRAYED_LIST[CMS_USER]} Result.make (0)
end
feature -- Node
@@ -25,6 +25,7 @@ CREATE TABLE IF NOT EXISTS `cms_dev`.`users` (
PRIMARY KEY (`id`),
UNIQUE INDEX `username` (`username` ASC))
ENGINE = InnoDB
AUTO_INCREMENT = 2
DEFAULT CHARACTER SET = latin1;
@@ -40,7 +41,7 @@ CREATE TABLE IF NOT EXISTS `cms_dev`.`nodes` (
`summary` TEXT NOT NULL,
`content` MEDIUMTEXT NOT NULL,
`author_id` INT(10) UNSIGNED NULL DEFAULT NULL,
`version` INT(10) ZEROFILL NULL,
`version` INT(10) UNSIGNED ZEROFILL NULL DEFAULT NULL,
`editor_id` INT(10) UNSIGNED NULL DEFAULT NULL,
PRIMARY KEY (`id`),
INDEX `fk_nodes_users1_idx` (`author_id` ASC),
@@ -56,6 +57,7 @@ CREATE TABLE IF NOT EXISTS `cms_dev`.`nodes` (
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 11
DEFAULT CHARACTER SET = latin1;
@@ -189,6 +189,7 @@ feature -- Node
delete_node (a_id: INTEGER_64)
do
node_provider.delete_from_user_nodes(a_id)
node_provider.delete_node (a_id)
post_node_provider_execution
end
@@ -224,6 +224,18 @@ feature -- Basic operations
post_execution
end
delete_from_user_nodes (a_id: INTEGER_64)
local
l_parameters: STRING_TABLE [ANY]
do
log.write_information (generator + ".delete_from_user_nodes")
create l_parameters.make (1)
l_parameters.put (a_id, "id")
db_handler.set_query (create {DATABASE_QUERY}.data_reader (sql_delete_from_user_node, l_parameters))
db_handler.execute_change
post_execution
end
feature -- Basic Operations: User_Nodes
add_author (a_user_id: INTEGER_64; a_node_id: INTEGER_64)
@@ -413,6 +425,8 @@ feature {NONE} -- Sql Queries: USER_ROLES collaborators, author
Select_exist_user_node: STRING= "Select Count(*) from Users_nodes where users_id=:user_id and nodes_id=:node_id;"
sql_delete_from_user_node: STRING = "delete from users_nodes where nodes_id=:id"
feature --