@@ -173,7 +173,8 @@ private void importReadsets() throws PipelineJobException
173173 SequenceReadsetImpl r = (SequenceReadsetImpl )rs ;
174174 getJob ().getLogger ().info ("Starting readset " + r .getName ());
175175
176- List <ReadDataImpl > preexistingReadData = ((SequenceReadsetImpl )SequenceAnalysisService .get ().getReadset (r .getReadsetId (), getJob ().getUser ())).getReadDataImpl ();
176+ boolean readsetExists = r .getReadsetId () != null && r .getReadsetId () > 0 ;
177+ List <ReadDataImpl > preexistingReadData = readsetExists ? ((SequenceReadsetImpl )SequenceAnalysisService .get ().getReadset (r .getReadsetId (), getJob ().getUser ())).getReadDataImpl () : Collections .emptyList ();
177178 boolean readsetExistsWithData = !preexistingReadData .isEmpty ();
178179 if (readsetExistsWithData )
179180 {
@@ -183,8 +184,7 @@ private void importReadsets() throws PipelineJobException
183184 }
184185
185186 SequenceReadsetImpl row ;
186- boolean readsetWillBeCreated = true ;
187- if (!readsetExistsWithData )
187+ if (!readsetExists )
188188 {
189189 row = new SequenceReadsetImpl ();
190190
@@ -235,10 +235,7 @@ private void importReadsets() throws PipelineJobException
235235 row .setCreated (new Date ());
236236 row .setModifiedBy (getJob ().getUser ().getUserId ());
237237 row .setModified (new Date ());
238- }
239- else
240- {
241- readsetWillBeCreated = false ;
238+ readsetExists = false ;
242239 }
243240 }
244241
@@ -361,7 +358,7 @@ private void importReadsets() throws PipelineJobException
361358 row .setReadData (readDatasToCreate );
362359
363360 SequenceReadsetImpl newRow ;
364- if (readsetWillBeCreated )
361+ if (! readsetExists )
365362 {
366363 newRow = Table .insert (getJob ().getUser (), readsetTable , row );
367364 getJob ().getLogger ().info ("Created readset: " + newRow .getReadsetId ());
0 commit comments