@@ -227,20 +227,16 @@ ClassMethod IsEnsPortal() As %Boolean
227
227
/// Perform check if Production Decomposition logic should be used for given item
228
228
ClassMethod IsProductionClass (className As %String , nameMethod As %String ) As %Boolean
229
229
{
230
- if $$$comClassDefined(className ) {
230
+ if ( className '= " " ) && $$$comClassDefined(className ) {
231
231
return $classmethod (className , " %Extends" , " Ens.Production" )
232
232
} else {
233
233
set filename = $classmethod ($$SrcCtrlCls ^%buildccr , nameMethod , className _" .CLS" )
234
234
if ##class (%File ).Exists (filename ) {
235
235
$$$ThrowOnError($System .OBJ .Load (filename ))
236
236
}
237
237
set classDef = ##class (%Dictionary.ClassDefinition ).%OpenId (className )
238
- if $isobject (classDef ) {
239
- for key =1 :1 :classDef .XDatas .Count () {
240
- if classDef .XDatas .GetAt (key ).Name = " ProductionDefinition" {
241
- return 1
242
- }
243
- }
238
+ if $isobject (classDef ) && ##class (%Dictionary.ClassDefinition ).%ExistsId (classDef .Super ) {
239
+ return $classmethod (classDef .Super , " %Extends" , " Ens.Production" )
244
240
}
245
241
}
246
242
return 0
@@ -316,4 +312,26 @@ ClassMethod RemoveItem(internalName, noFolders As %Boolean = 0) As %Status
316
312
return sc
317
313
}
318
314
315
+ /// Given internal name for a Production Settings PTD, creates the corresponding Production
316
+ /// Class if it does not already exist in this namespace
317
+ ClassMethod CreateProduction (productionName As %String , superClasses = " " ) As %Status
318
+ {
319
+ set classDef = ##class (%Dictionary.ClassDefinition ).%New (productionName )
320
+ if superClasses '= " " {
321
+ set classDef .Super = superClasses
322
+ } else {
323
+ set classDef .Super = " Ens.Production"
324
+ }
325
+ set productionXData = ##class (%Dictionary.XDataDefinition ).%New ()
326
+ set productionXData .Name = " ProductionDefinition"
327
+ set sc = productionXData .Data .WriteLine (" <Production Name=" " " _productionName _" " " />" )
328
+ if $$$ISERR(sc ) return sc
329
+ set sc = classDef .XDatas .Insert (productionXData )
330
+ if $$$ISERR(sc ) return sc
331
+ set sc = classDef .%Save ()
332
+ if $$$ISERR(sc ) return sc
333
+ set sc = $System .OBJ .Compile (productionName )
334
+ return sc
335
+ }
336
+
319
337
}
0 commit comments