@@ -149,6 +149,34 @@ ClassMethod ImportPTD(externalName As %String, productionName As %String) As %St
149
149
return sc
150
150
}
151
151
152
+ /// Imports all PTDs within a given directory. Also recursively imports from all subdirectories
153
+ ClassMethod ImportPTDsDir (directory As %String , isDecompMethod As %String = " " ) As %Status
154
+ {
155
+ set sc = $$$OK
156
+ set rs = ##class (%ResultSet ).%New (" %File:FileSet" )
157
+ $$$ThrowOnError(rs .Execute (directory , " *.xml" , " " , 1 ))
158
+ $$$ThrowSQLIfError(rs .%SQLCODE , rs .%Message )
159
+ while rs .Next () {
160
+ set path = rs .Data (" Name" )
161
+ set type = rs .Data (" Type" )
162
+ if type = " D" {
163
+ set sc = ..ImportPTDsDir (path )
164
+ } else {
165
+ $$$ThrowOnError(..ParseExternalName (path , .internalName , .prodName ))
166
+ set srcCtrlCls = ##class (%Studio.SourceControl.Interface ).SourceControlClassGet ()
167
+ set isDecomp = $select (isDecompMethod =" " :1 , 1 :$classMethod (srcCtrlCls , isDecompMethod , internalName ))
168
+ if isDecomp {
169
+ set filename = ##class (%File ).GetFilename (path )
170
+ if ($extract (filename ) = " P" ) && '$$$comClassDefined(prodName ) {
171
+ $$$ThrowOnError(..CreateProduction (prodName ))
172
+ }
173
+ set sc = ..ImportPTD (path , prodName )
174
+ }
175
+ }
176
+ }
177
+ return sc
178
+ }
179
+
152
180
/// Export a single Production Config Item. For a given Ens.Config.Item, the
153
181
/// exports the PTD for this item to the file system under the directory specified
154
182
ClassMethod ExportConfigItemSettings (productionClass As %String , item As %RegisteredObject , nameMethod As %String , Output internalName As %String ) As %Status
@@ -270,10 +298,7 @@ ClassMethod GetModifiedItemsAfterSave(internalName, Output modifiedItems)
270
298
/// Check if current CSP session is EnsPortal page
271
299
ClassMethod IsEnsPortal () As %Boolean
272
300
{
273
- If $IsObject ($Get (%session )) && ($Get (%request .Data (" pageclass" ," 1" )) [ " EnsPortal" ) {
274
- Return 1
275
- }
276
- Return 0
301
+ Return $Data (%request ) && '($IsObject (%request ) && (%request .UserAgent [ " Code" ))
277
302
}
278
303
279
304
/// Perform check if Production Decomposition logic should be used for given item
@@ -334,7 +359,7 @@ ClassMethod ParseExternalName(externalName, Output internalName = "", Output pro
334
359
/// - itemName: name of the configuration item
335
360
/// - productionName: name of the associated production
336
361
/// - isProdSettings: if true, this item is a production settings; if false, this item is a configuration item settings
337
- ClassMethod ParseInternalName (internalName , noFolders As %Boolean = 0 , Output fileName , Output itemName , Output productionName , Output isProdSettings As %Boolean )
362
+ ClassMethod ParseInternalName (internalName , noFolders As %Boolean = 0 , Output fileName , Output itemName , Output itemClassName , Output productionName , Output isProdSettings As %Boolean )
338
363
{
339
364
set name = $piece (internalName ," ." ,1 ,*-1 )
340
365
if 'noFolders {
@@ -394,11 +419,11 @@ ClassMethod RemoveItem(internalName, noFolders As %Boolean = 0) As %Status
394
419
if '##class (%Library.EnsembleMgr ).IsEnsembleNamespace () {
395
420
quit
396
421
}
397
- do ..ParseInternalName (internalName , noFolders , , .itemName , .productionName , .isProdSettings )
422
+ do ..ParseInternalName (internalName , noFolders , , .itemName , .itemClassName , . productionName , .isProdSettings )
398
423
if 'isProdSettings {
399
424
set production = ##class (Ens.Config.Production ).%OpenId (productionName ,,.sc )
400
425
quit :$$$ISERR(sc )
401
- set configItem = production . OpenItemByConfigName (itemName ,.sc )
426
+ set configItem = ##class ( Ens.Config.Production ). OpenItemByConfigName (productionName _ " || " _ itemName _ " | " _ itemClassName ,.sc )
402
427
quit :$$$ISERR(sc )
403
428
do production .RemoveItem (configItem )
404
429
set sc = production .%Save ()
0 commit comments