Skip to content

Issue 53306: Some LKS forms don't distinguish between fields properly #6804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from
Draft
8 changes: 4 additions & 4 deletions api/src/org/labkey/api/assay/actions/UploadWizardAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,9 @@ protected void addHiddenRunProperties(FormType newRunForm, InsertView insertView
public static String getInputName(DomainProperty property, String disambiguationId)
{
if (disambiguationId != null)
return ColumnInfo.propNameFromName(disambiguationId + "_" + property.getName());
return disambiguationId + "_" + property.getName();
else
return ColumnInfo.propNameFromName(property.getName());
return property.getName();
}

public static String getInputName(DomainProperty property)
Expand All @@ -783,7 +783,7 @@ protected void addHiddenProperties(Map<DomainProperty, String> properties, Inser
{
for (Map.Entry<DomainProperty, String> entry : properties.entrySet())
{
String name = ColumnInfo.propNameFromName(entry.getKey().getName());
String name = entry.getKey().getName();
String value = entry.getValue();
insertView.getDataRegion().addHiddenFormField(name, value);
}
Expand Down Expand Up @@ -940,7 +940,7 @@ public void validateStep(FormType form, Errors errors)
{
validatePostedProperties(getViewContext(), form.getBatchProperties(), errors);

if (ThawListResolverType.NAME.equals(form.getRequest().getParameter("participantVisitResolver")))
if (ThawListResolverType.NAME.equals(form.getRequest().getParameter(AbstractAssayProvider.PARTICIPANT_VISIT_RESOLVER_PROPERTY_NAME)))
ThawListResolverType.validationHelper(form, errors);

}
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/data/AbstractTableInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ protected ColumnInfo resolveColumn(String name)
{
if (null != col) // #19358
{
String propName = col.getPropertyName();
String propName = BaseColumnInfo.propNameFromName(col.getName());
if (null != propName && propName.equalsIgnoreCase(name))
return col;
}
Expand Down
6 changes: 0 additions & 6 deletions api/src/org/labkey/api/data/AbstractWrappedColumnInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,6 @@ public boolean isShouldLog()
return delegate.isShouldLog();
}

@Override
public String getPropertyName()
{
return delegate.getPropertyName();
}

@Override
public boolean isVersionColumn()
{
Expand Down
16 changes: 1 addition & 15 deletions api/src/org/labkey/api/data/BaseColumnInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ public class BaseColumnInfo extends ColumnRenderPropertiesImpl implements Mutabl

@NotNull
private FieldKey _fieldKey;
// _propertyName is computed from getName();
private String _propertyName = null;
private DatabaseIdentifier _alias;
private String _sqlTypeName;
private JdbcType _jdbcType = null;
Expand Down Expand Up @@ -253,7 +251,6 @@ public void setName(@NotNull String name)
FieldKey newFieldKey = new FieldKey(null, name);
assert !_lockName || 0 == _fieldKey.compareTo(newFieldKey);
_fieldKey = newFieldKey;
_propertyName = null;
}


Expand All @@ -272,7 +269,6 @@ public void setFieldKey(@NotNull FieldKey key)
{
checkLocked();
_fieldKey = Objects.requireNonNull(key);
_propertyName = null;
}


Expand Down Expand Up @@ -887,16 +883,6 @@ public void setShouldLog(boolean shouldLog)
_shouldLog = shouldLog;
}

@Override
public String getPropertyName()
{
// this is surprisingly expensive, cache it!
if (null == _propertyName)
_propertyName = propNameFromName(getName());
return _propertyName;
}


/**
* Version column can be used for optimistic concurrency.
* for now we assume that this column is never updated
Expand Down Expand Up @@ -1727,7 +1713,7 @@ public static Collection<BaseColumnInfo> createFromDatabaseMetaData(String schem
col._label = reader.getLabel();
col._description = reader.getDescription();

if (NON_EDITABLE_COL_NAMES.contains(col.getPropertyName()))
if (NON_EDITABLE_COL_NAMES.contains(col.getName()))
col.setUserEditable(false);

colMap.put(col.getName(), col);
Expand Down
2 changes: 0 additions & 2 deletions api/src/org/labkey/api/data/ColumnInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ static int findColumn(ResultSet rs, String name)

boolean isShouldLog();

String getPropertyName();

/**
* Version column can be used for optimistic concurrency.
* for now we assume that this column is never updated
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/data/DisplayColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public Object getJsonValue(RenderContext ctx)
public String getName()
{
if (null != getColumnInfo())
return getColumnInfo().getPropertyName();
return getColumnInfo().getName();
else
return super.getName();
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/data/DisplayColumnGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void writeSameCheckboxCell(RenderContext ctx, HtmlWriter out)

private String getGroupFormFieldName(RenderContext ctx)
{
return ColumnInfo.propNameFromName(getColumns().get(0).getFormFieldName(ctx));
return getColumns().get(0).getFormFieldName(ctx);
}

public void writeCopyableJavaScript(RenderContext ctx, Writer out) throws IOException
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/data/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ public static void ensureRequiredColumns(TableInfo table, Map<FieldKey, ColumnIn
{
if (cols.containsKey(column.getFieldKey()))
continue;
if (requiredColumns.contains(column.getFieldKey()) || requiredColumns.contains(new FieldKey(null,column.getAlias().getId())) || requiredColumns.contains(new FieldKey(null,column.getPropertyName())))
if (requiredColumns.contains(column.getFieldKey()) || requiredColumns.contains(new FieldKey(null,column.getAlias().getId())) || requiredColumns.contains(new FieldKey(null,column.getName())))
cols.put(column.getFieldKey(), column);
else if (column.isKeyField())
cols.put(column.getFieldKey(), column);
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/data/TableViewForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ public void forceReselect()

public String getFormFieldName(@NotNull ColumnInfo column)
{
return column.getPropertyName();
return column.getName();
}

public String getMultiPartFormFieldName(@NotNull ColumnInfo column)
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/data/TableWrapperDynaClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private TableWrapperDynaClass(TableInfo tinfo)
List<ColumnInfo> cols = tinfo.getColumns();
Map<String, Class<?>> propMap = new CaseInsensitiveHashMap<>();
for (ColumnInfo col : cols)
propMap.put(col.getPropertyName(), col.getJavaClass());
propMap.put(col.getName(), col.getJavaClass());

init(tinfo.getName(), propMap);
}
Expand Down
7 changes: 3 additions & 4 deletions api/src/org/labkey/api/exp/SamplePropertyHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void addSampleColumns(InsertView view, User user)
}
}

public void addSampleColumns(InsertView view, User user, @Nullable AssayRunUploadForm defaultValueContext, boolean errorReshow) throws ExperimentException
public void addSampleColumns(InsertView view, User user, @Nullable AssayRunUploadForm<?> defaultValueContext, boolean errorReshow) throws ExperimentException
{
DataRegion region = view.getDataRegion();
List<String> sampleNames = getSampleNames();
Expand Down Expand Up @@ -215,10 +215,9 @@ public Map<String, Map<DomainProperty, String>> getPostedPropertyValues(HttpServ
for (DomainProperty sampleProperty : _domainProperties)
{
String name = UploadWizardAction.getInputName(sampleProperty, sampleName);
String inputName = ColumnInfo.propNameFromName(name);
// handle the hidden input field prefixed with FIELD_MARKER for checkboxes
String value = request.getParameter(inputName);
if (value == null && request.getParameter(SpringActionController.FIELD_MARKER + inputName) != null)
String value = request.getParameter(name);
if (value == null && request.getParameter(SpringActionController.FIELD_MARKER + name) != null)
value = "0";
values.put(sampleProperty, value);
}
Expand Down
3 changes: 2 additions & 1 deletion api/src/org/labkey/api/reports/report/ScriptReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.labkey.api.data.BaseColumnInfo;
import org.labkey.api.data.BooleanFormat;
import org.labkey.api.data.ColumnHeaderType;
import org.labkey.api.data.ColumnInfo;
import org.labkey.api.data.CompareType;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerManager;
Expand Down Expand Up @@ -220,7 +221,7 @@ protected List<String> outputColumnNames(Results r)
ArrayList<String> ret = new ArrayList<>(count);
for (int col = 1; col <= count; col++)
{
String alias = r.getColumn(col).getPropertyName();
String alias = ColumnInfo.propNameFromName(r.getColumn(col).getName());
if (!aliases.add(alias))
{
int i;
Expand Down
8 changes: 4 additions & 4 deletions api/src/org/labkey/api/view/template/PageConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ public enum TrueFalse

private record EventHandler(String id, String selector, @NotNull String event, @NotNull String handler) {
public EventHandler {
assert (null==id) != (null==selector) : "exactly one of id or selector must be non-null";
assert !StringUtils.containsWhitespace(id) : "id should not contain any whitespace";
assert !StringUtils.containsWhitespace(event) : "event name should not contain any whitespace";
assert !event.startsWith("on") : "event name should not include the 'on' prefix";
assert (null==id) != (null==selector) : "exactly one of id or selector must be non-null '" + id + "', '" + selector + "'";
assert !StringUtils.containsWhitespace(id) : "id should not contain any whitespace. '" + id + "'";
assert !StringUtils.containsWhitespace(event) : "event name should not contain any whitespace. '" + event + "'";
assert !event.startsWith("on") : "event name should not include the 'on' prefix. '" + event + "'";
}

public String getKey()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ protected Object getValue(Map<String, Object> row, DomainProperty property)
private static final String PRIMARY_PREV_UPLOAD_PATH = "PreviouslyUploadedFilePaths";

@Override
public void addSampleColumns(InsertView view, User user, final AssayRunUploadForm defaultValueContext, final boolean errorReshow)
public void addSampleColumns(InsertView view, User user, final AssayRunUploadForm<?> defaultValueContext, final boolean errorReshow)
{
final File reshowFile;
if (errorReshow)
Expand Down
6 changes: 3 additions & 3 deletions assay/src/org/labkey/assay/AssayIntegrationTestCase.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@
);

// create a run
var run = assayImportFile(c, user, provider, assayProtocol, createAssayDataFile(fileContents), false, Map.of("runExpMaterialsLookup", runSample1.getName()));
var run = assayImportFile(c, user, provider, assayProtocol, createAssayDataFile(fileContents), false, Map.of("RunExpMaterialsLookup", runSample1.getName()));

// Verify pre-conditions
assertEquals(4, run.getMaterialInputs().size());
Expand All @@ -636,8 +636,8 @@
// Act
// Replace "RunExpMaterialsLookup" lookup runSample1 -> runSample2
var errors = new BatchValidationException();
var updatedRunRow = CaseInsensitiveHashMap.of("RowId", run.getRowId(), "RunExpMaterialsLookup", runSample2.getRowId());
runsTable.getUpdateService().updateRows(user, c, List.of((Map) updatedRunRow), null, errors, null, null);
Map<String, Object> updatedRunRow = CaseInsensitiveHashMap.of("RowId", run.getRowId(), "RunExpMaterialsLookup", runSample2.getRowId());
runsTable.getUpdateService().updateRows(user, c, List.of(updatedRunRow), null, errors, null, null);
if (errors.hasErrors())
throw errors;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ protected void decodePropertyValues(Map<String, Object> formDefaults, String pro
@Override
public void validateCommand(AssayDomainIdForm target, Errors errors)
{
if (ThawListResolverType.NAME.equals(target.getRequest().getParameter("participantVisitResolver")))
if (ThawListResolverType.NAME.equals(target.getRequest().getParameter("ParticipantVisitResolver")))
ThawListResolverType.validationHelper(target, errors);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void testIndexLatestAssayRun()
clickButton("Import Data");
clickButton("Next");
AssayImportPage importPage = new AssayImportPage(getDriver());
importPage.setNamedInputText("name", firstRun);
importPage.setNamedInputText("Name", firstRun);
importPage.setNamedTextAreaValue("TextAreaDataCollector.textArea", firstRunData);
importPage.clickSaveAndFinish();
SearchAdminAPIHelper.waitForIndexer();
Expand All @@ -91,7 +91,7 @@ public void testIndexLatestAssayRun()
clickButton("Re-import run");
clickButton("Next");
AssayImportPage importPage2 = new AssayImportPage(getDriver());
importPage2.setNamedInputText("name", secondRun);
importPage2.setNamedInputText("Name", secondRun);
importPage2.setNamedTextAreaValue("TextAreaDataCollector.textArea", secondRunData);
importPage2.clickSaveAndFinish();
SearchAdminAPIHelper.waitForIndexer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
DisplayColumnGroup group = groups.get(propEntry.getKey());
if (group != null && group.isCopyable())
{
String propName = group.getColumns().get(i).getColumnInfo().getPropertyName();
String propName = group.getColumns().get(i).getColumnInfo().getName();
String propValue = String.valueOf(propEntry.getValue());
handler.append("summarize_setProperty(" + q(propName) + "," + q(propValue) + ");\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.labkey.test.BaseWebDriverTest;
import org.labkey.test.Locator;
import org.labkey.test.TestFileUtils;
import org.labkey.test.components.assay.AssayConstants;
import org.labkey.test.pages.ReactAssayDesignerPage;
import org.labkey.test.params.FieldDefinition;
import org.labkey.test.params.experiment.SampleTypeDefinition;
Expand Down Expand Up @@ -82,9 +83,9 @@ protected void populateAssay(String assayName, String runName, String runData)
waitForElement(Locator.tagWithName("select", "targetStudy"));
clickAndWait(Locator.lkButton("Next"));

setFormElement(Locator.name("name"), runName);
click(Locator.xpath("//input[@value='textAreaDataProvider']"));
setFormElement(Locator.id("TextAreaDataCollector.textArea"), runData);
setFormElement(AssayConstants.ASSAY_NAME_FIELD_LOCATOR, runName);
click(AssayConstants.TEXT_AREA_DATA_PROVIDER_LOCATOR);
setFormElement(AssayConstants.TEXT_AREA_DATA_COLLECTOR_LOCATOR, runData);
clickAndWait(Locator.lkButton("Save and Finish"));
}

Expand Down
2 changes: 1 addition & 1 deletion list/src/org/labkey/list/model/ListQueryUpdateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ protected Map<String, Object> updateRow(User user, Container container, Map<Stri
// Remove prior attachment -- only includes columns which are modified in this update
for (ColumnInfo col : modifiedAttachmentColumns)
{
Object value = oldRow.get(col.getPropertyName());
Object value = oldRow.get(col.getName());
if (null != value)
{
AttachmentService.get().deleteAttachment(new ListItemAttachmentParent(entityId, _list.getContainer()), value.toString(), user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void renderInputHtml(RenderContext ctx, HtmlWriter out, Object value)
List<User> list = MothershipManager.get().getAssignedToList(_container);

new SelectBuilder()
.name(getColumnInfo().getPropertyName())
.name(getColumnInfo().getName())
.addOption("")
.addOptions(
list.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,15 @@ private void createAssays()

// Re-import the assay.
assayRunFile = TestFileUtils.getSampleData("/assay/" + ASSAY_NAME_PARENT +"_Reimport.tsv");
reImportAssayRun(null, ASSAY_NAME_PARENT, ASSAY_RUN_PARENT, Map.of("name", ASSAY_REIMPORT_RUN_PARENT), assayRunFile);
reImportAssayRun(null, ASSAY_NAME_PARENT, ASSAY_RUN_PARENT, Map.of("Name", ASSAY_REIMPORT_RUN_PARENT), assayRunFile);

assayFile = TestFileUtils.getSampleData("/assay/" + ASSAY_NAME_SUBFOLDER + ".xar.xml");
assayRunFile = TestFileUtils.getSampleData("/assay/" + ASSAY_NAME_SUBFOLDER + ".tsv");
createAssayAndPopulate(SUB_FOLDER_A, ASSAY_NAME_SUBFOLDER, assayFile, Map.of("name", ASSAY_RUN_SUBFOLDER), assayRunFile);
createAssayAndPopulate(SUB_FOLDER_A, ASSAY_NAME_SUBFOLDER, assayFile, Map.of("Name", ASSAY_RUN_SUBFOLDER), assayRunFile);

// Re-import the assay.
assayRunFile = TestFileUtils.getSampleData("/assay/" + ASSAY_NAME_SUBFOLDER +"_Reimport.tsv");
reImportAssayRun(SUB_FOLDER_A, ASSAY_NAME_SUBFOLDER, ASSAY_RUN_SUBFOLDER, Map.of("name", ASSAY_REIMPORT_RUN_SUBFOLDER), assayRunFile);
reImportAssayRun(SUB_FOLDER_A, ASSAY_NAME_SUBFOLDER, ASSAY_RUN_SUBFOLDER, Map.of("Name", ASSAY_REIMPORT_RUN_SUBFOLDER), assayRunFile);

}

Expand Down
6 changes: 3 additions & 3 deletions study/test/src/org/labkey/test/tests/search/SearchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ private void addSearchableIssues()
goToModule("Issues");
File file = TestFileUtils.getSampleData("fileTypes/tsv_sample.tsv");
issuesHelper.addIssue(ISSUE_TITLE, _userHelper.getDisplayNameForEmail(USER1),
Maps.of("type", "UFO",
"area", "Area51",
"priority", "1",
Maps.of("Type", "UFO",
"Area", "Area51",
"Priority", "1",
"comment", ISSUE_BODY),
file);

Expand Down
Loading