Maia\Builder
CLASS BuildActiveRecordBase

CLASS dotr.Maia.Builder.BuildActiveRecordBase INHERITS Basic

Maia crud builder

extends the basic builder to add methods to build crud files from the crud.i template provided
Author:
Julian Lyndon-Smith (julian+maia@dotr.com)

Method Summary
CONSTRUCTOR (ObjectConfig p_ObjectConfig)
           
VOID ActiveRecordDelete (Directive p_Directive)
           Create Cascade statements
VOID ActiveRecordHelper_fkDeleted (Directive p_Directive)
           updates fk on deletion of fk
VOID ActiveRecordHelper_fkGet (Directive p_Directive)
           opens a query on all records of this model that have this fk
VOID ActiveRecordHelper_GetMethods (Directive p_Directive)
           build the methods for each of the get statements in the model
VOID ActiveRecordModel_AssignFromBuffer (Directive p_Directive)
           create statement to assign database fields to properties
VOID ActiveRecordModel_AssignToBuffer (Directive p_Directive)
           generate assign to buffer statement
VOID ActiveRecordModel_fkAssign (Directive p_Directive)
           assign a fk to this model
VOID GenerateGUID (Directive p_Directive)
           generate guid statements
VOID NextValue (Directive p_Directive)
           generate next-value statements
 

Method Detail

CONSTRUCTOR

CONSTRUCTOR(ObjectConfig p_ObjectConfig)

ActiveRecordDelete

PUBLIC VOID ActiveRecordDelete(Directive p_Directive)
Create Cascade statements

when a record is deleted, we need to either remove all associated records (remove) or remove the fk reference. This is done by calling the appropriate helper methods in the target object class
Parameters:
p_Directive - : holds the directive name and all parameters

ActiveRecordHelper_fkDeleted

PUBLIC VOID ActiveRecordHelper_fkDeleted(Directive p_Directive)
updates fk on deletion of fk

loops through all objects with a fk of this object, and sets the fk property to ""
Parameters:
p_Directive - : holds the directive name and all parameters

ActiveRecordHelper_fkGet

PUBLIC VOID ActiveRecordHelper_fkGet(Directive p_Directive)
opens a query on all records of this model that have this fk

for each fk of this model, create a helper method that loops through all records with this fk
Parameters:
p_Directive - : holds the directive name and all parameters

ActiveRecordHelper_GetMethods

PUBLIC VOID ActiveRecordHelper_GetMethods(Directive p_Directive)
build the methods for each of the get statements in the model

Parameters:
p_Directive - : holds the directive name and all parameters

ActiveRecordModel_AssignFromBuffer

PUBLIC VOID ActiveRecordModel_AssignFromBuffer(Directive p_Directive)
create statement to assign database fields to properties

Parameters:
p_Directive - : holds the directive name and all parameters

ActiveRecordModel_AssignToBuffer

PUBLIC VOID ActiveRecordModel_AssignToBuffer(Directive p_Directive)
generate assign to buffer statement

loop through all properties for an object, and build the appropriate assign to buffer statement
Parameters:
p_Directive - : holds the directive name and all parameters

ActiveRecordModel_fkAssign

PUBLIC VOID ActiveRecordModel_fkAssign(Directive p_Directive)
assign a fk to this model

for each fk of this model, create a method to assign the fk to the model
Parameters:
p_Directive - : holds the directive name and all parameters

GenerateGUID

PUBLIC VOID GenerateGUID(Directive p_Directive)
generate guid statements

loop through all properties configured with a generateGUID flag and generate a next-value statement only set the property if it is currently unknown or ""
Parameters:
p_Directive - : holds the directive name and all parameters

NextValue

PUBLIC VOID NextValue(Directive p_Directive)
generate next-value statements

loop through all properties configured with a sequence and generate a next-value statement only set the property if it is currently unknown or 0
Parameters:
p_Directive - : holds the directive name and all parameters