Skip to content
Open
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
13 changes: 12 additions & 1 deletion api/src/org/labkey/api/dataiterator/MapDataIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.collections.ArrayListMap;
import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.collections.CaseInsensitiveTreeSet;
Expand All @@ -43,7 +44,17 @@ public interface MapDataIterator extends DataIterator
Logger LOGGER = LogHelper.getLogger(MapDataIterator.class, "DataIterators backed by Maps");

boolean supportsGetMap();
Map<String,Object> getMap();
@Nullable Map<String,Object> getMap();
default @Nullable Map<String, Object> getMapExcludeExistingRecord()
{
Map<String, Object> row = getMap();
if (null == row)
return null;

Map<String, Object> rowClean = new CaseInsensitiveHashMap<>(row);
rowClean.remove(ExistingRecordDataIterator.EXISTING_RECORD_COLUMN_NAME);
return rowClean;
}

/**
* wrap an existing DataIterator to add MapDataIterator interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ public boolean next() throws BatchValidationException
{
boolean ret = super.next();
if (ret)
rows.add(((MapDataIterator)_delegate).getMap());
rows.add(((MapDataIterator)_delegate).getMapExcludeExistingRecord());
return ret;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ else if (nameObj instanceof Number)
}
}
else
rows.add(((MapDataIterator) _delegate).getMap());
rows.add(((MapDataIterator) _delegate).getMapExcludeExistingRecord());
}
return ret;
}
Expand Down
Loading