Changeset 6465
- Timestamp:
- Nov 3, 2021, 1:39:48 PM (15 months ago)
- Location:
- extensions/net.sf.basedb.reggie/branches/4.33-stable/src/net/sf/basedb/reggie/plugins
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/branches/4.33-stable/src/net/sf/basedb/reggie/plugins/FutureSpecimenImporter.java
r6353 r6465 415 415 else 416 416 { 417 BioplateType plateType = BioplateType.EXTERNAL_LIBRARY; 417 BioplateType plateType = info.libPlateType; 418 if (plateType == null) plateType = BioplateType.EXTERNAL_LIBRARY; // Should not happen if LibraryInfo.valid==TRUE 418 419 plate = BioPlate.getNew(dc, plateType.getPlateGeometry(dc), plateType.get(dc)); 419 420 plate.setName(plateType.getNextPlateName(dc, true)); -
extensions/net.sf.basedb.reggie/branches/4.33-stable/src/net/sf/basedb/reggie/plugins/cmd/LibraryInfo.java
r6463 r6465 47 47 public Protocol protocol; 48 48 public BioPlate libPlate; 49 public BioplateType libPlateType = BioplateType.EXTERNAL_LIBRARY; 49 50 50 51 public boolean valid; … … 55 56 { 56 57 plateId = section.getRequiredEntry("Plate name", PatternValidator.CMD_ID); 57 well = section.getRequiredEntry("Plate well", PlateWellValidator.PLATE_8x12); 58 ValidPlateCoordinateWithType plateWell = section.getRequiredEntry("Plate well", PlateOrStripValidator.INSTANCE); 59 if (plateWell != null) 60 { 61 well = plateWell.plateCoordinate; 62 libPlateType = plateWell.plateType; 63 } 58 64 59 65 if (plateId != null && well != null && ctx != null) … … 63 69 { 64 70 String coordinate = Coordinate.numericToAlpha(well.getRow()+1)+(well.getColumn()+1); 65 String msg = " LibPlate well ["+coordinate+"; ExternalRef="+plateId+"] duplicated in file: ";71 String msg = "Plate well ["+coordinate+"; ExternalRef="+plateId+"] duplicated in file: "; 66 72 section.addErrorMessage(msg+duplicate.getFile().getName()); 67 73 duplicate.addErrorMessage(msg+section.getFile().getName()); … … 69 75 } 70 76 71 if (plateId != null) libPlate = findExistingLibPlate(plateId, section);77 if (plateId != null) libPlate = findExistingLibPlate(plateId, libPlateType, section); 72 78 if (libPlate != null && well != null) 73 79 { … … 82 88 83 89 barcode = section.getRequiredEntry("Barcode", BarcodeValidator.INSTANCE); 84 // TODO -- protocol85 90 protocol = section.getRequiredEntry("Protocol", ProtocolValidator.LIB_PROTOCOL); 86 91 } … … 88 93 } 89 94 90 private BioPlate findExistingLibPlate(String plateId, JsonSection section)95 private BioPlate findExistingLibPlate(String plateId, BioplateType plateType, JsonSection section) 91 96 { 92 97 BioPlate libPlate = null; … … 94 99 ItemQuery<BioPlate> query = BioPlate.getQuery(); 95 100 query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT); 96 BioplateType.EXTERNAL_LIBRARY.addFilter(dc, query, false); 101 if (plateType != null) 102 { 103 plateType.addFilter(dc, query, false); 104 } 97 105 query.join(Annotations.innerJoin(null, Annotationtype.EXTERNAL_REF.load(dc), "eref")); 98 106 query.restrict(Restrictions.eq(Hql.alias("eref"), Expressions.string(plateId))); … … 196 204 } 197 205 206 /** 207 Validator implementation that delegates to either STRIP_1x8 validator if 208 the coordinate is specified as 'digit:digit' or to PLATE_8x12 otherwise. 209 @since 4.33.4 210 */ 211 static class PlateOrStripValidator 212 implements ValueValidator<String, ValidPlateCoordinateWithType> 213 { 214 static final PlateOrStripValidator INSTANCE = new PlateOrStripValidator(); 215 216 @Override 217 public Class<String> getExpectedClass() 218 { 219 return String.class; 220 } 221 222 @Override 223 public ValidPlateCoordinateWithType isValid(DbControl dc, String value, JsonSection section, String entryKey) 224 { 225 ValidPlateCoordinateWithType result = new ValidPlateCoordinateWithType(); 226 PlateWellValidator validator; 227 if (value.matches("\\d\\:\\d")) 228 { 229 validator = PlateWellValidator.STRIP_1x8; 230 result.plateType = BioplateType.EXTERNAL_LIBRARY_STRIP; 231 } 232 else 233 { 234 validator = PlateWellValidator.PLATE_8x12; 235 result.plateType = BioplateType.EXTERNAL_LIBRARY; 236 } 237 result.plateCoordinate = validator.isValid(dc, value, section, entryKey); 238 return result; 239 } 240 } 241 242 /** 243 Holds the validated plate type and coordinate. 244 */ 245 static class ValidPlateCoordinateWithType 246 { 247 PlateCoordinate plateCoordinate; 248 BioplateType plateType; 249 } 198 250 } -
extensions/net.sf.basedb.reggie/branches/4.33-stable/src/net/sf/basedb/reggie/plugins/cmd/PlateWellValidator.java
r6460 r6465 25 25 */ 26 26 public static final PlateWellValidator PLATE_8x12 = new PlateWellValidator(8, 12); 27 28 /** 29 Validator for strips with 1 row and 8 columns. 30 @since 4.33.4 31 */ 32 public static final PlateWellValidator STRIP_1x8 = new PlateWellValidator(1, 8); 27 33 28 34 /**
Note: See TracChangeset
for help on using the changeset viewer.