Form S_202RCO
* ===================================================================;
*;
* Component : S_202RCO;
* Type : Reusable Part;
* Ancestor : PRIM_OBJT (Primitive Form);
*;
* Description : Product "Controller";
*;
* This reusable component represents the "controller" of a "Product";
* for this simple MVC example.;
*;
* Disclaimer : The following material is supplied as example material;
* only. No warranty concerning this material or its use;
* in any way whatsoever is expressed or implied.;
*;
* ===================================================================;
Function Options(*DIRECT);
Begin_Com;
;
* Define the product model so that it is shared by all active;
* instances of this product controller in all contexts;
;
Define_Com Class(#S_202RMO) Name(#PRODUCT_MODEL) Scope(*Shared);
;
* Define the product model as a property of this controller so;
* that users of this controller can "listen" to it for broadcast;
* messages regarding changes about products;
;
Define_Pty Name(ProductModel) Get(GetProductModel);
;
* ===================================================================;
* Handle a get operation for the "ProductModel" property;
* ===================================================================;
;
Ptyroutine Name(GetProductModel);
Define_Map For(*output) Class(#S_202RMO) Name(#Property_001) Pass(*By_Reference);
Set_Ref Com(#Property_001) To(#Product_Model);
Endroutine;
;
* ===================================================================;
* Handle a request to insert a product;
* ===================================================================;
;
Mthroutine Name(Insert);
Define_Map For(*input) Class(#s_202num) Name(#Number);
Define_Map For(*input) Class(#s_202des) Name(#Description);
Define_Map For(*input) Class(#s_202prc) Name(#Price);
Define_Map For(*input) Class(#s_202qty) Name(#Available);
Invoke Method(#Product_Model.Create) Number(#Number) Description(#Description) Price(#Price) Available(#Available);
Endroutine;
;
* ===================================================================;
* Handle a request to update a product;
* ===================================================================;
;
Mthroutine Name(Update);
Define_Map For(*input) Class(#s_202num) Name(#Number);
Define_Map For(*input) Class(#s_202des) Name(#Description);
Define_Map For(*input) Class(#s_202prc) Name(#Price);
Define_Map For(*input) Class(#s_202qty) Name(#Available);
Invoke Method(#Product_Model.Update) Number(#Number) Description(#Description) Price(#Price) Available(#Available);
Endroutine;
;
* ===================================================================;
* Handle a request to fetch a product;
* ===================================================================;
;
Mthroutine Name(Fetch);
Define_Map For(*input) Class(#s_202num) Name(#Number);
Define_Map For(*input) Class(#std_Obj) Name(#RequestedBy);
Invoke Method(#Product_Model.Get) Number(#Number) Requestedby(#RequestedBy);
Endroutine;
;
* ===================================================================;
* Handle a request to delete a product;
* ===================================================================;
;
Mthroutine Name(Delete);
Define_Map For(*input) Class(#s_202num) Name(#Number);
Invoke Method(#Product_Model.Destroy) Number(#Number);
Endroutine;
;
* ===================================================================;
* Handle a request to select all products;
* ===================================================================;
;
Mthroutine Name(Select);
Define_Map For(*input) Class(#std_Obj) Name(#RequestedBy);
Invoke Method(#Product_Model.Enumerate) Requestedby(#RequestedBy);
Endroutine;
;
End_Com
* ===================================================================;
*;
* Component : S_202RCO;
* Type : Reusable Part;
* Ancestor : PRIM_OBJT (Primitive Form);
*;
* Description : Product "Controller";
*;
* This reusable component represents the "controller" of a "Product";
* for this simple MVC example.;
*;
* Disclaimer : The following material is supplied as example material;
* only. No warranty concerning this material or its use;
* in any way whatsoever is expressed or implied.;
*;
* ===================================================================;
Function Options(*DIRECT);
Begin_Com;
;
* Define the product model so that it is shared by all active;
* instances of this product controller in all contexts;
;
Define_Com Class(#S_202RMO) Name(#PRODUCT_MODEL) Scope(*Shared);
;
* Define the product model as a property of this controller so;
* that users of this controller can "listen" to it for broadcast;
* messages regarding changes about products;
;
Define_Pty Name(ProductModel) Get(GetProductModel);
;
* ===================================================================;
* Handle a get operation for the "ProductModel" property;
* ===================================================================;
;
Ptyroutine Name(GetProductModel);
Define_Map For(*output) Class(#S_202RMO) Name(#Property_001) Pass(*By_Reference);
Set_Ref Com(#Property_001) To(#Product_Model);
Endroutine;
;
* ===================================================================;
* Handle a request to insert a product;
* ===================================================================;
;
Mthroutine Name(Insert);
Define_Map For(*input) Class(#s_202num) Name(#Number);
Define_Map For(*input) Class(#s_202des) Name(#Description);
Define_Map For(*input) Class(#s_202prc) Name(#Price);
Define_Map For(*input) Class(#s_202qty) Name(#Available);
Invoke Method(#Product_Model.Create) Number(#Number) Description(#Description) Price(#Price) Available(#Available);
Endroutine;
;
* ===================================================================;
* Handle a request to update a product;
* ===================================================================;
;
Mthroutine Name(Update);
Define_Map For(*input) Class(#s_202num) Name(#Number);
Define_Map For(*input) Class(#s_202des) Name(#Description);
Define_Map For(*input) Class(#s_202prc) Name(#Price);
Define_Map For(*input) Class(#s_202qty) Name(#Available);
Invoke Method(#Product_Model.Update) Number(#Number) Description(#Description) Price(#Price) Available(#Available);
Endroutine;
;
* ===================================================================;
* Handle a request to fetch a product;
* ===================================================================;
;
Mthroutine Name(Fetch);
Define_Map For(*input) Class(#s_202num) Name(#Number);
Define_Map For(*input) Class(#std_Obj) Name(#RequestedBy);
Invoke Method(#Product_Model.Get) Number(#Number) Requestedby(#RequestedBy);
Endroutine;
;
* ===================================================================;
* Handle a request to delete a product;
* ===================================================================;
;
Mthroutine Name(Delete);
Define_Map For(*input) Class(#s_202num) Name(#Number);
Invoke Method(#Product_Model.Destroy) Number(#Number);
Endroutine;
;
* ===================================================================;
* Handle a request to select all products;
* ===================================================================;
;
Mthroutine Name(Select);
Define_Map For(*input) Class(#std_Obj) Name(#RequestedBy);
Invoke Method(#Product_Model.Enumerate) Requestedby(#RequestedBy);
Endroutine;
;
End_Com