source: WorldVistAEHR/trunk/r/HEALTHEVET_DESKTOP-XHD/XHDPMUT.m@ 1714

Last change on this file since 1714 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 6.8 KB
RevLine 
[613]1XHDPMUT ; SLC/JER - Get Mutable Configuration ; 25 Jul 2003 9:42 AM
2 ;;1.0;HEALTHEVET DESKTOP;;Jul 15, 2003
3GETTREE(XHDCY,XHDMOD) ; Control Branching
4 N XHDCI,XHDCDA
5 S XHDCI=0,XHDCDA=+$O(^XHD(8935.91,"AMROOT",XHDMOD,0))
6 S XHDCY=$NA(^TMP("XHDPTREE",$J)) K @XHDCY
7 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<?xml version=""1.0"" encoding=""UTF-8""?>"
8 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<getConfigurationCallResult"
9 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"""
10 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="xsi:noNamespaceSchemaLocation=""C:\reeng\main\modules\config\src\gov\va\med\hds\cd\config\xml\getConfigurationCallResult.xsd"">"
11 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<configTree>"
12 D GETCAT(XHDCY,XHDCDA,.XHDCI)
13 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</configTree>"
14 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</getConfigurationCallResult>"
15 S XHDCY=$NA(^TMP("XHDPTREE",$J,"XMLDOC"))
16 Q
17FLDS() ; Get field string
18 Q ".01:1"
19GETCAT(XHDCY,XHDCDA,XHDCI) ; Loads Top-level Fields
20 N XHDCF,XHDKI,PCATAG S XHDCF=0
21 S PCATAG=$S($$ISROOT(XHDCDA):"pluginParameterCategory",1:"parameterCategory")
22 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<"_PCATAG_">"
23 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<id>"_XHDCDA_"</id>"
24 D GETS^DIQ(8935.91,XHDCDA_",",$$FLDS,"IE",XHDCY)
25 F S XHDCF=$O(@XHDCY@(8935.91,XHDCDA_",",XHDCF)) Q:XHDCF'>0 D
26 . N TAG,VAL
27 . S TAG=$TR($$FLDNAME(XHDCF,8935.91)," /","")
28 . S VAL=$G(@XHDCY@(8935.91,XHDCDA_",",XHDCF,$S(XHDCF=.04:"I",1:"E")))
29 . I XHDCF=.04 S VAL=+VAL
30 . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<"_TAG_">"_VAL_"</"_TAG_">"
31 K @XHDCY@(8935.91)
32 ;** get parameters **
33 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<parameters>"
34 ;D GETPARAM(XHDCY,XHDCDA,.XHDCI)
35 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</parameters>"
36 S XHDKI=0
37 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<children>"
38 F S XHDKI=$O(^XHD(8935.91,XHDCDA,3,XHDKI)) Q:+XHDKI'>0 D
39 . N XHDKID S XHDKID=$P($G(^XHD(8935.91,XHDCDA,3,XHDKI,0)),U,2)
40 . D GETCAT(XHDCY,XHDKID,.XHDCI)
41 S XHDKI=0
42 F S XHDKI=$O(^XHD(8935.91,XHDCDA,2,XHDKI)) Q:+XHDKI'>0 D
43 . N XHDPARAM S XHDPARAM=$P($G(^XHD(8935.91,XHDCDA,2,XHDKI,0)),U,2)
44 . D GETLEAF(XHDCY,XHDPARAM,XHDCDA,.XHDCI)
45 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</children>"
46 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</"_PCATAG_">"
47 Q
48GETLEAF(XHDCY,PAR,PID,XHDCI) ; Build Leafnode categories
49 N FULLNAME,PLUGINID,NAME,PARAM0,PCAT0
50 S PARAM0=$G(^XTV(8989.51,PAR,0)),PCAT0=$G(^XHD(8935.91,PID,0))
51 S FULLNAME=$$ESCAPE^XHDLXM($P(PARAM0,U)),NAME=$$ESCAPE^XHDLXM($P(PARAM0,U,2))
52 S PLUGINID=$P(PCAT0,U,2)
53 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<parameterCategory>"
54 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<id>0</id>"
55 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<fullName>"_FULLNAME_"</fullName>"
56 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<pluginId>"_PLUGINID_"</pluginId>"
57 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<name>"_NAME_"</name>"
58 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<parentId>"_PID_"</parentId>"
59 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<packageRoot>false</packageRoot>"
60 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<preferencePageId/>"
61 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<leaf>true</leaf>"
62 ;** get parameters **
63 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<parameters>"
64 D GETINSTS(XHDCY,PAR,.XHDCI)
65 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</parameters>"
66 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<children/>"
67 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</parameterCategory>"
68 Q
69ISROOT(XHDCDA) ; Boolean - is record plugin root?
70 Q +$P($G(^XHD(8935.91,XHDCDA,0)),U,5)
71FLDNAME(XHDCFN,FILENUM) ; Resolve field names
72 Q $$MIXED($P($G(^DD(FILENUM,XHDCFN,0)),U))
73MIXED(X) ; Return Mixed Case X
74 N XHDI,WORD,TMP
75 S TMP="" F XHDI=1:1:$L(X," ") S WORD=$$LOW^XLFSTR($P(X," ",XHDI)),$E(WORD)=$S(XHDI=1:$E(WORD),1:$$UP^XLFSTR($E(WORD))),TMP=$S(TMP="":WORD,1:TMP_WORD)
76 Q TMP
77GETPARAM(XHDCY,XHDCDA,XHDCI) ; Loads Parameters
78 N XHDI S XHDI=0
79 F S XHDI=$O(^XHD(8935.91,XHDCDA,2,XHDI)) Q:+XHDI'>0 D
80 . N PNODE,FULLNAME,MULTIVAL,WORDPROC,PAR,PARDEF0,PARDEF1,DNAME,VDTYPE,READONLY
81 . S PNODE=$G(^XHD(8935.91,XHDCDA,2,XHDI,0))
82 . Q:PNODE']""
83 . S PAR=$P(PNODE,U,2) D GETINSTS(XHDCY,PAR,.XHDCI)
84 Q
85GETINSTS(XHDCY,PAR,XHDCI) ; get all instances of parameter PAR
86 N FULLNAME,MULTIVAL,WORDPROC,PARDEF0,PARDEF1,DNAME,VDTYPE,READONLY
87 S PARDEF0=$G(^XTV(8989.51,PAR,0)),PARDEF1=$G(^(1))
88 S FULLNAME=$P(PARDEF0,U),DNAME=$P(PARDEF0,U,2),VDTYPE=$P(PARDEF1,U)
89 S READONLY=$S(+$P(PARDEF0,U,6):"true",1:"false")
90 S MULTIVAL=$S(+$P(PARDEF0,U,3):"true",1:"false")
91 S WORDPROC=$S(VDTYPE="W":"true",1:"false")
92 N PLIST,ERR
93 D GETLST^XHDPAR(.PLIST,PAR,.ERR)
94 I 'ERR D
95 . N XHDJ S XHDJ=0
96 . F S XHDJ=$O(PLIST(XHDJ)) Q:+XHDJ'>0 D
97 . . N KEY,ENT,INST,VAL,NAME,EXTENT
98 . . S NAME=$$ESCAPE^XHDLXM(DNAME)
99 . . S ENT=$P(PLIST(XHDJ),U),EXTENT=$P(PLIST(XHDJ),U,2)
100 . . S INST=$P(PLIST(XHDJ),U,3),VAL=$P(PLIST(XHDJ),U,4)
101 . . S:(MULTIVAL="true") NAME=NAME_" "_INST
102 . . S KEY=NAME_U_ENT_U_PAR_U_INST
103 . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<parameter>"
104 . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<id>"_PAR_"</id>"
105 . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<name>"_NAME_"</name>"
106 . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<fullName>"_$$ESCAPE^XHDLXM(FULLNAME)_"</fullName>"
107 . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<key>"_KEY_"</key>"
108 . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<readOnly>"_READONLY_"</readOnly>"
109 . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<extEntity>"_EXTENT_"</extEntity>"
110 . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<multiValued>"_MULTIVAL_"</multiValued>"
111 . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<wordProcessing>"_WORDPROC_"</wordProcessing>"
112 . . ; If wp, call for wp result
113 . . I (WORDPROC="true") D
114 . . . N VALIST,ERR
115 . . . D GETWP^XPAR(.VALIST,"ALL^"_$P(KEY,U,2),PAR,INST,.ERR)
116 . . . I 'ERR D
117 . . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<value>"
118 . . . . N XHDK S XHDK=0
119 . . . . F S XHDK=$O(VALIST(XHDK)) Q:+XHDK'>0 D
120 . . . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)=$$ESCAPE^XHDLXM($G(VALIST(XHDK,0)))
121 . . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</value>"
122 . . . N DFLIST,ERR
123 . . . D GETWP^XPAR(.DFLIST,"PKG",PAR,INST,.ERR)
124 . . . I 'ERR D
125 . . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<defaultValue>"
126 . . . . N XHDK S XHDK=0
127 . . . . F S XHDK=$O(VALIST(XHDK)) Q:+XHDK'>0 D
128 . . . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)=$$ESCAPE^XHDLXM($G(VALIST(XHDK,0)))
129 . . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</defaultValue>"
130 . . E D
131 . . . N DVAL S DVAL=$$GET^XPAR("PKG",PAR,INST,$S(VDTYPE="D":"Q",1:"E"))
132 . . . S VAL=$$XFORM^XHDPTREE(VAL,VDTYPE)
133 . . . S DVAL=$$XFORM^XHDPTREE(DVAL,VDTYPE)
134 . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<value>"_$$ESCAPE^XHDLXM(VAL)_"</value>"
135 . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<defaultValue>"_$$ESCAPE^XHDLXM(DVAL)_"</defaultValue>"
136 . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</parameter>"
137 Q
Note: See TracBrowser for help on using the repository browser.