Skip to content

Commit 6408762

Browse files
committed
WellTriggerFactory: add ignored
1 parent 6be59ef commit 6408762

3 files changed

Lines changed: 19 additions & 14 deletions

File tree

api/src/org/labkey/api/data/triggers/Trigger.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ public static ManagedColumns empty()
112112
return new ManagedColumns(Collections.emptySet(), Collections.emptySet(), null);
113113
}
114114

115+
public static ManagedColumns ignored(@NotNull String... ignored)
116+
{
117+
return new ManagedColumns(Collections.emptySet(), Collections.emptySet(), Sets.newCaseInsensitiveHashSet(ignored));
118+
}
119+
115120
public @Nullable Set<String> getColumns(TableInfo.TriggerType type)
116121
{
117122
if (type == TableInfo.TriggerType.INSERT)

assay/src/org/labkey/assay/plate/PlateManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,11 @@ public class PlateManager implements PlateService, AssayListener, ExperimentList
212212
private final AtomicBoolean _pausePlateIndex = new AtomicBoolean(false);
213213
private static final Object PLATE_INDEX_LOCK = new Object();
214214

215-
// This flag is applied to the extraScriptContext of query mutating calls (e.g. insertRows, updateRows, etc.)
215+
// This flag is applied to the extraScriptContext of query mutating calls (e.g., insertRows, updateRows, etc.)
216216
// when those calls are being made for a plate copy operation.
217217
public static final String PLATE_COPY_FLAG = ".plateCopy";
218218

219-
// This flag is applied to the extraScriptContext of query mutating calls (e.g. insertRows, updateRows, etc.)
219+
// This flag is applied to the extraScriptContext of query mutating calls (e.g., insertRows, updateRows, etc.)
220220
// when those calls are being made for a plate save operation.
221221
public static final String PLATE_SAVE_FLAG = ".plateSave";
222222

assay/src/org/labkey/assay/plate/data/WellTriggerFactory.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@ private class ValidateRunImportedPlateTrigger implements Trigger
5454

5555
@Override
5656
public void beforeUpdate(
57-
TableInfo table,
58-
Container c,
59-
User user,
60-
@Nullable QueryUpdateService.InsertOption insertOption, @Nullable Map<String, Object> newRow,
61-
@Nullable Map<String, Object> oldRow,
62-
ValidationException errors,
63-
Map<String, Object> extraContext
57+
TableInfo table,
58+
Container c,
59+
User user,
60+
@Nullable QueryUpdateService.InsertOption insertOption,
61+
@Nullable Map<String, Object> newRow,
62+
@Nullable Map<String, Object> oldRow,
63+
ValidationException errors,
64+
Map<String, Object> extraContext
6465
) throws ValidationException
6566
{
6667
if (oldRow == null || errors.hasErrors() || !oldRow.containsKey(WellTable.Column.PlateId.name()))
@@ -92,7 +93,8 @@ private class EnsureSampleWellTypeTrigger implements Trigger
9293
@Override
9394
public @Nullable ManagedColumns getManagedColumns()
9495
{
95-
return ManagedColumns.all(WellTable.Column.Type.name());
96+
// "Type" is a calculated column, so we do not include it as a managed column
97+
return ManagedColumns.ignored(WellTable.Column.Type.name());
9698
}
9799

98100
private void addTypeSample(
@@ -121,8 +123,8 @@ private void addTypeSample(
121123
newRow.put(WellTable.Column.Type.name(), WellGroup.Type.SAMPLE.name());
122124
}
123125

124-
// Since "Type" is a calculated column (i.e. not in the database) its value is not included in
125-
// the original row, thus, we need to query for it dynamically.
126+
// Since "Type" is a calculated column (i.e., not in the database), its value is not included in
127+
// the original row; thus, we need to query for it dynamically.
126128
private boolean hasWellType(Container c, User user, @Nullable Map<String, Object> oldRow)
127129
{
128130
if (oldRow == null)
@@ -157,7 +159,6 @@ public void beforeInsert(
157159
)
158160
{
159161
addTypeSample(c, user, newRow, null, extraContext);
160-
setInsertManagedColumns(newRow, existingRecord, insertOption);
161162
}
162163

163164
@Override
@@ -173,7 +174,6 @@ public void beforeUpdate(
173174
)
174175
{
175176
addTypeSample(c, user, newRow, oldRow, extraContext);
176-
setUpdateManagedColumns(newRow, oldRow, insertOption);
177177
}
178178
}
179179

0 commit comments

Comments
 (0)