MAGGA04 ;WOIFO/SG - REMOTE PROCEDURES: IMAGE LOCK/UNLOCK ; 3/9/09 12:51pm
;;3.0;IMAGING;**93**;Dec 02, 2009;Build 163
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
;
;***** LOCKS THE IMAGE(S)
; RPC: MAGG IMAGE LOCK
;
; .RESULTS Reference to a local variable where the results
; are returned to.
;
; [FLAGS] reserved
;
; .IMGLST( Reference to the List of images to lock
;
; i) Image reference
; ^01: Image IEN
;
; Return Values
; =============
;
; Zero value of the 1st '^'-piece of the RESULTS(0) indicates an
; error during execution of the procedure. In this case, the array
; is formatted as described in the comments to the RPCERRS^MAGUERR1.
;
; If the error descriptor in the RESULTS(1) has the error code -21,
; this means that the RPC could not lock the image(s). A message
; that explains who/what locked the image(s) and when this happened
; is attached to this error as additional information.
;
; In case of successful lock, "1^Ok" is returned in the RESULTS(0).
;
; Notes
; =====
;
; See description of the MAGG IMAGE LOCK remote procedure for more
; details.
;
LOCKIMG(RESULTS,FLAGS,IMGLST) ;
N LOCKS,RC
K RESULTS S RESULTS(0)=0
D CLEAR^MAGUERR(1)
;--- Prepare the list of objects to be locked
S RC=$$LOCKLST(.IMGLST,.LOCKS)
I RC<0 D RPCERRS^MAGUERR1(.RESULTS,RC) Q
;--- Lock the objects
S RC=$$LOCKFM^MAGUTL07(.LOCKS)
I RC<0 D RPCERRS^MAGUERR1(.RESULTS,RC) Q
I RC>0 D Q
. S RC=$$ERROR^MAGUERR(-21,$$TEXT^MAGUTL07(RC),"image")
. D RPCERRS^MAGUERR1(.RESULTS,RC)
. Q
;--- Success
S RESULTS(0)="1^Ok"
Q
;
;+++++ CONVERTS THE LIST OF IMAGES TO THE LOCK/UNLOCK PARAMETERS
LOCKLST(IMGLST,LOCKS) ;
N I,IMGFILE,IMGIEN,TMP,RC
S RC=0
;---
S I=""
F S I=$O(IMGLST(I)) Q:I="" D Q:RC<0
. S TMP=$TR(IMGLST(I)," ")
. S IMGIEN=$P(TMP,U)
. I IMGIEN'>0 S RC=$$IPVE^MAGUERR($NA(IMGLST(I))) Q
. ;--- Get the number of the file that stores the image
. S IMGFILE=$$FILE^MAGGI11(IMGIEN,.TMP)
. I IMGFILE'>0 S RC=TMP D STORE^MAGUERR(RC) Q
. ;--- Store the reference
. S LOCKS(IMGFILE,IMGIEN_",")=""
. Q
;---
Q $S(RC<0:RC,1:0)
;
;***** UNLOCKS THE IMAGE(S)
; RPC: MAGG IMAGE UNLOCK
;
; .RESULTS Reference to a local variable where the results
; are returned to.
;
; FLAGS reserved
;
; .IMGLST( Reference to the list of images to unlock
;
; i) Image reference
; ^01: Image IEN
;
; Return Values
; =============
;
; Zero value of the 1st '^'-piece of the RESULTS(0) indicates an
; error during execution of the procedure. In this case, the array
; is formatted as described in the comments to the RPCERRS^MAGUERR1.
;
; Otherwise, "1^Ok" is returned in the RESULTS(0).
;
UNLOCKIM(RESULTS,FLAGS,IMGLST) ;
N LOCKS,RC
K RESULTS S RESULTS(0)=0
D CLEAR^MAGUERR(1)
;--- Prepare the list of objects to be unlocked
S RC=$$LOCKLST(.IMGLST,.LOCKS)
I RC<0 D RPCERRS^MAGUERR1(.RESULTS,RC) Q
;--- Unlock the objects
S RC=$$UNLOCKFM^MAGUTL07(.LOCKS)
I RC<0 D RPCERRS^MAGUERR1(.RESULTS,RC) Q
;--- Success
S RESULTS(0)="1^Ok"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGA04 4282 printed Dec 13, 2024@02:02:23 Page 2
MAGGA04 ;WOIFO/SG - REMOTE PROCEDURES: IMAGE LOCK/UNLOCK ; 3/9/09 12:51pm
+1 ;;3.0;IMAGING;**93**;Dec 02, 2009;Build 163
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | |
+11 ;; | The Food and Drug Administration classifies this software as |
+12 ;; | a medical device. As such, it may not be changed in any way. |
+13 ;; | Modifications to this software may result in an adulterated |
+14 ;; | medical device under 21CFR820, the use of which is considered |
+15 ;; | to be a violation of US Federal Statutes. |
+16 ;; +---------------------------------------------------------------+
+17 ;;
+18 QUIT
+19 ;
+20 ;***** LOCKS THE IMAGE(S)
+21 ; RPC: MAGG IMAGE LOCK
+22 ;
+23 ; .RESULTS Reference to a local variable where the results
+24 ; are returned to.
+25 ;
+26 ; [FLAGS] reserved
+27 ;
+28 ; .IMGLST( Reference to the List of images to lock
+29 ;
+30 ; i) Image reference
+31 ; ^01: Image IEN
+32 ;
+33 ; Return Values
+34 ; =============
+35 ;
+36 ; Zero value of the 1st '^'-piece of the RESULTS(0) indicates an
+37 ; error during execution of the procedure. In this case, the array
+38 ; is formatted as described in the comments to the RPCERRS^MAGUERR1.
+39 ;
+40 ; If the error descriptor in the RESULTS(1) has the error code -21,
+41 ; this means that the RPC could not lock the image(s). A message
+42 ; that explains who/what locked the image(s) and when this happened
+43 ; is attached to this error as additional information.
+44 ;
+45 ; In case of successful lock, "1^Ok" is returned in the RESULTS(0).
+46 ;
+47 ; Notes
+48 ; =====
+49 ;
+50 ; See description of the MAGG IMAGE LOCK remote procedure for more
+51 ; details.
+52 ;
LOCKIMG(RESULTS,FLAGS,IMGLST) ;
+1 NEW LOCKS,RC
+2 KILL RESULTS
SET RESULTS(0)=0
+3 DO CLEAR^MAGUERR(1)
+4 ;--- Prepare the list of objects to be locked
+5 SET RC=$$LOCKLST(.IMGLST,.LOCKS)
+6 IF RC<0
DO RPCERRS^MAGUERR1(.RESULTS,RC)
QUIT
+7 ;--- Lock the objects
+8 SET RC=$$LOCKFM^MAGUTL07(.LOCKS)
+9 IF RC<0
DO RPCERRS^MAGUERR1(.RESULTS,RC)
QUIT
+10 IF RC>0
Begin DoDot:1
+11 SET RC=$$ERROR^MAGUERR(-21,$$TEXT^MAGUTL07(RC),"image")
+12 DO RPCERRS^MAGUERR1(.RESULTS,RC)
+13 QUIT
End DoDot:1
QUIT
+14 ;--- Success
+15 SET RESULTS(0)="1^Ok"
+16 QUIT
+17 ;
+18 ;+++++ CONVERTS THE LIST OF IMAGES TO THE LOCK/UNLOCK PARAMETERS
LOCKLST(IMGLST,LOCKS) ;
+1 NEW I,IMGFILE,IMGIEN,TMP,RC
+2 SET RC=0
+3 ;---
+4 SET I=""
+5 FOR
SET I=$ORDER(IMGLST(I))
if I=""
QUIT
Begin DoDot:1
+6 SET TMP=$TRANSLATE(IMGLST(I)," ")
+7 SET IMGIEN=$PIECE(TMP,U)
+8 IF IMGIEN'>0
SET RC=$$IPVE^MAGUERR($NAME(IMGLST(I)))
QUIT
+9 ;--- Get the number of the file that stores the image
+10 SET IMGFILE=$$FILE^MAGGI11(IMGIEN,.TMP)
+11 IF IMGFILE'>0
SET RC=TMP
DO STORE^MAGUERR(RC)
QUIT
+12 ;--- Store the reference
+13 SET LOCKS(IMGFILE,IMGIEN_",")=""
+14 QUIT
End DoDot:1
if RC<0
QUIT
+15 ;---
+16 QUIT $SELECT(RC<0:RC,1:0)
+17 ;
+18 ;***** UNLOCKS THE IMAGE(S)
+19 ; RPC: MAGG IMAGE UNLOCK
+20 ;
+21 ; .RESULTS Reference to a local variable where the results
+22 ; are returned to.
+23 ;
+24 ; FLAGS reserved
+25 ;
+26 ; .IMGLST( Reference to the list of images to unlock
+27 ;
+28 ; i) Image reference
+29 ; ^01: Image IEN
+30 ;
+31 ; Return Values
+32 ; =============
+33 ;
+34 ; Zero value of the 1st '^'-piece of the RESULTS(0) indicates an
+35 ; error during execution of the procedure. In this case, the array
+36 ; is formatted as described in the comments to the RPCERRS^MAGUERR1.
+37 ;
+38 ; Otherwise, "1^Ok" is returned in the RESULTS(0).
+39 ;
UNLOCKIM(RESULTS,FLAGS,IMGLST) ;
+1 NEW LOCKS,RC
+2 KILL RESULTS
SET RESULTS(0)=0
+3 DO CLEAR^MAGUERR(1)
+4 ;--- Prepare the list of objects to be unlocked
+5 SET RC=$$LOCKLST(.IMGLST,.LOCKS)
+6 IF RC<0
DO RPCERRS^MAGUERR1(.RESULTS,RC)
QUIT
+7 ;--- Unlock the objects
+8 SET RC=$$UNLOCKFM^MAGUTL07(.LOCKS)
+9 IF RC<0
DO RPCERRS^MAGUERR1(.RESULTS,RC)
QUIT
+10 ;--- Success
+11 SET RESULTS(0)="1^Ok"
+12 QUIT