ECOB30 ;BP/CMF - Collect Object
;;2.0;EVENT CAPTURE;**100**;8 May 96;Build 21
;@author - Chris Flegel
;@date - 17 May 2009
;@version - 1.0
;;
Q
;; private methods
EXECUTE(RESULT,HANDLE,PARAMS) ;
N ASLIST,CHILD,CLASS,COLLECT,FOUND,HANDLER,NAME,METH,PROP,SCOPE,X
;;
CK D METHOD(.CHILD,HANDLE_".GetChild")
I CHILD="" S RESULT="-1^Invalid child" Q
D METHOD(.COLLECT,HANDLE_".GetCollector")
I COLLECT="" S RESULT="-1^Invalid collector" Q
D METHOD(.ASLIST,HANDLE_".GetAsList")
I ASLIST="true" D COLLECT^ECOBUL(.RESULT,COLLECT,CHILD) Q
;;
D METHOD(.HANDLER,HANDLE_".GetHandler")
I HANDLER="" S RESULT="-1^Invalid handler" Q
D METHOD(.NAME,HANDLE_".GetName")
I NAME="" S RESULT="-1^Invalid name." Q
;;
PF D METHOD^ECOBU(.FOUND,COLLECT_".Properties.Find."_NAME)
D METHOD^ECOBL(.RESULT,FOUND_".GetCount")
D DESTROY^ECOBL(FOUND)
I +RESULT S RESULT="-1^Property "_NAME_" already exists." Q
;;
MF D METHOD^ECOBU(.FOUND,COLLECT_".Methods.Find."_NAME)
D METHOD^ECOBL(.RESULT,FOUND_".GetCount")
D DESTROY^ECOBL(FOUND)
I +RESULT S RESULT="-1^Method "_NAME_" already exists." Q
;;
D METHOD(.SCOPE,HANDLE_".GetScope")
I SCOPE="" S SCOPE="Pu"
D COLLECT^ECOB(COLLECT,CHILD,SCOPE,NAME)
D METHOD^ECOB2(.CLASS,COLLECT_".Get_class")
;;
MA D METHOD^ECOBU(.METH,COLLECT_".Methods.Add."_NAME)
D METHOD^ECOBM(.X,METH_".SetAddedByClass."_CLASS)
D METHOD^ECOBM(.X,METH_".SetDescription.Handler for object property.")
D METHOD^ECOBM(.X,METH_".SetHandler."_HANDLER)
D METHOD^ECOBM(.X,METH_".SetParams.[method.params]")
D METHOD^ECOBM(.X,METH_".SetReturns.access to object")
;;
PA D METHOD^ECOBU(.PROP,COLLECT_".Properties.Add."_NAME)
D METHOD^ECOBP(.X,PROP_".SetAddedByClass."_CLASS)
D METHOD^ECOBP(.X,PROP_".SetValue."_CHILD)
D METHOD^ECOBP(.X,PROP_".SetDefaultValue."_CHILD)
;;
S RESULT=1
Q
;;
;; public methods
CREATE(NAME) ;
; call parent first
N HANDLE,CHILD
S HANDLE=$$CREATE^ECOB2(NAME)
;;
D SELF^ECOB(.RESULT,HANDLE,"Collect","Collect","METHOD^ECOB30(.RESULT,ARGUMENT)","ECOB2")
;;
D PROPERTY^ECOB(HANDLE,"Pu","AsList","false")
D PROPERTY^ECOB(HANDLE,"Pu","Child","")
D PROPERTY^ECOB(HANDLE,"Pu","Collector","")
D PROPERTY^ECOB(HANDLE,"Pu","Handler","")
D PROPERTY^ECOB(HANDLE,"Pu","Name","")
D PROPERTY^ECOB(HANDLE,"Pu","Scope","Pu")
; complex properties last
Q HANDLE
;;
DESTROY(HANDLE) ;
; call parent last
Q $$DESTROY^ECOB2(HANDLE)
;;
METHOD(RESULT,ARGUMENT) ;
; argument=[handle].[method].[additional.params...]
N HANDLE,METHOD,PARAMS
D PARSE^ECOB2("Handle",ARGUMENT)
D PARSE^ECOB2("Method",ARGUMENT)
D PARSE^ECOB2("Params",ARGUMENT)
I METHOD="Execute" D EXECUTE(.RESULT,HANDLE,PARAMS) Q
D METHOD^ECOB2(.RESULT,ARGUMENT)
Q
;;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECOB30 2775 printed Oct 16, 2024@17:58:41 Page 2
ECOB30 ;BP/CMF - Collect Object
+1 ;;2.0;EVENT CAPTURE;**100**;8 May 96;Build 21
+2 ;@author - Chris Flegel
+3 ;@date - 17 May 2009
+4 ;@version - 1.0
+5 ;;
+6 QUIT
+7 ;; private methods
EXECUTE(RESULT,HANDLE,PARAMS) ;
+1 NEW ASLIST,CHILD,CLASS,COLLECT,FOUND,HANDLER,NAME,METH,PROP,SCOPE,X
+2 ;;
CK DO METHOD(.CHILD,HANDLE_".GetChild")
+1 IF CHILD=""
SET RESULT="-1^Invalid child"
QUIT
+2 DO METHOD(.COLLECT,HANDLE_".GetCollector")
+3 IF COLLECT=""
SET RESULT="-1^Invalid collector"
QUIT
+4 DO METHOD(.ASLIST,HANDLE_".GetAsList")
+5 IF ASLIST="true"
DO COLLECT^ECOBUL(.RESULT,COLLECT,CHILD)
QUIT
+6 ;;
+7 DO METHOD(.HANDLER,HANDLE_".GetHandler")
+8 IF HANDLER=""
SET RESULT="-1^Invalid handler"
QUIT
+9 DO METHOD(.NAME,HANDLE_".GetName")
+10 IF NAME=""
SET RESULT="-1^Invalid name."
QUIT
+11 ;;
PF DO METHOD^ECOBU(.FOUND,COLLECT_".Properties.Find."_NAME)
+1 DO METHOD^ECOBL(.RESULT,FOUND_".GetCount")
+2 DO DESTROY^ECOBL(FOUND)
+3 IF +RESULT
SET RESULT="-1^Property "_NAME_" already exists."
QUIT
+4 ;;
MF DO METHOD^ECOBU(.FOUND,COLLECT_".Methods.Find."_NAME)
+1 DO METHOD^ECOBL(.RESULT,FOUND_".GetCount")
+2 DO DESTROY^ECOBL(FOUND)
+3 IF +RESULT
SET RESULT="-1^Method "_NAME_" already exists."
QUIT
+4 ;;
+5 DO METHOD(.SCOPE,HANDLE_".GetScope")
+6 IF SCOPE=""
SET SCOPE="Pu"
+7 DO COLLECT^ECOB(COLLECT,CHILD,SCOPE,NAME)
+8 DO METHOD^ECOB2(.CLASS,COLLECT_".Get_class")
+9 ;;
MA DO METHOD^ECOBU(.METH,COLLECT_".Methods.Add."_NAME)
+1 DO METHOD^ECOBM(.X,METH_".SetAddedByClass."_CLASS)
+2 DO METHOD^ECOBM(.X,METH_".SetDescription.Handler for object property.")
+3 DO METHOD^ECOBM(.X,METH_".SetHandler."_HANDLER)
+4 DO METHOD^ECOBM(.X,METH_".SetParams.[method.params]")
+5 DO METHOD^ECOBM(.X,METH_".SetReturns.access to object")
+6 ;;
PA DO METHOD^ECOBU(.PROP,COLLECT_".Properties.Add."_NAME)
+1 DO METHOD^ECOBP(.X,PROP_".SetAddedByClass."_CLASS)
+2 DO METHOD^ECOBP(.X,PROP_".SetValue."_CHILD)
+3 DO METHOD^ECOBP(.X,PROP_".SetDefaultValue."_CHILD)
+4 ;;
+5 SET RESULT=1
+6 QUIT
+7 ;;
+8 ;; public methods
CREATE(NAME) ;
+1 ; call parent first
+2 NEW HANDLE,CHILD
+3 SET HANDLE=$$CREATE^ECOB2(NAME)
+4 ;;
+5 DO SELF^ECOB(.RESULT,HANDLE,"Collect","Collect","METHOD^ECOB30(.RESULT,ARGUMENT)","ECOB2")
+6 ;;
+7 DO PROPERTY^ECOB(HANDLE,"Pu","AsList","false")
+8 DO PROPERTY^ECOB(HANDLE,"Pu","Child","")
+9 DO PROPERTY^ECOB(HANDLE,"Pu","Collector","")
+10 DO PROPERTY^ECOB(HANDLE,"Pu","Handler","")
+11 DO PROPERTY^ECOB(HANDLE,"Pu","Name","")
+12 DO PROPERTY^ECOB(HANDLE,"Pu","Scope","Pu")
+13 ; complex properties last
+14 QUIT HANDLE
+15 ;;
DESTROY(HANDLE) ;
+1 ; call parent last
+2 QUIT $$DESTROY^ECOB2(HANDLE)
+3 ;;
METHOD(RESULT,ARGUMENT) ;
+1 ; argument=[handle].[method].[additional.params...]
+2 NEW HANDLE,METHOD,PARAMS
+3 DO PARSE^ECOB2("Handle",ARGUMENT)
+4 DO PARSE^ECOB2("Method",ARGUMENT)
+5 DO PARSE^ECOB2("Params",ARGUMENT)
+6 IF METHOD="Execute"
DO EXECUTE(.RESULT,HANDLE,PARAMS)
QUIT
+7 DO METHOD^ECOB2(.RESULT,ARGUMENT)
+8 QUIT
+9 ;;