ONCSAPIV ;Hines OIFO/SG - ONCOLOGY WEB SERVICE (VERSIONS) ; 12/7/06 2:25pm
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
Q
;
;***** CHECKS THE VERSION OF THE LOCAL CACHE
;
; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
;
; Return Values:
; 0 Ok
; <0 Error code
;
CHKVER(ONCSAPI) ;
N NODE,RC,TMP,VER
D CLEAR^ONCSAPIE()
;--- Get the versions of web-service components
S VER=$$VERSION(.ONCSAPI) Q:VER<0 VER
;--- Lock the cache
S NODE=$NA(^XTMP("ONCSAPI"))
L +@NODE:5 E Q $$ERROR^ONCSAPIE(-15,,"local cache")
;--- Check the version of the local CS table cache
S TMP=$P(VER,U,2)
I TMP'="",$G(@NODE@("TABLES"))'=TMP D S @NODE@("TABLES")=TMP
. K @NODE@("TABLES"),@NODE@("SCHEMAS")
;--- Check the version of the local edit info cache
S TMP=$P(VER,U,3)
I TMP'="",$G(@NODE@("EDITS"))'=TMP D S @NODE@("EDITS")=TMP
. K @NODE@("EDITS")
;--- Refresh the cache descriptor
S TMP=$$FMADD^XLFDT(DT,30)
S @NODE@(0)=TMP_U_DT_U_"Local Oncology seb-service cache"
L -@NODE
Q 0
;
;***** SETS THE EVENT INTERFACE ENTRY POINTS
;
; .CBK Reference to the destination list
;
SETCBK(CBK) ;
;;CHARACTERS^TEXT^ONCSAPIV
;
D SETCBK^ONCSAPIX(.CBK,"SETCBK^ONCSAPIV")
Q
;
;***** TEXT CALLBACK FOR THE SAX PARSER
;
; TXT Line of unmarked text
;
TEXT(TXT) ;
N L,L2E
S L=$L(ONCXML("PATH"),","),L2E=$P(ONCXML("PATH"),",",L-1,L)
;--- CS API version
I L2E="RESPONSE,CS-APIVER" S ONCXML("CS-APIVER")=TXT Q
;--- EDITS metafile version
I L2E="RESPONSE,ED-METAVER" S ONCXML("ED-METAVER")=TXT Q
;--- Oncology web-service version
I L2E="RESPONSE,VERSION" S ONCXML("VERSION")=TXT Q
;--- Default processing
D TEXT^ONCSAPIX(TXT)
Q
;
;***** RETURNS THE WEB-SERVICE VERSIONS
;
; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
;
; The ^TMP("ONCSAPIV",$J) global node is used by this function.
;
; Return Values:
; <0 Error code
; Versions (e.g. "2.00^010300^2.00)
; ^01: Oncology web-service version
; ^02: Version of the CS DLL
; ^03: EDITS metafile version
;
VERSION(ONCSAPI) ;
N CBK,ONCREQ,ONCRSP,ONCXML,RC,URL
D CLEAR^ONCSAPIE()
S ONCRSP=$NA(^TMP("ONCSAPIV",$J)) K @ONCRSP
;--- Get the server URL
S URL=$$GETCSURL^ONCSAPIU()
;
S RC=0 D
. ;--- Prepare the request data
. S RC=$$PARAMS^ONCSAPIR("ONCREQ","GET-VERSION") Q:RC<0
. ;--- Request the DLL version
. D:$G(ONCSAPI("DEBUG"))
. . D ZW^ONCSAPIU("ONCREQ","*** 'VERSION' REQUEST ***",1)
. S RC=$$REQUEST^ONCSAPIR(URL,ONCRSP,"ONCREQ") Q:RC<0
. D:$G(ONCSAPI("DEBUG"))
. . D ZW^ONCSAPIU(ONCRSP,"*** 'VERSION' RESPONSE ***",1)
. K ONCREQ
. ;--- Parse the response
. D SETCBK(.CBK),EN^MXMLPRSE(ONCRSP,.CBK,"W")
. ;--- Check for parsing and web-service errors
. S RC=$$CHKERR^ONCSAPIR(.ONCXML) Q:RC<0
. ;--- Check the version numbers
. I $G(ONCXML("CS-APIVER"))="" S RC=$$ERROR^ONCSAPIE(-13) Q
. I $G(ONCXML("ED-METAVER"))="" S RC=$$ERROR^ONCSAPIE(-23) Q
;
;--- Cleanup
K @ONCRSP
I RC'<0 S RC="" D
. S $P(RC,U,1)=$G(ONCXML("VERSION")) ; Web-service
. S $P(RC,U,2)=$G(ONCXML("CS-APIVER")) ; CS API
. S $P(RC,U,3)=$G(ONCXML("ED-METAVER")) ; EDITS metafile
Q RC
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSAPIV 3351 printed Dec 13, 2024@02:27:51 Page 2
ONCSAPIV ;Hines OIFO/SG - ONCOLOGY WEB SERVICE (VERSIONS) ; 12/7/06 2:25pm
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 QUIT
+4 ;
+5 ;***** CHECKS THE VERSION OF THE LOCAL CACHE
+6 ;
+7 ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
+8 ;
+9 ; Return Values:
+10 ; 0 Ok
+11 ; <0 Error code
+12 ;
CHKVER(ONCSAPI) ;
+1 NEW NODE,RC,TMP,VER
+2 DO CLEAR^ONCSAPIE()
+3 ;--- Get the versions of web-service components
+4 SET VER=$$VERSION(.ONCSAPI)
if VER<0
QUIT VER
+5 ;--- Lock the cache
+6 SET NODE=$NAME(^XTMP("ONCSAPI"))
+7 LOCK +@NODE:5
IF '$TEST
QUIT $$ERROR^ONCSAPIE(-15,,"local cache")
+8 ;--- Check the version of the local CS table cache
+9 SET TMP=$PIECE(VER,U,2)
+10 IF TMP'=""
IF $GET(@NODE@("TABLES"))'=TMP
Begin DoDot:1
+11 KILL @NODE@("TABLES"),@NODE@("SCHEMAS")
End DoDot:1
SET @NODE@("TABLES")=TMP
+12 ;--- Check the version of the local edit info cache
+13 SET TMP=$PIECE(VER,U,3)
+14 IF TMP'=""
IF $GET(@NODE@("EDITS"))'=TMP
Begin DoDot:1
+15 KILL @NODE@("EDITS")
End DoDot:1
SET @NODE@("EDITS")=TMP
+16 ;--- Refresh the cache descriptor
+17 SET TMP=$$FMADD^XLFDT(DT,30)
+18 SET @NODE@(0)=TMP_U_DT_U_"Local Oncology seb-service cache"
+19 LOCK -@NODE
+20 QUIT 0
+21 ;
+22 ;***** SETS THE EVENT INTERFACE ENTRY POINTS
+23 ;
+24 ; .CBK Reference to the destination list
+25 ;
SETCBK(CBK) ;
+1 ;;CHARACTERS^TEXT^ONCSAPIV
+2 ;
+3 DO SETCBK^ONCSAPIX(.CBK,"SETCBK^ONCSAPIV")
+4 QUIT
+5 ;
+6 ;***** TEXT CALLBACK FOR THE SAX PARSER
+7 ;
+8 ; TXT Line of unmarked text
+9 ;
TEXT(TXT) ;
+1 NEW L,L2E
+2 SET L=$LENGTH(ONCXML("PATH"),",")
SET L2E=$PIECE(ONCXML("PATH"),",",L-1,L)
+3 ;--- CS API version
+4 IF L2E="RESPONSE,CS-APIVER"
SET ONCXML("CS-APIVER")=TXT
QUIT
+5 ;--- EDITS metafile version
+6 IF L2E="RESPONSE,ED-METAVER"
SET ONCXML("ED-METAVER")=TXT
QUIT
+7 ;--- Oncology web-service version
+8 IF L2E="RESPONSE,VERSION"
SET ONCXML("VERSION")=TXT
QUIT
+9 ;--- Default processing
+10 DO TEXT^ONCSAPIX(TXT)
+11 QUIT
+12 ;
+13 ;***** RETURNS THE WEB-SERVICE VERSIONS
+14 ;
+15 ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
+16 ;
+17 ; The ^TMP("ONCSAPIV",$J) global node is used by this function.
+18 ;
+19 ; Return Values:
+20 ; <0 Error code
+21 ; Versions (e.g. "2.00^010300^2.00)
+22 ; ^01: Oncology web-service version
+23 ; ^02: Version of the CS DLL
+24 ; ^03: EDITS metafile version
+25 ;
VERSION(ONCSAPI) ;
+1 NEW CBK,ONCREQ,ONCRSP,ONCXML,RC,URL
+2 DO CLEAR^ONCSAPIE()
+3 SET ONCRSP=$NAME(^TMP("ONCSAPIV",$JOB))
KILL @ONCRSP
+4 ;--- Get the server URL
+5 SET URL=$$GETCSURL^ONCSAPIU()
+6 ;
+7 SET RC=0
Begin DoDot:1
+8 ;--- Prepare the request data
+9 SET RC=$$PARAMS^ONCSAPIR("ONCREQ","GET-VERSION")
if RC<0
QUIT
+10 ;--- Request the DLL version
+11 if $GET(ONCSAPI("DEBUG"))
Begin DoDot:2
+12 DO ZW^ONCSAPIU("ONCREQ","*** 'VERSION' REQUEST ***",1)
End DoDot:2
+13 SET RC=$$REQUEST^ONCSAPIR(URL,ONCRSP,"ONCREQ")
if RC<0
QUIT
+14 if $GET(ONCSAPI("DEBUG"))
Begin DoDot:2
+15 DO ZW^ONCSAPIU(ONCRSP,"*** 'VERSION' RESPONSE ***",1)
End DoDot:2
+16 KILL ONCREQ
+17 ;--- Parse the response
+18 DO SETCBK(.CBK)
DO EN^MXMLPRSE(ONCRSP,.CBK,"W")
+19 ;--- Check for parsing and web-service errors
+20 SET RC=$$CHKERR^ONCSAPIR(.ONCXML)
if RC<0
QUIT
+21 ;--- Check the version numbers
+22 IF $GET(ONCXML("CS-APIVER"))=""
SET RC=$$ERROR^ONCSAPIE(-13)
QUIT
+23 IF $GET(ONCXML("ED-METAVER"))=""
SET RC=$$ERROR^ONCSAPIE(-23)
QUIT
End DoDot:1
+24 ;
+25 ;--- Cleanup
+26 KILL @ONCRSP
+27 IF RC'<0
SET RC=""
Begin DoDot:1
+28 ; Web-service
SET $PIECE(RC,U,1)=$GET(ONCXML("VERSION"))
+29 ; CS API
SET $PIECE(RC,U,2)=$GET(ONCXML("CS-APIVER"))
+30 ; EDITS metafile
SET $PIECE(RC,U,3)=$GET(ONCXML("ED-METAVER"))
End DoDot:1
+31 QUIT RC