text
stringlengths
0
234
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
Function Definition: procedure Finish (From : in out Application;
Function Body: Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is
begin
Log.Info ("Finish configuration");
From.Save (Outcome);
From.Status.Set (STARTING);
end Finish;
-- ------------------------------
-- This bean provides some methods that can be used in a Method_Expression
-- ------------------------------
overriding
function Get_Method_Bindings (From : in Application)
return Util.Beans.Methods.Method_Binding_Array_Access is
pragma Unreferenced (From);
begin
return Binding_Array'Access;
end Get_Method_Bindings;
-- ------------------------------
-- Enter in the application setup
-- ------------------------------
procedure Setup (App : in out Application;
Config : in String;
Server : in out ASF.Server.Container'Class) is
Path : constant String := AWA.Applications.Configs.Get_Config_Path (Config);
Dir : constant String := Ada.Directories.Containing_Directory (Path);
Done : constant String := Ada.Directories.Compose (Dir, ".initialized");
begin
Log.Info ("Entering configuration for {0}", Path);
App.Path := Ada.Strings.Unbounded.To_Unbounded_String (Path);
begin
App.Config.Load_Properties (Path);
Util.Log.Loggers.Initialize (Path);
exception
when Ada.IO_Exceptions.Name_Error =>
Log.Error ("Cannot read application configuration file: {0}", Path);
Function Definition: procedure Unchecked_Free is new Ada.Unchecked_Deallocation
Function Body: (Changelog_Impl, Changelog_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Changelog_Impl_Ptr := Changelog_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Changelog_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, CHANGELOG_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Changelog_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 Changelog_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (CHANGELOG_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_1_NAME, -- date
Value => Object.Date);
Object.Clear_Modified (2);