text
stringlengths
0
234
end if;
if Stmt.Has_Save_Fields then
Object.Version := Object.Version + 1;
Stmt.Save_Field (Name => "version",
Value => Object.Version);
Stmt.Set_Filter (Filter => "id = ? and version = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Add_Param (Value => Object.Version - 1);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
else
raise ADO.Objects.LAZY_LOCK;
end if;
end if;
Function Definition: function Create_From_Format is
Function Body: new AWA.Helpers.Selectors.Create_From_Enum (AWA.Wikis.Models.Format_Type,
"wiki_format_");
-- ------------------------------
-- Get a select item list which contains a list of wiki formats.
-- ------------------------------
function Create_Format_List_Bean (Module : in AWA.Wikis.Modules.Wiki_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access is
pragma Unreferenced (Module);
use AWA.Helpers;
begin
return Selectors.Create_Selector_Bean (Bundle => "wikis",
Context => null,
Create => Create_From_Format'Access).all'Access;
end Create_Format_List_Bean;
-- ------------------------------
-- Get the value identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Wiki_Space_Bean;
Name : in String) return Util.Beans.Objects.Object is
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return AWA.Wikis.Models.Wiki_Space_Bean (From).Get_Value (Name);
end if;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name.
-- ------------------------------
overriding
procedure Set_Value (From : in out Wiki_Space_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name /= "id" then
AWA.Wikis.Models.Wiki_Space_Bean (From).Set_Value (Name, Value);
elsif Name = "id" and not Util.Beans.Objects.Is_Empty (Value) then
From.Module.Load_Wiki_Space (From, ADO.Utils.To_Identifier (Value));
end if;
end Set_Value;
-- ------------------------------
-- Create or save the wiki space.
-- ------------------------------
overriding
procedure Save (Bean : in out Wiki_Space_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is
pragma Unreferenced (Outcome);
begin
if Bean.Is_Inserted then
Bean.Module.Save_Wiki_Space (Bean);
else
Bean.Module.Create_Wiki_Space (Bean);
end if;
end Save;
-- ------------------------------
-- Load the wiki space information.
-- ------------------------------
overriding
procedure Load (Bean : in out Wiki_Space_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is
begin
Bean.Module.Load_Wiki_Space (Bean, Bean.Get_Id);
Outcome := Ada.Strings.Unbounded.To_Unbounded_String ("loaded");
end Load;
-- Delete the wiki space.
procedure Delete (Bean : in out Wiki_Space_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is
begin
null;
end Delete;
-- ------------------------------