Skip to content

Commit 8d7c9f2

Browse files
checkpoint - migrate to using long/Long to represent any integer ID value (rowId, objectId, etc). (#173)
1 parent 5c94ae5 commit 8d7c9f2

File tree

8 files changed

+39
-34
lines changed

8 files changed

+39
-34
lines changed

genotyping/src/org/labkey/genotyping/GenotypingAnalysis.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
public class GenotypingAnalysis
3232
{
33-
private int _rowId;
33+
private long _rowId;
3434
private Container _container;
3535
private int _run;
3636
private int _createdBy;
@@ -57,12 +57,12 @@ public GenotypingAnalysis(Container c, User user, GenotypingRun run, @Nullable S
5757
setSequencesView(sequencesView);
5858
}
5959

60-
public int getRowId()
60+
public long getRowId()
6161
{
6262
return _rowId;
6363
}
6464

65-
public void setRowId(int rowId)
65+
public void setRowId(long rowId)
6666
{
6767
_rowId = rowId;
6868
}

genotyping/src/org/labkey/genotyping/GenotypingController.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public PageConfig defaultPageConfig()
172172
}
173173

174174

175-
public static ActionURL getAnalysisURL(Container c, int analysisId)
175+
public static ActionURL getAnalysisURL(Container c, long analysisId)
176176
{
177177
ActionURL url = new ActionURL(AnalysisAction.class, c);
178178
url.addParameter("analysis", analysisId);
@@ -182,17 +182,17 @@ public static ActionURL getAnalysisURL(Container c, int analysisId)
182182

183183
public static class AnalysisForm extends QueryExportForm
184184
{
185-
private Integer _analysis = null;
185+
private Long _analysis = null;
186186
private Integer _highlightId = null;
187187
private String _error = null;
188188

189-
public Integer getAnalysis()
189+
public Long getAnalysis()
190190
{
191191
return _analysis;
192192
}
193193

194194
@SuppressWarnings({"UnusedDeclaration"})
195-
public void setAnalysis(Integer analysis)
195+
public void setAnalysis(Long analysis)
196196
{
197197
_analysis = analysis;
198198
}
@@ -1423,7 +1423,7 @@ public URLHelper getSuccessURL(PipelinePathForm pipelinePathForm)
14231423
}
14241424

14251425

1426-
private void importAnalysis(int analysisId, FileLike pipelineDir, User user) throws IOException, PipelineValidationException
1426+
private void importAnalysis(long analysisId, FileLike pipelineDir, User user) throws IOException, PipelineValidationException
14271427
{
14281428
GenotypingAnalysis analysis = GenotypingManager.get().getAnalysis(getContainer(), analysisId);
14291429
FileLike analysisDir = new FileSystemLike.Builder(Paths.get(analysis.getPath())).readwrite().root();
@@ -1916,9 +1916,9 @@ public void validateCommand(Object target, Errors errors)
19161916
public boolean handlePost(Object o, BindException errors)
19171917
{
19181918
GenotypingManager gm = GenotypingManager.get();
1919-
Set<Integer> runs = DataRegionSelection.getSelectedIntegers(getViewContext(), true);
1919+
Set<Long> runs = DataRegionSelection.getSelectedIntegers(getViewContext(), true);
19201920

1921-
for (Integer runId : runs)
1921+
for (Long runId : runs)
19221922
{
19231923
GenotypingRun run = gm.getRun(getContainer(), runId);
19241924
gm.deleteRun(run);
@@ -1948,7 +1948,7 @@ public boolean handlePost(Object o, BindException errors) throws Exception
19481948
{
19491949
GenotypingManager gm = GenotypingManager.get();
19501950

1951-
for (Integer analysisId : DataRegionSelection.getSelectedIntegers(getViewContext(), true))
1951+
for (Long analysisId : DataRegionSelection.getSelectedIntegers(getViewContext(), true))
19521952
{
19531953
GenotypingAnalysis analysis = gm.getAnalysis(getContainer(), analysisId);
19541954
gm.deleteAnalysis(analysis);
@@ -1968,7 +1968,7 @@ public ActionURL getSuccessURL(Object o)
19681968
public static class MatchReadsForm extends RunForm
19691969
{
19701970
private int _match = 0;
1971-
private int _analysis = 0;
1971+
private long _analysis = 0;
19721972

19731973
public int getMatch()
19741974
{
@@ -1981,13 +1981,13 @@ public void setMatch(int run)
19811981
_match = run;
19821982
}
19831983

1984-
public int getAnalysis()
1984+
public long getAnalysis()
19851985
{
19861986
return _analysis;
19871987
}
19881988

19891989
@SuppressWarnings({"UnusedDeclaration"})
1990-
public void setAnalysis(int analysis)
1990+
public void setAnalysis(long analysis)
19911991
{
19921992
_analysis = analysis;
19931993
}
@@ -2038,18 +2038,18 @@ protected void handleSettings(QuerySettings settings)
20382038

20392039
public static class AssignmentReportBean
20402040
{
2041-
private final Collection<Integer> _ids;
2041+
private final Collection<Long> _ids;
20422042
private final String _assayName;
20432043
private final ActionURL _returnUrl;
20442044

2045-
public AssignmentReportBean(Collection<Integer> ids, String assayName, ActionURL returnUrl)
2045+
public AssignmentReportBean(Collection<Long> ids, String assayName, ActionURL returnUrl)
20462046
{
20472047
_ids = ids;
20482048
_assayName = assayName;
20492049
_returnUrl = returnUrl;
20502050
}
20512051

2052-
public Collection<Integer> getIds()
2052+
public Collection<Long> getIds()
20532053
{
20542054
return _ids;
20552055
}
@@ -2076,7 +2076,7 @@ public ModelAndView getView(ProtocolIdForm form, BindException errors)
20762076
_protocol = form.getProtocol();
20772077

20782078
// when coming from the results grid, we use the selected rows as the initial set of IDs for the report form
2079-
Set<Integer> selected = DataRegionSelection.getSelectedIntegers(getViewContext(), false);
2079+
Set<Long> selected = DataRegionSelection.getSelectedIntegers(getViewContext(), false);
20802080

20812081
VBox result = new VBox();
20822082
AssayHeaderView header = new AssayHeaderView(form.getProtocol(), form.getProvider(), false, true, null);

genotyping/src/org/labkey/genotyping/GenotypingManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public GenotypingRun createRun(Container c, User user, Integer metaDataId, FileL
134134
return Table.insert(user, GenotypingSchema.get().getRunsTable(), run);
135135
}
136136

137-
public @Nullable GenotypingRun getRun(Container c, int runId)
137+
public @Nullable GenotypingRun getRun(Container c, long runId)
138138
{
139139
return new TableSelector(GenotypingSchema.get().getRunsTable()).getObject(c, runId, GenotypingRun.class);
140140
}
@@ -156,7 +156,7 @@ public GenotypingAnalysis createAnalysis(Container c, User user, GenotypingRun r
156156
return Table.insert(user, GenotypingSchema.get().getAnalysesTable(), new GenotypingAnalysis(c, user, run, description, sequencesViewName));
157157
}
158158

159-
public @NotNull GenotypingAnalysis getAnalysis(Container c, Integer analysisId)
159+
public @NotNull GenotypingAnalysis getAnalysis(Container c, Long analysisId)
160160
{
161161
if (null == analysisId)
162162
throw new NotFoundException("Analysis parameter is missing");
@@ -437,7 +437,7 @@ public int insertMatch(User user, GenotypingAnalysis analysis, int sampleId, Res
437437
return matchId;
438438
}
439439

440-
public int deleteMatches(Container c, User user, int analysisId, List<Integer> matchIds)
440+
public int deleteMatches(Container c, User user, long analysisId, List<Integer> matchIds)
441441
{
442442
// Validate analysis was posted and exists in this container
443443
GenotypingAnalysis analysis = GenotypingManager.get().getAnalysis(c, analysisId);

genotyping/src/org/labkey/genotyping/GenotypingQuerySchema.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public class GenotypingQuerySchema extends UserSchema
8585

8686
private SortedMap<Integer, Map<String, String>> _allHaplotypes;
8787

88-
@Nullable private final Integer _analysisId;
88+
@Nullable private final Long _analysisId;
8989

9090
public enum TableType
9191
{
@@ -289,7 +289,7 @@ FilteredTable createTable(GenotypingQuerySchema schema, ContainerFilter cf)
289289
}
290290

291291
@Override
292-
public FilteredTable createTable(final GenotypingQuerySchema schema, ContainerFilter cf, @Nullable final Integer analysisId)
292+
public FilteredTable createTable(final GenotypingQuerySchema schema, ContainerFilter cf, @Nullable final Long analysisId)
293293
{
294294
FilteredTable table = new FilteredTable<>(GS.getMatchesTable(), schema, cf);
295295
//TODO: filter on container??
@@ -686,7 +686,7 @@ boolean isAvailable(GenotypingQuerySchema schema)
686686
}
687687

688688
// Special factory method for Matches table, to pass through analysis id (if present)
689-
FilteredTable createTable(GenotypingQuerySchema schema, ContainerFilter cf, @Nullable Integer analysisId)
689+
FilteredTable createTable(GenotypingQuerySchema schema, ContainerFilter cf, @Nullable Long analysisId)
690690
{
691691
return createTable(schema, cf);
692692
}
@@ -887,7 +887,7 @@ public GenotypingQuerySchema(User user, Container container)
887887
this(user, container, null);
888888
}
889889

890-
public GenotypingQuerySchema(User user, Container container, @Nullable Integer analysisId)
890+
public GenotypingQuerySchema(User user, Container container, @Nullable Long analysisId)
891891
{
892892
super(NAME, "Contains genotyping data", user, container, GS.getSchema());
893893
_analysisId = analysisId;
@@ -899,7 +899,7 @@ public TableInfo createTable(String name, ContainerFilter cf)
899899
// Special handling for Matches -- need to pass in Analysis
900900
if (name.startsWith(TableType.Matches.name()))
901901
{
902-
Integer analysisId = _analysisId;
902+
Long analysisId = _analysisId;
903903

904904
if (null == analysisId)
905905
{
@@ -909,7 +909,7 @@ public TableInfo createTable(String name, ContainerFilter cf)
909909
{
910910
if (split.length == 2 && TableType.Matches.name().equals(split[0]))
911911
{
912-
analysisId = Integer.parseInt(split[1]);
912+
analysisId = Long.parseLong(split[1]);
913913
}
914914
else
915915
{

genotyping/src/org/labkey/genotyping/HaplotypeDataHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.junit.Test;
2222
import org.labkey.api.collections.CaseInsensitiveHashMap;
2323
import org.labkey.api.collections.CaseInsensitiveTreeMap;
24+
import org.labkey.api.collections.IntHashMap;
2425
import org.labkey.api.data.Container;
2526
import org.labkey.api.data.SQLFragment;
2627
import org.labkey.api.data.SimpleFilter;
@@ -356,7 +357,7 @@ private Map<Integer, Integer> insertAnimalAnalysis(ExpRun run, List<HaplotypeAss
356357
throwFirstError(errors);
357358

358359
// return a mapping from the AnimalId to the AnimalAnalysis RowId
359-
Map<Integer, Integer> map = new HashMap<>();
360+
Map<Integer, Integer> map = new IntHashMap<>();
360361
for (Map<String, Object> insertedRow : insertedRows)
361362
{
362363
map.put(Integer.parseInt(insertedRow.get("animalid").toString()), Integer.parseInt(insertedRow.get("RowId").toString()));
@@ -476,7 +477,7 @@ public Priority getPriority(ExpData data)
476477
}
477478

478479
@Override
479-
public void runMoved(ExpData newData, Container container, Container targetContainer, String oldRunLSID, String newRunLSID, User user, int oldDataRowID)
480+
public void runMoved(ExpData newData, Container container, Container targetContainer, String oldRunLSID, String newRunLSID, User user, long oldDataRowID)
480481
{
481482
throw new UnsupportedOperationException();
482483
}

genotyping/src/org/labkey/genotyping/IlluminaFastqParser.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.junit.Before;
2828
import org.junit.BeforeClass;
2929
import org.junit.Test;
30+
import org.labkey.api.collections.IntHashMap;
3031
import org.labkey.api.data.Container;
3132
import org.labkey.api.data.ContainerManager;
3233
import org.labkey.api.files.FileContentService;
@@ -506,9 +507,9 @@ public void testHeaders() throws PipelineJobException, IOException
506507
int i = 0;
507508
int numOfPairs = pairs.length;
508509
Set<Pair<Integer, Integer>> expectedOutputs = new HashSet<>();
509-
Map<Integer, Integer> sampleIndexToIdMap = new HashMap<>();
510+
Map<Integer, Integer> sampleIndexToIdMap = new IntHashMap<>();
510511
sampleIndexToIdMap.put(0, 0);
511-
Map<Integer, Integer> sampleIdToIndexMap = new HashMap<>();
512+
Map<Integer, Integer> sampleIdToIndexMap = new IntHashMap<>();
512513
sampleIdToIndexMap.put(0, 0);
513514
List<File> oldHeaderFiles = new ArrayList<>();
514515
List<File> newHeaderFiles = new ArrayList<>();

genotyping/src/org/labkey/genotyping/ImportIlluminaReadsJob.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.apache.commons.lang3.StringUtils;
2222
import org.jetbrains.annotations.Nullable;
2323
import org.labkey.api.collections.CaseInsensitiveHashMap;
24+
import org.labkey.api.collections.IntHashMap;
2425
import org.labkey.api.data.DbScope;
2526
import org.labkey.api.data.Table;
2627
import org.labkey.api.data.TableInfo;
@@ -137,9 +138,9 @@ private void importReads() throws PipelineJobException, SQLException
137138
//parse the samples file
138139
String[] nextLine;
139140
/* Index is the number of the sample as ordered in SampleType CSV, mapped to the unique RowId for each sample */
140-
Map<Integer, Integer> sampleIndexToIdMap = new HashMap<>();
141+
Map<Integer, Integer> sampleIndexToIdMap = new IntHashMap<>();
141142
/* Unique RowId for each sample mapped to the index is the number of the sample as ordered in SampleType CSV */
142-
Map<Integer, Integer> sampleIdToIndexMap = new HashMap<>();
143+
Map<Integer, Integer> sampleIdToIndexMap = new IntHashMap<>();
143144
/* Name for each sample, mapped to the RowId of the sample */
144145
Map<String, Integer> sampleNameToIdMap = new HashMap<>();
145146
sampleIndexToIdMap.put(0, 0); //placeholder for control and unmapped reads

genotyping/src/org/labkey/genotyping/Status.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.labkey.genotyping;
1717

18+
import org.labkey.api.collections.IntHashMap;
19+
1820
import java.util.HashMap;
1921
import java.util.Map;
2022

@@ -27,7 +29,7 @@ public enum Status
2729
{
2830
NotSubmitted(0), Submitted(1), Importing(2), Complete(3);
2931

30-
private static final Map<Integer, Status> _map = new HashMap<>();
32+
private static final Map<Integer, Status> _map = new IntHashMap<>();
3133

3234
static
3335
{

0 commit comments

Comments
 (0)