File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,31 @@ Property JSONSchema As %String(MAXLEN = "");
99
1010Index NameIndex On Name [ IdKey , Unique ];
1111
12+ /// Import a JSON Schema from file
13+ ClassMethod ImportFromFile (
14+ pFileName As %String ,
15+ pCategory As %String = " " ,
16+ pName As %String ) As %Status
17+ {
18+ Set pStatus = $$$OK
19+ Try {
20+ If '##class (%File ).Exists (pFileName ) {
21+ Set pStatus = $$$ERROR($$$GeneralError, " File not found" )
22+ Return pStatus
23+ }
24+ Set tFile = ##class (%File ).%New (pFileName )
25+ $$$ThrowOnError(tFile .Open (" R" ))
26+ Set tSchema = " "
27+ While 'tFile .AtEnd {
28+ Set tSchema = tSchema _ tFile .ReadLine ()
29+ }
30+ Set pStatus = ..Import (tSchema , pCategory , pName )
31+ } Catch ex {
32+ Set pStatus = ex .AsStatus ()
33+ }
34+ Return pStatus
35+ }
36+
1237/// Store the JSON Schema in this object
1338ClassMethod Import (
1439 pSchema As %String ,
You can’t perform that action at this time.
0 commit comments