2424import org .labkey .api .assay .AssayProvider ;
2525import org .labkey .api .assay .AssayService ;
2626import org .labkey .api .collections .CaseInsensitiveHashMap ;
27+ import org .labkey .api .collections .IntHashMap ;
28+ import org .labkey .api .collections .IntHashSet ;
2729import org .labkey .api .data .ColumnInfo ;
2830import org .labkey .api .data .CompareType ;
2931import org .labkey .api .data .Container ;
@@ -88,11 +90,11 @@ public static GenotypeAssaysManager get()
8890 }
8991
9092
91- public Pair <List <Integer >, List <Integer >> cacheAnalyses (final ViewContext ctx , final ExpProtocol protocol , String [] pks ) throws IllegalArgumentException
93+ public Pair <List <Long >, List <Long >> cacheAnalyses (final ViewContext ctx , final ExpProtocol protocol , String [] pks ) throws IllegalArgumentException
9294 {
9395 final User u = ctx .getUser ();
94- final List <Integer > runsCreated = new ArrayList <>();
95- final List <Integer > runsDeleted = new ArrayList <>();
96+ final List <Long > runsCreated = new ArrayList <>();
97+ final List <Long > runsDeleted = new ArrayList <>();
9698
9799 try (DbScope .Transaction transaction = DbScope .getLabKeyScope ().ensureTransaction ())
98100 {
@@ -118,8 +120,8 @@ public Pair<List<Integer>, List<Integer>> cacheAnalyses(final ViewContext ctx, f
118120 AssayProtocolSchema schema = ap .createProtocolSchema (u , ctx .getContainer (), protocol , null );
119121 final TableInfo assayDataTable = schema .getTable (AssayProtocolSchema .DATA_TABLE_NAME );
120122
121- final Map <Integer , List <Map <String , Object >>> rowHash = new HashMap <>();
122- final Map <Integer , Set <Integer >> toDeleteByAnalysis = new HashMap <>();
123+ final Map <Integer , List <Map <String , Object >>> rowHash = new IntHashMap <>();
124+ final Map <Integer , Set <Integer >> toDeleteByAnalysis = new IntHashMap <>();
123125
124126 TableSelector tsAlignments = new TableSelector (tableAlignments , cols .values (), new SimpleFilter (FieldKey .fromString ("key" ), Arrays .asList (pks ), CompareType .IN ), null );
125127 tsAlignments .forEach (new Selector .ForEachBlock <ResultSet >()
@@ -139,7 +141,7 @@ public void exec(ResultSet object) throws SQLException
139141 filter .addCondition (FieldKey .fromString ("Run/assayType" ), SBT_LINEAGE_ASSAY_TYPE );
140142
141143 TableSelector ts = new TableSelector (assayDataTable , PageFlowUtil .set ("RowId" ), filter , null );
142- Set <Integer > existing = new HashSet <> (ts .getArrayList (Integer .class ));
144+ Set <Integer > existing = new IntHashSet (ts .getArrayList (Integer .class ));
143145 if (!existing .isEmpty ())
144146 {
145147 Set <Integer > toDelete = toDeleteByAnalysis .containsKey (analysisId ) ? toDeleteByAnalysis .get (analysisId ) : new HashSet <Integer >();
@@ -178,11 +180,11 @@ public void exec(ResultSet object) throws SQLException
178180 }
179181 }
180182
181- public Pair <List <Integer >, List <Integer >> cacheHaplotypes (final ViewContext ctx , final ExpProtocol protocol , JSONArray data ) throws IllegalArgumentException
183+ public Pair <List <Long >, List <Long >> cacheHaplotypes (final ViewContext ctx , final ExpProtocol protocol , JSONArray data ) throws IllegalArgumentException
182184 {
183185 final User u = ctx .getUser ();
184- final List <Integer > runsCreated = new ArrayList <>();
185- final List <Integer > runsDeleted = new ArrayList <>();
186+ final List <Long > runsCreated = new ArrayList <>();
187+ final List <Long > runsDeleted = new ArrayList <>();
186188
187189 //next identify a build up the results
188190 TableInfo tableAnalyses = QueryService .get ().getUserSchema (u , ctx .getContainer (), SEQUENCEANALYSIS_SCHEMA ).getTable ("sequence_analyses" );
@@ -196,8 +198,8 @@ public Pair<List<Integer>, List<Integer>> cacheHaplotypes(final ViewContext ctx,
196198 fieldKeys .add (FieldKey .fromString ("readset/subjectid" ));
197199 fieldKeys .add (FieldKey .fromString ("readset/sampledate" ));
198200
199- Set <Integer > analysisIds = new HashSet <> ();
200- final Map <Integer , List <JSONObject >> haploMap = new HashMap <>();
201+ Set <Integer > analysisIds = new IntHashSet ();
202+ final Map <Integer , List <JSONObject >> haploMap = new IntHashMap <>();
201203 for (JSONObject row : JsonUtil .toJSONObjectList (data ))
202204 {
203205 Integer analysisId = row .getInt ("analysisId" );
@@ -217,8 +219,8 @@ public Pair<List<Integer>, List<Integer>> cacheHaplotypes(final ViewContext ctx,
217219 AssayProtocolSchema schema = ap .createProtocolSchema (u , ctx .getContainer (), protocol , null );
218220 final TableInfo assayDataTable = schema .getTable (AssayProtocolSchema .DATA_TABLE_NAME );
219221
220- final Map <Integer , List <Map <String , Object >>> rowHash = new HashMap <>();
221- final Map <Integer , Set <Integer >> toDeleteByAnalysis = new HashMap <>();
222+ final Map <Integer , List <Map <String , Object >>> rowHash = new IntHashMap <>();
223+ final Map <Integer , Set <Integer >> toDeleteByAnalysis = new IntHashMap <>();
222224
223225 TableSelector tsAlignments = new TableSelector (tableAnalyses , cols .values (), new SimpleFilter (FieldKey .fromString ("rowid" ), analysisIds , CompareType .IN ), null );
224226 tsAlignments .forEach (new Selector .ForEachBlock <ResultSet >()
@@ -244,10 +246,10 @@ public void exec(ResultSet object) throws SQLException
244246 filter .addCondition (FieldKey .fromString ("Run/assayType" ), HAPLOTYPE_ASSAY_TYPE );
245247
246248 TableSelector ts = new TableSelector (assayDataTable , PageFlowUtil .set ("RowId" ), filter , null );
247- Set <Integer > existing = new HashSet <> (ts .getArrayList (Integer .class ));
249+ Set <Integer > existing = new IntHashSet (ts .getArrayList (Integer .class ));
248250 if (!existing .isEmpty ())
249251 {
250- Set <Integer > toDelete = toDeleteByAnalysis .containsKey (analysisId ) ? toDeleteByAnalysis .get (analysisId ) : new HashSet <> ();
252+ Set <Integer > toDelete = toDeleteByAnalysis .containsKey (analysisId ) ? toDeleteByAnalysis .get (analysisId ) : new IntHashSet ();
251253 toDelete .addAll (existing );
252254 toDeleteByAnalysis .put (analysisId , toDelete );
253255 }
@@ -288,7 +290,7 @@ public void exec(ResultSet object) throws SQLException
288290 return Pair .of (runsCreated , runsDeleted );
289291 }
290292
291- private void processSet (String assayType , Map <Integer , List <Map <String , Object >>> rowHash , TableInfo assayDataTable , User u , ViewContext ctx , Map <Integer , Set <Integer >> toDeleteByAnalysis , AssayProvider ap , ExpProtocol protocol , List <Integer > runsCreated )
293+ private void processSet (String assayType , Map <Integer , List <Map <String , Object >>> rowHash , TableInfo assayDataTable , User u , ViewContext ctx , Map <Integer , Set <Integer >> toDeleteByAnalysis , AssayProvider ap , ExpProtocol protocol , List <Long > runsCreated )
292294 {
293295 for (Integer analysisId : rowHash .keySet ())
294296 {
0 commit comments