Skip to content

Commit 15a2760

Browse files
committed
production decomposition refactoring and code style improvements
1 parent f0652de commit 15a2760

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

cls/SourceControl/Git/Production.cls

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ ClassMethod ExportPTD(internalName As %String, nameMethod) As %Status
106106
ClassMethod ExportConfigItemSettings(productionClass As %String, item As %RegisteredObject, nameMethod As %String, Output internalName As %String) As %Status
107107
{
108108
set internalName = ..CreateInternalName(productionClass, item.Name, item.ClassName, 0)
109-
Set externalName = $ClassMethod($$SrcCtrlCls^%buildccr, nameMethod, internalName)
109+
Set externalName = $ClassMethod(##class(%Studio.SourceControl.Interface).SourceControlClassGet(), nameMethod, internalName)
110110
Set filename = ##class(%File).NormalizeFilename(externalName)
111111
set st = ##class(Ens.Deployment.Utils).CreatePTDFromItem(.item, .ptdName)
112112
$$$QuitOnError(st)
@@ -125,7 +125,7 @@ ClassMethod ExportProductionSettings(productionClass As %String, nameMethod As %
125125
If $$$ISERR(sc) {
126126
Return sc
127127
}
128-
Set externalName = $ClassMethod($$SrcCtrlCls^%buildccr, nameMethod, internalName)
128+
Set externalName = $ClassMethod(##class(%Studio.SourceControl.Interface).SourceControlClassGet(), nameMethod, internalName)
129129
Set filename = ##class(%File).NormalizeFilename(externalName)
130130
set sc = ..ExportProjectForPTD(productionClass, ptdName, filename)
131131
Return sc
@@ -172,16 +172,16 @@ ClassMethod GetModifiedItemsBeforeSave(internalName, Location, Output modifiedIt
172172
// FUTURE: implement this to support Studio
173173
}
174174
// populate data for use in OnAfterSave
175-
kill ^mtempsscProd($job,"modifiedItems")
176-
merge ^mtempsscProd($job,"modifiedItems") = modifiedItems
175+
kill ^IRIS.Temp("sscProd",$job,"modifiedItems")
176+
merge ^IRIS.Temp("sscProd",$job,"modifiedItems") = modifiedItems
177177
// FUTURE: use a percent variable or PPG instead
178-
kill ^mtempsscProd($job,"items")
178+
kill ^IRIS.Temp("sscProd",$job,"items")
179179
set rs = ##class(%SQL.Statement).%ExecDirect(
180180
,"select Name, ClassName from Ens_Config.Item where Production = ?"
181181
, productionName)
182182
$$$ThrowSQLIfError(rs.%SQLCODE, rs.%Message)
183183
while rs.%Next() {
184-
set ^mtempsscProd($job,"items",$listbuild(rs.Name, rs.ClassName)) = 1
184+
set ^IRIS.Temp("sscProd",$job,"items",$listbuild(rs.Name, rs.ClassName)) = 1
185185
}
186186
}
187187

@@ -196,22 +196,22 @@ ClassMethod GetModifiedItemsAfterSave(internalName, Output modifiedItems)
196196
, productionName)
197197
$$$ThrowSQLIfError(rs.%SQLCODE, rs.%Message)
198198
while rs.%Next() {
199-
if '$get(^mtempsscProd($job,"items", $listbuild(rs.Name, rs.ClassName))) {
199+
if '$get(^IRIS.Temp("sscProd",$job,"items", $listbuild(rs.Name, rs.ClassName))) {
200200
set itemInternalName = ..CreateInternalName(productionName, rs.Name, rs.ClassName, 0)
201201
set modifiedItems(itemInternalName) = "A"
202202
}
203-
kill ^mtempsscProd($job,"items", $listbuild(rs.Name, rs.ClassName))
203+
kill ^IRIS.Temp("sscProd",$job,"items", $listbuild(rs.Name, rs.ClassName))
204204
}
205-
set key = $order(^mtempsscProd($job,"items",""))
205+
set key = $order(^IRIS.Temp("sscProd",$job,"items",""))
206206
while (key '= "") {
207207
set itemInternalName = ..CreateInternalName(productionName, $listget(key,1), $listget(key,2), 0)
208208
set modifiedItems(itemInternalName) = "D"
209-
set key = $order(^mtempsscProd($job,"items",key))
209+
set key = $order(^IRIS.Temp("sscProd",$job,"items",key))
210210
}
211211
// If editing from SMP, get the modified items from a cache stored in OnBeforeSave.
212212
// Only do this if there are no added/deleted items, because otherwise production settings will be incorrectly included.
213213
if '$data(modifiedItems) {
214-
merge modifiedItems = ^mtempsscProd($job,"modifiedItems")
214+
merge modifiedItems = ^IRIS.Temp("sscProd",$job,"modifiedItems")
215215
}
216216
} else {
217217
// If editing/adding/deleting from Studio, get the modified items from a percent variable set in OnBeforeSave.
@@ -234,7 +234,7 @@ ClassMethod IsProductionClass(className As %String, nameMethod As %String) As %B
234234
if (className '= "") && $$$comClassDefined(className) {
235235
return $classmethod(className, "%Extends", "Ens.Production")
236236
} else {
237-
set filename = $classmethod($$SrcCtrlCls^%buildccr, nameMethod, className_".CLS")
237+
set filename = $classmethod(##class(%Studio.SourceControl.Interface).SourceControlClassGet(), nameMethod, className_".CLS")
238238
if ##class(%File).Exists(filename) {
239239
$$$ThrowOnError($System.OBJ.Load(filename))
240240
}
@@ -314,7 +314,7 @@ ClassMethod RemoveItemByExternalName(externalName, nameMethod) As %Status
314314
for i=1:1:production.Items.Count() {
315315
set configItem = production.Items.GetAt(i)
316316
set itemInternalName = ..CreateInternalName(productionName, configItem.Name, configItem.ClassName)
317-
set itemExternalName = $classmethod($$SrcCtrlCls^%buildccr, nameMethod, itemInternalName)
317+
set itemExternalName = $classmethod(##class(%Studio.SourceControl.Interface).SourceControlClassGet(), nameMethod, itemInternalName)
318318
if itemExternalName = externalName {
319319
set itemToRemove = configItem
320320
quit

cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Method DeleteFile(item As %String = "", externalName As %String = "") As %Status
5151
if type = "prj" {
5252
set sc = $system.OBJ.DeleteProject(name)
5353
}elseif type = "cls" {
54-
if settings.decomposeProductions && ##class(SourceControl.Git.Production).IsProductionClass(name, "FullExternalName") {
54+
if ##class(SourceControl.Git.Utils).ItemIsProductionToDecompose(name) {
5555
write !, "Production decomposition enabled, skipping delete of production class"
5656
} else {
5757
set sc = $system.OBJ.Delete(item)

cls/SourceControl/Git/Utils.cls

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,9 +1280,7 @@ ClassMethod ImportItem(InternalName As %String, force As %Boolean = 0, verbose A
12801280
do ##class(%File).Delete(rollbackFile)
12811281
}
12821282
}
1283-
} elseif (type = "cls") && settings.decomposeProductions
1284-
&& ##class(SourceControl.Git.Production).IsProductionClass(
1285-
..NameWithoutExtension(InternalName), "FullExternalName") {
1283+
} elseif ..ItemIsProductionToDecompose(InternalName) {
12861284
write !, "Production decomposition enabled, skipping import of production class"
12871285
set imported = 0
12881286
} elseif ..UserTypeCached(InternalName,.docclass,.doctype) {

0 commit comments

Comments
 (0)