text stringlengths 0 234 |
|---|
begin |
if Name = "page" and not Util.Beans.Objects.Is_Empty (Value) then |
From.Page := Util.Beans.Objects.To_Integer (Value); |
elsif Name = "wiki_id" and not Util.Beans.Objects.Is_Empty (Value) then |
From.Wiki_Id := ADO.Utils.To_Identifier (Value); |
elsif Name = "page_id" and not Util.Beans.Objects.Is_Empty (Value) then |
From.Page_Id := ADO.Utils.To_Identifier (Value); |
end if; |
exception |
when Constraint_Error => |
From.Wiki_Id := ADO.NO_IDENTIFIER; |
From.Page_Id := ADO.NO_IDENTIFIER; |
end Set_Value; |
overriding |
procedure Load (Into : in out Wiki_Version_List_Bean; |
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is |
use AWA.Wikis.Models; |
use AWA.Services; |
use type ADO.Identifier; |
use type Ada.Strings.Unbounded.Unbounded_String; |
Ctx : constant Contexts.Service_Context_Access := AWA.Services.Contexts.Current; |
User : constant ADO.Identifier := Ctx.Get_User_Identifier; |
Session : ADO.Sessions.Session := Into.Module.Get_Session; |
Query : ADO.Queries.Context; |
Count_Query : ADO.Queries.Context; |
First : constant Natural := (Into.Page - 1) * Into.Page_Size; |
Page : constant Wiki_View_Bean_Access := Get_Wiki_View_Bean ("wikiView"); |
begin |
if Into.Wiki_Id = ADO.NO_IDENTIFIER or Into.Page_Id = ADO.NO_IDENTIFIER then |
return; |
end if; |
-- Load the wiki page first. |
Page.Id := Into.Page_Id; |
Page.Set_Wiki_Id (Into.Wiki_Id); |
Page.Load (Outcome); |
if Outcome /= "loaded" then |
return; |
end if; |
Page.Wiki_Space.Set_Id (Into.Wiki_Id); |
-- Get the list of versions associated with the wiki page. |
Query.Set_Query (AWA.Wikis.Models.Query_Wiki_Version_List); |
Count_Query.Set_Count_Query (AWA.Wikis.Models.Query_Wiki_Version_List); |
Query.Bind_Param (Name => "first", Value => First); |
Query.Bind_Param (Name => "count", Value => Into.Page_Size); |
Query.Bind_Param (Name => "wiki_id", Value => Into.Wiki_Id); |
Query.Bind_Param (Name => "page_id", Value => Into.Page_Id); |
Query.Bind_Param (Name => "user_id", Value => User); |
Count_Query.Bind_Param (Name => "wiki_id", Value => Into.Wiki_Id); |
Count_Query.Bind_Param (Name => "page_id", Value => Into.Page_Id); |
Count_Query.Bind_Param (Name => "user_id", Value => User); |
ADO.Sessions.Entities.Bind_Param (Params => Query, |
Name => "table", |
Table => AWA.Wikis.Models.WIKI_SPACE_TABLE, |
Session => Session); |
ADO.Sessions.Entities.Bind_Param (Params => Count_Query, |
Name => "table", |
Table => AWA.Wikis.Models.WIKI_SPACE_TABLE, |
Session => Session); |
AWA.Wikis.Models.List (Into.Versions, Session, Query); |
Into.Count := ADO.Datasets.Get_Count (Session, Count_Query); |
end Load; |
-- ------------------------------ |
-- Create the Post_List_Bean bean instance. |
-- ------------------------------ |
function Create_Wiki_Version_List_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access) |
return Util.Beans.Basic.Readonly_Bean_Access is |
Object : constant Wiki_Version_List_Bean_Access := new Wiki_Version_List_Bean; |
begin |
Object.Module := Module; |
Object.Versions_Bean := Object.Versions'Access; |
Object.Page_Size := 20; |
Object.Page := 1; |
Object.Count := 0; |
Object.Wiki_Id := ADO.NO_IDENTIFIER; |
Object.Page_Id := ADO.NO_IDENTIFIER; |
return Object.all'Access; |
end Create_Wiki_Version_List_Bean; |
-- ------------------------------ |
-- Get the value identified by the name. |
-- ------------------------------ |
overriding |
function Get_Value (From : in Wiki_Page_Info_Bean; |
Name : in String) return Util.Beans.Objects.Object is |
begin |
if Name = "words" then |
return Util.Beans.Objects.To_Object (Value => From.Words_Bean, |
Storage => Util.Beans.Objects.STATIC); |
elsif Name = "pages" then |
return Util.Beans.Objects.To_Object (Value => From.Links_Bean, |
Storage => Util.Beans.Objects.STATIC); |
elsif Name = "links" then |
return Util.Beans.Objects.To_Object (Value => From.Ext_Links_Bean, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.