text stringlengths 0 234 |
|---|
Wiki.SYNTAX_MIX); |
Last : Natural; |
begin |
if Text'Length < SHORT_DESCRIPTION_LENGTH then |
Last := Text'Last; |
else |
Last := SHORT_DESCRIPTION_LENGTH; |
end if; |
Question.Set_Short_Description (Text (Text'First .. Last) & "..."); |
Function Definition: procedure Load_List (Into : in out Question_List_Bean) is |
Function Body: use AWA.Questions.Models; |
use AWA.Services; |
use type ADO.Identifier; |
Session : ADO.Sessions.Session := Into.Service.Get_Session; |
Query : ADO.Queries.Context; |
Tag_Id : ADO.Identifier; |
begin |
AWA.Tags.Modules.Find_Tag_Id (Session, Ada.Strings.Unbounded.To_String (Into.Tag), Tag_Id); |
if Tag_Id /= ADO.NO_IDENTIFIER then |
Query.Set_Query (AWA.Questions.Models.Query_Question_Tag_List); |
Query.Bind_Param (Name => "tag", Value => Tag_Id); |
else |
Query.Set_Query (AWA.Questions.Models.Query_Question_List); |
end if; |
ADO.Sessions.Entities.Bind_Param (Params => Query, |
Name => "entity_type", |
Table => AWA.Questions.Models.QUESTION_TABLE, |
Session => Session); |
AWA.Questions.Models.List (Into.Questions, Session, Query); |
declare |
List : ADO.Utils.Identifier_Vector; |
Iter : Question_Info_Vectors.Cursor := Into.Questions.List.First; |
begin |
while Question_Info_Vectors.Has_Element (Iter) loop |
List.Append (Question_Info_Vectors.Element (Iter).Id); |
Question_Info_Vectors.Next (Iter); |
end loop; |
Into.Tags.Load_Tags (Session, AWA.Questions.Models.QUESTION_TABLE.Table.all, |
List); |
Function Definition: function Create_Question_List_Bean (Module : in AWA.Questions.Modules.Question_Module_Access) |
Function Body: return Util.Beans.Basic.Readonly_Bean_Access is |
use AWA.Questions.Models; |
use AWA.Services; |
Object : constant Question_List_Bean_Access := new Question_List_Bean; |
-- Session : ADO.Sessions.Session := Module.Get_Session; |
-- Query : ADO.Queries.Context; |
begin |
Object.Service := Module; |
Object.Questions_Bean := Object.Questions'Unchecked_Access; |
-- Query.Set_Query (AWA.Questions.Models.Query_Question_List); |
-- ADO.Sessions.Entities.Bind_Param (Params => Query, |
-- Name => "entity_type", |
-- Table => AWA.Questions.Models.QUESTION_TABLE, |
-- Session => Session); |
-- AWA.Questions.Models.List (Object.Questions, Session, Query); |
Object.Load_List; |
return Object.all'Access; |
end Create_Question_List_Bean; |
-- ------------------------------ |
-- Get the value identified by the name. |
-- ------------------------------ |
overriding |
function Get_Value (From : in Question_Display_Bean; |
Name : in String) return Util.Beans.Objects.Object is |
begin |
if Name = "answers" then |
return Util.Beans.Objects.To_Object (Value => From.Answer_List_Bean, |
Storage => Util.Beans.Objects.STATIC); |
elsif Name = "question" then |
return Util.Beans.Objects.To_Object (Value => From.Question_Bean, |
Storage => Util.Beans.Objects.STATIC); |
elsif Name = "tags" then |
return Util.Beans.Objects.To_Object (Value => From.Tags_Bean, |
Storage => Util.Beans.Objects.STATIC); |
else |
return Util.Beans.Objects.Null_Object; |
end if; |
end Get_Value; |
-- ------------------------------ |
-- Set the value identified by the name. |
-- ------------------------------ |
overriding |
procedure Set_Value (From : in out Question_Display_Bean; |
Name : in String; |
Value : in Util.Beans.Objects.Object) is |
begin |
if Name = "id" and not Util.Beans.Objects.Is_Empty (Value) then |
declare |
package ASC renames AWA.Services.Contexts; |
use AWA.Questions.Models; |
use AWA.Services; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.