22
33import com .fasterxml .jackson .databind .ObjectMapper ;
44import io .nats .client .Message ;
5- import java .nio .charset .StandardCharsets ;
65import java .util .concurrent .BlockingQueue ;
76import java .util .concurrent .CountDownLatch ;
87import java .util .concurrent .ExecutorService ;
98import java .util .concurrent .Executors ;
109import java .util .concurrent .LinkedBlockingQueue ;
1110import java .util .concurrent .Phaser ;
1211import java .util .concurrent .TimeUnit ;
12+ import org .apache .commons .lang3 .StringUtils ;
1313import org .apache .commons .logging .Log ;
1414import org .apache .commons .logging .LogFactory ;
1515import org .mskcc .cmo .messaging .Gateway ;
@@ -244,15 +244,15 @@ public void onMessage(Message msg, Object message) {
244244 DmpSampleMetadata dmpSample = mapper .readValue (clinicalSampleJson ,
245245 DmpSampleMetadata .class );
246246
247- PatientIdTriplet mappedPatientTriplet
247+ PatientIdTriplet triplet
248248 = patientIdMappingService .getPatientIdTripletByInputId (
249249 dmpSample .getDmpPatientId ());
250- if (mappedPatientTriplet == null ) {
250+ if (triplet == null || StringUtils . isBlank ( triplet . getCmoPatientId ()) ) {
251251 LOG .error ("Could not resolve cmoPatientId from dmpId: "
252252 + dmpSample .getDmpPatientId ());
253253 return ;
254254 }
255- String cmoPatientId = mappedPatientTriplet .getCmoPatientId ();
255+ String cmoPatientId = triplet .getCmoPatientId ();
256256 SmileSample sample = SampleDataFactory .buildNewClinicalSampleFromMetadata (
257257 cmoPatientId , dmpSample );
258258 clinicalMessageHandlingService .newClinicalSampleHandler (sample );
@@ -275,15 +275,15 @@ public void onMessage(Message msg, Object message) {
275275 DmpSampleMetadata dmpSample = mapper .readValue (clinicalSampleJson ,
276276 DmpSampleMetadata .class );
277277
278- PatientIdTriplet mappedPatientTriplet
278+ PatientIdTriplet triplet
279279 = patientIdMappingService .getPatientIdTripletByInputId (
280280 dmpSample .getDmpPatientId ());
281- if (mappedPatientTriplet == null ) {
281+ if (triplet == null || StringUtils . isBlank ( triplet . getCmoPatientId ()) ) {
282282 LOG .error ("Could not resolve cmoPatientId from dmpId: "
283283 + dmpSample .getDmpPatientId ());
284284 return ;
285285 }
286- String cmoPatientId = mappedPatientTriplet .getCmoPatientId ();
286+ String cmoPatientId = triplet .getCmoPatientId ();
287287 SmileSample sample = SampleDataFactory .buildNewClinicalSampleFromMetadata (
288288 cmoPatientId , dmpSample );
289289 clinicalMessageHandlingService .clinicalSampleUpdateHandler (sample );
0 commit comments