@@ -782,7 +782,7 @@ ClassMethod Type(InternalName As %String) As %String
782
782
}
783
783
784
784
// For an abstract document, use the GetOther() method to try to determine its "real" class
785
- If ##class ( %RoutineMgr ). UserType (InternalName ,.docclass ,.doctype ) {
785
+ If .. UserTypeCached (InternalName ,.docclass ,.doctype ) {
786
786
// Check for a real abstract document subclass (or GetOther() may not work)
787
787
If $classmethod (docclass ," %IsA" ," %Studio.AbstractDocument" ) && $classmethod (docclass ," %Extends" ," Ens.Util.AbstractDocument" ) {
788
788
// Grab the actual name
@@ -1109,7 +1109,7 @@ ClassMethod ImportItem(InternalName As %String, force As %Boolean = 0, verbose A
1109
1109
#dim sc as %Status = $$$OK
1110
1110
1111
1111
if ..IsRoutineOutdated (InternalName ) || force {
1112
- if ##class ( %RoutineMgr ). UserType (InternalName ,.docclass ,.doctype ) {
1112
+ if .. UserTypeCached (InternalName ,.docclass ,.doctype ) {
1113
1113
set routineMgr = ##class (%RoutineMgr ).%OpenId (InternalName )
1114
1114
do routineMgr .Code .Rewind ()
1115
1115
set source = ##class (%Stream.FileCharacter ).%OpenId (filename ,,.sc )
@@ -1172,7 +1172,7 @@ ClassMethod ListItemsInFiles(ByRef itemList, ByRef err) As %Status
1172
1172
set mappedFilePath = ##class (%File ).NormalizeFilename (mappedRelativePath , ..TempFolder ())
1173
1173
1174
1174
if (##class (%File ).DirectoryExists (mappedFilePath )){
1175
- if ##class ( %Library.RoutineMgr ). UserType (" foo." _mappingFileType ) {
1175
+ if .. UserTypeCached (" foo." _mappingFileType ) {
1176
1176
set fileSpec = " *." _$zcvt (mappingFileType ," L" )_" ;*." _$zconvert (mappingFileType ," U" )
1177
1177
set files = ##class (%Library.File ).FileSetFunc (mappedFilePath ,fileSpec )
1178
1178
while files .%Next () {
@@ -1271,7 +1271,7 @@ ClassMethod ImportRoutines(force As %Boolean = 0) As %Status
1271
1271
if ##class (%File ).Exists (filename ) && '##class (%File ).Delete (filename ) {
1272
1272
set ec = $$$ADDSC(ec , ..MakeError (" Error while removing " _item ))
1273
1273
}
1274
- }elseif ##class ( %Library.RoutineMgr ). UserType (item ) {
1274
+ }elseif .. UserTypeCached (item ) {
1275
1275
set ec = $$$ADDSC(ec , ##class (%Library.RoutineMgr ).Delete (item ))
1276
1276
} else {
1277
1277
set deleted = 0
@@ -1553,10 +1553,10 @@ ClassMethod Name(InternalName As %String, ByRef MappingExists As %Boolean) As %S
1553
1553
set relativePath = context .ResourceReference .Processor .OnItemRelativePath (InternalName )
1554
1554
quit relativePath
1555
1555
}
1556
- set usertype =$system .CLS .IsMthd (" %Library.RoutineMgr" ," UserType" )
1557
1556
1558
1557
// For an abstract document, use the GetOther() method to try to determine its "real" class
1559
- if usertype ,##class (%RoutineMgr ).UserType (InternalName ,.docclass ,.doctype ) {
1558
+ if ..UserTypeCached (InternalName ,.docclass ,.doctype ) {
1559
+ set usertype = 1
1560
1560
// Check for a real abstract document subclass (or GetOther() may not work)
1561
1561
if $classmethod (docclass ," %IsA" ," %Studio.AbstractDocument" ) && $classmethod (docclass ," %Extends" ," Ens.Util.AbstractDocument" ) {
1562
1562
// Grab the actual name
@@ -1664,6 +1664,31 @@ ClassMethod Name(InternalName As %String, ByRef MappingExists As %Boolean) As %S
1664
1664
}
1665
1665
}
1666
1666
1667
+ /// Implementation copied from %Library.RoutineMgr, but with results cached in a PPG.
1668
+ ClassMethod UserTypeCached (Name As %String , ByRef Class As %String , ByRef StudioType As %String , ByRef Schema As %String , ByRef StudioIcon As %Integer ) As %Boolean
1669
+ {
1670
+ Set ext =$zconvert ($piece (Name ," ." ,*)," U" ) If ext =" " Quit 0
1671
+ If $Data (^||UserTypeCache (ext ," NotUserType" ))#2 {
1672
+ Quit 0
1673
+ }
1674
+ If $Data (^||UserTypeCache (ext ),data )#2 {
1675
+ Set Class = $Get (^||UserTypeCache (ext ," Class" ))
1676
+ Set StudioType =$list (data ),Schema =$listget (data ,3 ),StudioIcon =+$listget (data ,4 )
1677
+ Quit 1
1678
+ }
1679
+ Do StudioDocument ^%SYS .cspServer2 (.document )
1680
+ Set Class =" " ,StudioType =" " ,Schema =" "
1681
+ For Set Class =$order (document (Class )) Quit :Class =" " ||($data (document (Class ,ext ),data ))
1682
+ If Class =" " {
1683
+ Set ^||UserTypeCache (ext ," NotUserType" ) = 1
1684
+ Quit 0
1685
+ }
1686
+ Set StudioType =$list (data ),Schema =$listget (data ,3 ),StudioIcon =+$listget (data ,4 )
1687
+ Set ^||UserTypeCache (ext ) = data
1688
+ Set ^||UserTypeCache (ext ," Class" ) = Class
1689
+ Quit 1
1690
+ }
1691
+
1667
1692
/*
1668
1693
NameToInternalName(name): given a Unix-style slash path relative to repo root,
1669
1694
returns the internal name for that file (e.g., cls/SourceControl/Git/Utils.cls -> SourceControl.Git.Utils.CLS)
0 commit comments