text
stringlengths
0
234
end Find;
overriding
procedure Load (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out Tagged_Entity_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (TAGGED_ENTITY_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_2_NAME, -- for_entity_id
Value => Object.For_Entity_Id);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_2_NAME, -- entity_type
Value => Object.Entity_Type);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_2_NAME, -- tag_id
Value => Object.Tag);
Object.Clear_Modified (4);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
Function Definition: procedure List (Object : in out Tagged_Entity_Vector;
Function Body: Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, TAGGED_ENTITY_DEF'Access);
begin
Stmt.Execute;
Tagged_Entity_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Tagged_Entity_Ref;
Impl : constant Tagged_Entity_Access := new Tagged_Entity_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
Function Definition: function Create_Tag_List_Bean (Module : in Tag_Module_Access)
Function Body: return AWA.Tags.Beans.Tag_List_Bean_Access;
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AWA.Tags.Modules.Add_Tag",
Test_Add_Tag'Access);
Caller.Add_Test (Suite, "Test AWA.Tags.Modules.Remove_Tag",
Test_Remove_Tag'Access);
Caller.Add_Test (Suite, "Test AWA.Tags.Modules.Update_Tags",
Test_Remove_Tag'Access);
end Add_Tests;
function Create_Tag_List_Bean (Module : in Tag_Module_Access)
return AWA.Tags.Beans.Tag_List_Bean_Access is
Bean : constant Util.Beans.Basic.Readonly_Bean_Access
:= AWA.Tags.Beans.Create_Tag_List_Bean (Module);
begin
return AWA.Tags.Beans.Tag_List_Bean'Class (Bean.all)'Access;
end Create_Tag_List_Bean;
-- ------------------------------
-- Test tag creation.
-- ------------------------------
procedure Test_Add_Tag (T : in out Test) is
Sec_Ctx : Security.Contexts.Security_Context;
Context : AWA.Services.Contexts.Service_Context;
begin