@@ -1239,24 +1239,32 @@ ClassMethod Name(InternalName As %String) As %String
1239
1239
// Grab the actual name
1240
1240
set actualName = $classmethod (docclass ," GetOther" ,InternalName )
1241
1241
// The actualName is only valid if we get a single .cls as a result
1242
- if actualName '[" ," , $zconvert ($piece (actualName ," ." ,$length (actualName ," ." ))," U" )=" CLS" {
1242
+ if ( actualName '[" ," ) && ( $zconvert ($piece (actualName ," ." ,$length (actualName ," ." ))," U" )=" CLS" ) {
1243
1243
// We use what GetOther() gives us, thus Demo.Loan.FindRateProcess.bpl becomes Demo.Loan.FindRateProcess.cls
1244
1244
set InternalName = actualName
1245
1245
}
1246
1246
}
1247
1247
}
1248
1248
1249
- if $$CheckProtect ^%qccServer (InternalName ) quit " "
1250
- set nam =$piece (InternalName ," ." ,1 ,*-1 ),ext =$piece (InternalName ," ." ,*),ext =$zconvert (ext ," u" )
1251
- if nam =" " ||(ext =" " ) quit " "
1249
+ if $$CheckProtect ^%qccServer (InternalName ) {
1250
+ quit " "
1251
+ }
1252
+
1253
+ set nam =$piece (InternalName ," ." ,1 ,*-1 )
1254
+ set ext =$zconvert ($piece (InternalName ," ." ,*)," u" )
1255
+
1256
+ if (nam =" " )||(ext =" " ){
1257
+ quit " "
1258
+ }
1259
+
1252
1260
// Any CSP items should be matched against the "/CSP/" mapping in ^Sources
1253
1261
if InternalName [" /" {
1254
1262
set filename =$$GetFilename ^%apiCSP (InternalName )
1255
1263
//Find if this csp file is located within the ^Sources tree, and return appropriate value
1256
- if $$$isWINDOWS {
1257
- if $zconvert ( $extract ( filename , 1 , $length ($$$SourceRoot)), " l " )= $zconvert ($$$SourceRoot, " l " ) quit $extract (filename ,$length ($$$SourceRoot)+1 ,*)
1258
- } else {
1259
- if $extract ( filename , 1 , $length ($$$SourceRoot))=$$$SourceRoot quit $extract (filename ,$length ($$$SourceRoot)+1 ,*)
1264
+ if ( $$$isWINDOWS) && ( $zconvert ( $extract ( filename , 1 , $length ($$$SourceRoot)), " l " )= $zconvert ($$$SourceRoot, " l " )) {
1265
+ quit $extract (filename ,$length ($$$SourceRoot)+1 ,*)
1266
+ } elseif $extract ( filename , 1 , $length ($$$SourceRoot))=$$$SourceRoot {
1267
+ quit $extract (filename ,$length ($$$SourceRoot)+1 ,*)
1260
1268
}
1261
1269
//Do not support manipulating files in the /itemsetsourcelink* csp app which are not inside of the namespace's ^Sources tree
1262
1270
if InternalName [" itemsetsourcelink" {
@@ -1266,29 +1274,55 @@ ClassMethod Name(InternalName As %String) As %String
1266
1274
// Any CSP items should be matched against the "/CSP/" mapping if the file is not stored in the ^Sources tree
1267
1275
set ext =" /CSP/"
1268
1276
}
1269
- if ext =" PRJ" ,nam [" Default_" quit " "
1270
- if ext =" CLS" ,$$$defClassKeyGet(nam ,$$$cCLASSgeneratedby)'=" " quit " "
1271
- set default =0
1272
- set p =$order ($$$SourceMapping(ext ,nam )) for set p =$order ($$$SourceMapping(ext ,p ),-1 ) quit :p =" " if $extract (nam ,1 ,$length (p ))=p ,$data (^Sources (ext ,p ),found ) quit
1273
- if $data (found )=0 ,$data ($$$SourceMapping(ext ," *" ),found ),'$$$GetSourceMapping(ext ," *" ," NoFolders" ) set default =1
1274
- if $data (found )=0 quit " "
1277
+
1278
+ if (ext =" PRJ" ) && (nam [" Default_" ){
1279
+ quit " "
1280
+ }
1281
+
1282
+ if (ext =" CLS" ) && ($$$defClassKeyGet(nam ,$$$cCLASSgeneratedby)'=" " ){
1283
+ quit " "
1284
+ }
1285
+
1286
+ set default =1
1287
+ set p =$order ($$$SourceMapping(ext ,nam ))
1288
+ for {
1289
+ set p =$order ($$$SourceMapping(ext ,p ),-1 )
1290
+ quit :p =" "
1291
+ if ($extract (nam ,1 ,$length (p ))=p ) && ($data (^Sources (ext ,p ),found )){
1292
+ quit
1293
+ }
1294
+ }
1295
+ if ($data (found )=0 ) && ($data ($$$SourceMapping(ext ," *" ),found )) && ('$$$GetSourceMapping(ext ," *" ," NoFolders" )){
1296
+ set default =0
1297
+
1298
+ } elseif $data (found )=0 {
1299
+ set found = $zconvert (ext ," L" )_" /"
1300
+ }
1301
+
1275
1302
if InternalName [" /" {
1276
1303
// If no specific mapping was specified (p=""), then return the whole csp filename; otherwise return the name without the mapped piece
1277
1304
set InternalName =$extract (InternalName ,$length (p )+2 ,*)
1278
1305
quit $translate (found _$translate (InternalName ," %" ," _" )," \" ," /" )
1279
- }
1280
- if (ext =" DFI" ) {
1306
+
1307
+ } elseif (ext =" DFI" ) {
1281
1308
// expected format is <folderName>-<itemName>.<itemType>.DFI; will map to an external file named <folderName>/<itemName>.<itemType>.xml
1282
1309
// replace the first '-' with '/' to translate Item Folder into subfolder on disk and leave the other dashes as dashes; converts spaces to '_'
1283
1310
quit $translate (found _$replace ($translate (nam ," % " ," __" )," -" ," /" ,1 ,1 )_" .xml" ," \" ," /" )
1284
- }
1285
- if ext =" CLS" ||(ext =" PRJ" )||(usertype &&(##class (%RoutineMgr ).UserType (InternalName ))) {
1311
+
1312
+ } elseif ext =" CLS" ||(ext =" PRJ" )||(usertype &&(##class (%RoutineMgr ).UserType (InternalName ))) {
1286
1313
set nam =$translate (nam ," %" )
1287
- if '$$$GetSourceMapping(ext ," *" ," NoFolders" ) set nam =$translate (nam ," ." ," /" )
1314
+ if '$$$GetSourceMapping(ext ," *" ," NoFolders" ){
1315
+ set nam =$translate (nam ," ." ," /" )
1316
+ }
1288
1317
#; If match ends in '`' character use UDL/CLS format rather than XML format
1289
- return $translate (found _nam _" .cls" ," \" ," /" )
1318
+ return $translate (found _nam _" ." _$zconvert (ext , " l" )," \" ," /" )
1319
+ }
1320
+
1321
+ if ('default ){
1322
+ quit $translate ($get (found )_$translate (nam ," %." ," _/" )_" ." _$zconvert (ext ," l" )," \" ," /" )
1323
+ } else {
1324
+ quit $translate ($get (found )_nam _" ." _$zconvert (ext ," l" )," \" ," /" )
1290
1325
}
1291
- quit $translate ($get (found )_$translate (nam ," %." ," _/" )_" ." _$zconvert (ext ," l" )," \" ," /" )
1292
1326
}
1293
1327
1294
1328
/*
@@ -1377,10 +1411,10 @@ ClassMethod NameToInternalName(Name, IgnorePercent = 1, IgnoreNonexistent = 1) A
1377
1411
}
1378
1412
if (InternalName =" " ) {
1379
1413
//take our best guess based on the document extension mapped to that subdirectory
1380
- set nam =$piece (nam ," ." ,1 , $length ( nam , " . " ) -1 )
1414
+ set nam =$piece (nam ," ." ,1 * -1 )
1381
1415
set nam =$translate (nam ," _/" ," %." )
1382
- set InternalName =nam _" ." _ ext
1383
- if (ext = " CLS " ) {
1416
+ set InternalName =nam _" ." _ fileExt
1417
+ if (fileExt = " cls " ) {
1384
1418
// special handling for possible collissions between % and non-% classes of the same name
1385
1419
set alternateInternalName =" %" _InternalName
1386
1420
set primaryExists =##class (%RoutineMgr ).Exists (InternalName ), alternateExists =##class (%RoutineMgr ).Exists (alternateInternalName )
0 commit comments