text
stringlengths
0
234
Kind : constant ADO.Entity_Type := Find_Entity_Type (Session, Entity_Type);
Query : ADO.Queries.Context;
begin
Query.Set_Query (AWA.Tags.Models.Query_Tag_Search);
Query.Bind_Param ("entity_type", Kind);
Query.Bind_Param ("search", Search & "%");
declare
Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query);
begin
Stmt.Execute;
while Stmt.Has_Elements loop
Into.List.Append (Util.Beans.Objects.To_Object (Stmt.Get_String (0)));
Stmt.Next;
end loop;
Function Definition: function Create_Tag_Info_List_Bean (Module : in AWA.Tags.Modules.Tag_Module_Access)
Function Body: return Util.Beans.Basic.Readonly_Bean_Access is
Result : constant Tag_Info_List_Bean_Access := new Tag_Info_List_Bean;
begin
Result.Module := Module;
return Result.all'Access;
end Create_Tag_Info_List_Bean;
-- ------------------------------
-- Get the list of tags associated with the given entity.
-- Returns null if the entity does not have any tag.
-- ------------------------------
function Get_Tags (From : in Entity_Tag_Map;
For_Entity : in ADO.Identifier)
return Util.Beans.Lists.Strings.List_Bean_Access is
Pos : constant Entity_Tag_Maps.Cursor := From.Tags.Find (For_Entity);
begin
if Entity_Tag_Maps.Has_Element (Pos) then
return Entity_Tag_Maps.Element (Pos);
else
return null;
end if;
end Get_Tags;
-- ------------------------------
-- Get the list of tags associated with the given entity.
-- Returns a null object if the entity does not have any tag.
-- ------------------------------
function Get_Tags (From : in Entity_Tag_Map;
For_Entity : in ADO.Identifier)
return Util.Beans.Objects.Object is
Pos : constant Entity_Tag_Maps.Cursor := From.Tags.Find (For_Entity);
begin
if Entity_Tag_Maps.Has_Element (Pos) then
return Util.Beans.Objects.To_Object (Value => Entity_Tag_Maps.Element (Pos).all'Access,
Storage => Util.Beans.Objects.STATIC);
else
return Util.Beans.Objects.Null_Object;
end if;
end Get_Tags;
-- ------------------------------
-- Load the list of tags associated with a list of entities.
-- ------------------------------
procedure Load_Tags (Into : in out Entity_Tag_Map;
Session : in out ADO.Sessions.Session'Class;
Entity_Type : in String;
List : in ADO.Utils.Identifier_Vector) is
Query : ADO.Queries.Context;
Kind : ADO.Entity_Type;
begin
Into.Clear;
if List.Is_Empty then
return;
end if;
Kind := ADO.Sessions.Entities.Find_Entity_Type (Session, Entity_Type);
Query.Set_Query (AWA.Tags.Models.Query_Tag_List_For_Entities);
Query.Bind_Param ("entity_id_list", List);
Query.Bind_Param ("entity_type", Kind);
declare
Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query);
Id : ADO.Identifier;
List : Util.Beans.Lists.Strings.List_Bean_Access;
Pos : Entity_Tag_Maps.Cursor;
begin
Stmt.Execute;
while Stmt.Has_Elements loop
Id := Stmt.Get_Identifier (0);
Pos := Into.Tags.Find (Id);
if not Entity_Tag_Maps.Has_Element (Pos) then
List := new Util.Beans.Lists.Strings.List_Bean;
Into.Tags.Insert (Id, List);
else
List := Entity_Tag_Maps.Element (Pos);
end if;
List.List.Append (Stmt.Get_String (1));
Stmt.Next;
end loop;
Function Definition: procedure Dispatch (List : in out Tag_Info_Array);
Function Body: -- ------------------------------
-- Create an Tag_UIInput component
-- ------------------------------
function Create_Tag return ASF.Components.Base.UIComponent_Access is