Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,10 @@ private DataIterator makeModulesDI()
.collect(Collectors.toCollection(ArrayList::new));
namesArrayList.add(CaseInsensitiveHashMap.of("name","NO_SUCH_MODULE"));

DataIterator di = new ListofMapsDataIterator(Set.of("Name"), namesArrayList);
assertFalse(di.supportsGetExistingRecord());
var context = new DataIteratorContext();
context.setInsertOption(QueryUpdateService.InsertOption.INSERT);
DataIterator di = MapDataIterator.of(Set.of("Name"), namesArrayList).getDataIterator(context);
assertFalse(di.supportsGetExistingRecord());
DataIterator existing = new ExistingDataIteratorsTableInfo(new CachingDataIterator(di), CoreSchema.getInstance().getTableInfoModules(), null, null, context, true);
assertTrue(existing.supportsGetExistingRecord());
return existing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ public static <K> DataIteratorBuilder createBuilder(DataIteratorBuilder dib, Tab

public static class TestCase extends Assert
{
private DataIterator make100Rows()
private DataIteratorBuilder make100Rows()
{
ArrayList<Map<String,Object>> maps = new ArrayList<>();
for (int i=0 ; i<100 ; i++)
maps.add(CaseInsensitiveHashMap.of("key",i));
return new ListofMapsDataIterator(Set.of("key"), maps);
return MapDataIterator.of(Set.of("key"), maps);
}

AtomicInteger valueGenerator = new AtomicInteger();
Expand Down
41 changes: 0 additions & 41 deletions api/src/org/labkey/api/dataiterator/ListofMapsDataIterator.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
<%@ page import="org.labkey.api.data.queryprofiler.QueryCounter" %>
<%@ page import="org.labkey.api.dataiterator.DataIteratorContext" %>
<%@ page import="org.labkey.api.dataiterator.DetailedAuditLogDataIterator" %>
<%@ page import="org.labkey.api.dataiterator.ListofMapsDataIterator" %>
<%@ page import="org.labkey.api.dataiterator.ValidatorIterator" %>
<%@ page import="org.labkey.api.data.validator.PrefetchingValidator" %>
<%@ page import="org.labkey.api.data.validator.PropertyValidator" %>
Expand Down Expand Up @@ -1671,7 +1670,7 @@ private Set<Integer> validateLookups(PropertyDescriptor field, List<Object> valu
List<Map<String, Object>> rows = values.stream().map(v -> (Map<String, Object>) CaseInsensitiveHashMap.of(field.getName(), v)).toList();
DataIteratorContext context = new DataIteratorContext();
context.setFailFast(false);
ValidatorIterator validate = new ValidatorIterator(new ListofMapsDataIterator(Set.of(field.getName()), rows), context, c, _user, Map.of(1, List.of(lookupValidator(field))));
ValidatorIterator validate = new ValidatorIterator(MapDataIterator.of(Set.of(field.getName()), rows).getDataIterator(context), context, c, _user, Map.of(1, List.of(lookupValidator(field))));
while (validate.next())
{
}
Expand Down
4 changes: 2 additions & 2 deletions experiment/src/org/labkey/experiment/api/LineageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.labkey.api.data.TableInfo;
import org.labkey.api.data.TableSelector;
import org.labkey.api.dataiterator.DataIteratorContext;
import org.labkey.api.dataiterator.ListofMapsDataIterator;
import org.labkey.api.dataiterator.MapDataIterator;
import org.labkey.api.exp.Identifiable;
import org.labkey.api.exp.Lsid;
import org.labkey.api.exp.LsidManager;
Expand Down Expand Up @@ -496,7 +496,7 @@ public void testListAndSampleLineage() throws Exception
context.setAllowImportLookupByAlternateKey(true);

errors = new BatchValidationException();
listQus.loadRows(user, c, new ListofMapsDataIterator.Builder(Set.of("SampleId"), rows), context, null);
listQus.loadRows(user, c, MapDataIterator.of(Set.of("SampleId"), rows), context, null);
if (errors.hasErrors())
throw errors;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public int loadRows(User user, Container container, DataIteratorBuilder rows, Da
// Issue 46639: "SampleId" column header not recognized when loading samples from pipeline trigger
try
{
if (rows instanceof DataLoader dataLoader) // junit test uses ListofMapsDataIterator
if (rows instanceof DataLoader dataLoader) // Non-file sources (in-memory rows, query results) skip this header handling
{
if (!context.isCrossTypeImport() && dataLoader.getColumnInfoMap().isEmpty())
dataLoader.setKnownColumns(getQueryTable().getColumns());
Expand Down Expand Up @@ -526,7 +526,7 @@ public List<Map<String, Object>> insertRows(User user, Container container, List
}

DbScope scope = getSchema().getDbSchema().getScope();
List<Map<String, Object>> results = scope.executeWithRetry(transaction ->
List<Map<String, Object>> results = scope.executeWithRetry(_ ->
super._insertRowsUsingDIB(user, container, rows, getDataIteratorContext(errors, insertOption, configParameters), extraScriptContext));

if (results != null && !results.isEmpty() && !errors.hasErrors())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
import org.labkey.api.data.dialect.SqlDialect;
import org.labkey.api.dataiterator.DataIteratorBuilder;
import org.labkey.api.dataiterator.DataIteratorContext;
import org.labkey.api.dataiterator.ListofMapsDataIterator;
import org.labkey.api.dataiterator.MapDataIterator;
import org.labkey.api.dataiterator.Pump;
import org.labkey.api.dataiterator.SimpleTranslator;
import org.labkey.api.dataiterator.StatementDataIterator;
Expand Down Expand Up @@ -1086,8 +1086,6 @@ private void ensureUniqueIdValues(List<DomainProperty> propsAdded) throws SQLExc
uniqueIndexCols.forEach(col ->
colNames.add(col.getName()));
uniqueIdProps.forEach(prop -> colNames.add(prop.getName()));
ListofMapsDataIterator mapsDi = new ListofMapsDataIterator(colNames, rows);
mapsDi.setDebugName(table.getName() + ".ensureUniqueIds");
SQLFragment sql = new SQLFragment().unsafeAppend("UPDATE ").append(table).unsafeAppend(" SET ");
String separator = "";
for (DomainProperty prop: uniqueIdProps)
Expand All @@ -1108,7 +1106,7 @@ private void ensureUniqueIdValues(List<DomainProperty> propsAdded) throws SQLExc
try
{
ParameterMapStatement stmt1 = new ParameterMapStatement(scope, sql, null);
return new StatementDataIterator(dialect, mapsDi, ctx, stmt1);
return new StatementDataIterator(dialect, MapDataIterator.of(colNames, rows, table.getName() + ".ensureUniqueIds").getDataIterator(context), context, stmt1);
}
catch (SQLException x)
{
Expand Down
4 changes: 2 additions & 2 deletions query/src/org/labkey/query/controllers/QueryController.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
import org.labkey.api.dataiterator.DataIteratorBuilder;
import org.labkey.api.dataiterator.DataIteratorContext;
import org.labkey.api.dataiterator.DetailedAuditLogDataIterator;
import org.labkey.api.dataiterator.ListofMapsDataIterator;
import org.labkey.api.dataiterator.MapDataIterator;
import org.labkey.api.exceptions.OptimisticConflictException;
import org.labkey.api.exp.ExperimentException;
import org.labkey.api.exp.api.ProvenanceRecordingParams;
Expand Down Expand Up @@ -4543,7 +4543,7 @@ public List<Map<String, Object>> saveRows(QueryUpdateService qus, List<Map<Strin
throws SQLException, BatchValidationException
{
BatchValidationException errors = new BatchValidationException();
DataIteratorBuilder it = new ListofMapsDataIterator.Builder(rows.getFirst().keySet(), rows);
DataIteratorBuilder it = MapDataIterator.of(rows.getFirst().keySet(), rows);
qus.importRows(user, container, it, errors, configParameters, extraContext);
if (errors.hasErrors())
throw errors;
Expand Down
4 changes: 2 additions & 2 deletions study/src/org/labkey/study/model/DatasetImportTestCase.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<%@ page import="org.labkey.api.data.TableInfo" %>
<%@ page import="org.labkey.api.data.TableSelector" %>
<%@ page import="org.labkey.api.dataiterator.DetailedAuditLogDataIterator" %>
<%@ page import="org.labkey.api.dataiterator.ListofMapsDataIterator" %>
<%@ page import="org.labkey.api.dataiterator.MapDataIterator" %>
<%@ page import="org.labkey.api.exp.Lsid" %>
<%@ page import="org.labkey.api.exp.OntologyManager" %>
<%@ page import="org.labkey.api.exp.PropertyType" %>
Expand Down Expand Up @@ -506,7 +506,7 @@ private void _testDatasetDetailedLogging(StudyImpl study) throws Throwable
// and since merge is a different code path...
rows.clear(); errors.clear();
rows.add(PageFlowUtil.mapInsensitive("SubjectId", "A1", "Date", Jan1, "Measure", "Merged", "Value", 3.0));
int count = qus.mergeRows(_context.getUser(), study.getContainer(), new ListofMapsDataIterator(null, rows), errors, config, null);
int count = qus.mergeRows(_context.getUser(), study.getContainer(), MapDataIterator.of(rows), errors, config, null);
assertEquals(1, count);

events = AuditLogService.get().getAuditEvents(study.getContainer(),_context.getUser(),DATASET_AUDIT_EVENT,f,new Sort("-RowId"));
Expand Down
Loading