Changeset 6221
- Timestamp:
- Apr 23, 2021, 9:01:50 AM (2 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/DnaInfo.java
r6212 r6221 37 37 // TODO -- concentrations and quantities 38 38 // TODO -- protocol 39 protocol = section.getRequiredEntry("Protocol", ProtocolValidator.EXTRACTION_PROTOCOL); 39 40 } 40 41 valid = section != null && !section.hasError(); -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/FastqInfo.java
r6210 r6221 34 34 R1 = fastq.getRequiredEntry("R1", new FastqFile()); 35 35 R2 = fastq.getRequiredEntry("R2", new FastqFile()); 36 // TODO -- wait and see 37 if (R1 != null) R1.md5 = fastq.getOptionalEntry("R1 MD5", PatternValidator.MD5); 38 if (R2 != null) R2.md5 = fastq.getOptionalEntry("R2 MD5", PatternValidator.MD5); 36 39 } 37 40 valid = fastq != null && !fastq.hasError(); … … 74 77 { 75 78 public String name; 79 public String md5; 76 80 public long size; 77 81 public long lastModified; … … 85 89 public FastqFile isValid(DbControl dc, String value, JsonSection section, String entryKey) 86 90 { 87 this.name = value; // TODO -- implement validation 88 return this; 91 this.name = PatternValidator.FILE_NAME.isValid(dc, value, section, entryKey); 92 if (name != null && !name.endsWith(".fastq.gz")) 93 { 94 section.addWarningMessage("FASTQ filename doesn't end with '.fastq.gz': "+entryKey+"="+value); 95 } 96 return name == null ? null : this; 89 97 } 90 98 … … 93 101 JSONObject j = new JSONObject(); 94 102 j.put("name", name); 103 j.put("md5", md5); 95 104 j.put("size", size); 96 105 j.put("lastModified", Reggie.CONVERTER_DATETIME_TO_STRING_WITH_SEPARATOR.convert(new Date(lastModified))); -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/FlowThroughInfo.java
r6212 r6221 36 36 // TODO -- concentrations and quantities 37 37 // TODO -- protocol 38 protocol = section.getRequiredEntry("Protocol", ProtocolValidator.EXTRACTION_PROTOCOL); 38 39 } 39 40 valid = section != null && !section.hasError(); -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/LibraryInfo.java
r6212 r6221 71 71 barcode = section.getRequiredEntry("Barcode", BarcodeValidator.INSTANCE); 72 72 // TODO -- protocol 73 protocol = section.getRequiredEntry("Protocol", ProtocolValidator.LIB_PROTOCOL); 73 74 } 74 75 valid = section != null && !section.hasError(); -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/LysateInfo.java
r6217 r6221 33 33 usedFromSpecimen = section.getRequiredEntry("Used quantity (mg)", FloatValidator.POSITIVE); 34 34 // TODO -- protocol 35 protocol = section.getRequiredEntry("Protocol", ProtocolValidator.SAMPLE_HANDLING_PROTOCOL); 35 36 36 37 if (specimen.originalQuantity != null && specimen.remainingQuantity != null && usedFromSpecimen != null) -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/PatternValidator.java
r6217 r6221 55 55 public static final PatternValidator PAD = new PatternValidator("[A-Z0-9-]{4,20}", "PAD", null, "4-20 characters A-Z, 0-9 or '-'"); 56 56 57 /** 58 Filenames are allowed to have A-Z (upper and lower case), 0-9, '-', '_', and '.'. 59 */ 60 public static final PatternValidator FILE_NAME = new PatternValidator("[a-zA-Z0-9_.-]+", "file name", null, "A-Z, 0-9, '-', '_' or '.'"); 61 62 /** 63 MD5 validator. 64 */ 65 public static final PatternValidator MD5 = new PatternValidator("[a-f0-9]{32}", "MD5", null, "32 characters, 0-9 or a-f"); 66 57 67 private final Pattern pattern; 58 68 private final String subject; … … 71 81 public String isValid(DbControl dc, String value, JsonSection section, String entryKey) 72 82 { 73 Matcher m = pattern.matcher(value); 74 if (!m.matches()) 83 if (value != null) 75 84 { 76 section.addErrorMessage("Invalid "+subject+" in JSON: "+entryKey+"="+value+(expected!=null?" (expected " +expected+")":"")); 77 return null; 85 Matcher m = pattern.matcher(value); 86 if (!m.matches()) 87 { 88 section.addErrorMessage("Invalid "+subject+" in JSON: "+entryKey+"="+value+(expected!=null?" (expected " +expected+")":"")); 89 return null; 90 } 91 if (replacement != null) value = m.replaceAll(replacement); 78 92 } 79 if (replacement != null) value = m.replaceAll(replacement);80 93 return value; 81 94 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/RnaInfo.java
r6212 r6221 39 39 // TODO -- RNAQC 40 40 // TODO -- protocol 41 protocol = section.getRequiredEntry("Protocol", ProtocolValidator.EXTRACTION_PROTOCOL); 41 42 } 42 43 valid = section != null && !section.hasError(); -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java
r6219 r6221 879 879 Annotationtype.SCORE_STROMA, Annotationtype.SCORE_FAT)); 880 880 881 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.SAMPLE_HANDLING_PROTOCOL, createIfMissing, 882 Annotationtype.EXTERNAL_REF 883 )); 884 881 885 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.LYSATE, createIfMissing, 882 886 Annotationtype.PARTITION_DATE, Annotationtype.MULTIPLE_PIECES, … … 886 890 Annotationtype.DO_NOT_USE, Annotationtype.DO_NOT_USE_COMMENT, 887 891 Annotationtype.AUTO_PROCESSING 892 )); 893 894 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.EXTRACTION_PROTOCOL, createIfMissing, 895 Annotationtype.EXTERNAL_REF 888 896 )); 889 897 … … 999 1007 1000 1008 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.LIBRARY_PROTOCOL, createIfMissing, 1001 Annotationtype.LIBPREP_TARGET 1009 Annotationtype.LIBPREP_TARGET, Annotationtype.EXTERNAL_REF 1002 1010 )); 1003 1011
Note: See TracChangeset
for help on using the changeset viewer.