Changeset 2103


Ignore:
Timestamp:
Oct 25, 2013, 8:36:36 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #471: Add library preparation information to the 'Case summary' feature

Fixes issue with items having no bioplate location. Eg. *.dil items never have a location.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/CaseSummaryServlet.java

    r2101 r2103  
    2424import net.sf.basedb.core.File;
    2525import net.sf.basedb.core.ItemQuery;
     26import net.sf.basedb.core.MeasuredBioMaterial;
    2627import net.sf.basedb.core.Permission;
    2728import net.sf.basedb.core.Sample;
     
    648649    mrna.setAnnotation("comment", e.getDescription());
    649650   
    650     // Get BioPlate CleanupDate annotation
    651     BioPlate plate = mrna.getItem().getBioWell().getPlate();
    652     Date cleanupDate = (Date) Annotationtype.CLEANUP_DATE.getAnnotationValue(dc, plate);
    653     mrna.setAnnotation("cleanupDate", Reggie.CONVERTER_DATE_TO_STRING.convert(cleanupDate));
    654     // Get BioPlate PlateProcessResult annotation
    655     String result = (String) Annotationtype.PLATE_PROCESS_RESULT.getAnnotationValue(dc, plate);
    656     mrna.setAnnotation("result", result);
     651    // Get BioPlate annotations
     652    BioPlate plate = getBioPlate(e);
     653    if (plate != null)
     654    {
     655      Date cleanupDate = (Date) Annotationtype.CLEANUP_DATE.getAnnotationValue(dc, plate);
     656      mrna.setAnnotation("cleanupDate", Reggie.CONVERTER_DATE_TO_STRING.convert(cleanupDate));
     657      // Get BioPlate PlateProcessResult annotation
     658      String result = (String) Annotationtype.PLATE_PROCESS_RESULT.getAnnotationValue(dc, plate);
     659      mrna.setAnnotation("result", result);
     660    }
    657661  }
    658662
     
    665669    cdna.setAnnotation("editable", e.hasPermission(Permission.WRITE)); 
    666670    cdna.setAnnotation("comment", e.getDescription());
    667     // Get BioPlate SynthesisDate annotation
    668     BioPlate plate = cdna.getItem().getBioWell().getPlate();
    669     Date synthesisDate = (Date) Annotationtype.SYNTHESIS_DATE.getAnnotationValue(dc, plate);
    670     cdna.setAnnotation("synthesisDate", Reggie.CONVERTER_DATE_TO_STRING.convert(synthesisDate));
    671     // Get BioPlate PlateProcessResult annotation
    672     String result = (String) Annotationtype.PLATE_PROCESS_RESULT.getAnnotationValue(dc, plate);
    673     cdna.setAnnotation("result", result);
     671   
     672    // Get BioPlate annotations
     673    BioPlate plate = getBioPlate(e);
     674    if (plate != null)
     675    {
     676      Date synthesisDate = (Date) Annotationtype.SYNTHESIS_DATE.getAnnotationValue(dc, plate);
     677      cdna.setAnnotation("synthesisDate", Reggie.CONVERTER_DATE_TO_STRING.convert(synthesisDate));
     678      // Get BioPlate PlateProcessResult annotation
     679      String result = (String) Annotationtype.PLATE_PROCESS_RESULT.getAnnotationValue(dc, plate);
     680      cdna.setAnnotation("result", result);
     681    }
    674682  }
    675683
     
    681689    lib.setAnnotation("registrationDate", Reggie.CONVERTER_DATE_TO_STRING.convert(e.getEntryDate()));
    682690    lib.setAnnotation("editable", e.hasPermission(Permission.WRITE));
    683     // Get BioPlate CleanupDate annotation
    684     BioPlate plate = lib.getItem().getBioWell().getPlate();
    685     Date cleanupDate = (Date) Annotationtype.CLEANUP_DATE.getAnnotationValue(dc, plate);
    686     lib.setAnnotation("cleanupDate", Reggie.CONVERTER_DATE_TO_STRING.convert(cleanupDate));
    687691    lib.setAnnotation("originalQuantity", e.getOriginalQuantity());
    688692    lib.setAnnotation("remainingQuantity", e.getRemainingQuantity());
     
    691695    lib.loadAnnotations(dc, "qubitconc", Annotationtype.QUBIT_CONC, null);
    692696    lib.setAnnotation("comment", e.getDescription());
    693     // Get BioPlate PlateProcessResult annotation
    694     String result = (String) Annotationtype.PLATE_PROCESS_RESULT.getAnnotationValue(dc, plate);
    695     lib.setAnnotation("result", result);
     697   
     698    // Get BioPlate annotations
     699    BioPlate plate = getBioPlate(e);
     700    if (plate != null)
     701    {
     702      Date cleanupDate = (Date) Annotationtype.CLEANUP_DATE.getAnnotationValue(dc, plate);
     703      lib.setAnnotation("cleanupDate", Reggie.CONVERTER_DATE_TO_STRING.convert(cleanupDate));
     704      // Get BioPlate PlateProcessResult annotation
     705      String result = (String) Annotationtype.PLATE_PROCESS_RESULT.getAnnotationValue(dc, plate);
     706      lib.setAnnotation("result", result);
     707    }
    696708  }
    697709
     
    710722    lib.setAnnotation("comment", e.getDescription());
    711723  }
     724 
     725  private BioPlate getBioPlate(MeasuredBioMaterial bioMaterial)
     726  {
     727    BioWell well = bioMaterial.getBioWell();
     728    return well == null ? null : well.getPlate();
     729  }
     730 
    712731}
Note: See TracChangeset for help on using the changeset viewer.