Changeset 1425 for extensions/net.sf.basedb.reggie
- Timestamp:
- Oct 28, 2011, 2:35:36 PM (12 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/partitionform.jsp
r1420 r1425 151 151 var bloodyTitle = 'Bloody<br>'; 152 152 153 var appearanceOptions = '<option selected ></option>';154 appearanceOptions += '<option value= homogenus>Homogenus</option>';155 appearanceOptions += '<option value= heterogenus>Heterogenus</option>';156 157 var necrosisOptions = '<option selected value= 0>0</option>';158 necrosisOptions += '<option value= 20>20</option>';159 necrosisOptions += '<option value= 40>40</option>';160 necrosisOptions += '<option value= 60>60</option>';161 necrosisOptions += '<option value= 80>80</option>';162 necrosisOptions += '<option value= 100>100</option>';153 var appearanceOptions = '<option selected ></option>'; 154 appearanceOptions += '<option value="HOMOGENUS">Homogenus</option>'; 155 appearanceOptions += '<option value="HETEROGENUS">Heterogenus</option>'; 156 157 var necrosisOptions = '<option selected value="0">0</option>'; 158 necrosisOptions += '<option value="20">20</option>'; 159 necrosisOptions += '<option value="40">40</option>'; 160 necrosisOptions += '<option value="60">60</option>'; 161 necrosisOptions += '<option value="80">80</option>'; 162 necrosisOptions += '<option value="100">100</option>'; 163 163 164 164 var fatOptions = '<option selected value=0>0</option>'; … … 202 202 inputWeightHtml += '<tr>'; 203 203 inputWeightHtml += '<td style="width:400px;" class="help"><span class="message" id="'+i+'.message"></span><span id="'+i+'.help"></span></td>'; 204 inputWeightHtml += '</tr>'; 205 204 inputWeightHtml += '</tr>'; 206 205 inputWeightHtml += '<tr><td> </td></tr>'; 207 206 } … … 439 438 function goCreate() 440 439 { 441 alert('goCreate');442 440 if (!step3IsValid()) return; 443 441 444 442 Main.hide('gocancel'); 445 443 Main.hide('gocreate'); 446 var frm = document.forms['reggie']; 447 448 var specimens = caseInfo.specimen; 444 445 var frm = document.forms['reggie']; 446 var tubeInfo = new Object(); 447 448 var specimens = selectedTubes; 449 449 var nofTubes = specimens.length; 450 450 var partitionDateValue = frm.elements['partitionDate'].value; 451 //var partitionCommentValue = frm.elements['partitionComment'].value; 452 caseInfo.partitionDate = partitionDateValue; 453 // if (partitionCommentValue != null) caseInfo.otherPartitionComment = partitionCommentValue; 454 451 tubeInfo.partitionDate = partitionDateValue; 455 452 for (var i=0; i<nofTubes; i++) 456 453 { … … 459 456 frm.elements['hisWeight'+i].disabled = true; 460 457 frm.elements['nofPieces'+i].disabled = true; 461 458 frm.elements['bloody'+i].disabled = true; 459 frm.elements['appearance'+i].disabled = true; 460 frm.elements['necrosis'+i].disabled = true; 461 frm.elements['fat'+i].disabled = true; 462 frm.elements['coloured'+i].disabled = true; 463 462 464 var specimenTube = specimens[i]; 463 465 … … 471 473 if (nofPiecesValue != '') specimenTube.nofPieces = nofPiecesValue; 472 474 473 caseInfo.specimen[i] = specimenTube; 474 } 475 var partitionComment = ''; 476 var appearanceElement = frm.elements['appearance'+i]; 477 var necrosisElement = frm.elements['necrosis'+i]; 478 var fatElement = frm.elements['fat'+i]; 479 var appearanceValue = appearanceElement.options[appearanceElement.selectedIndex].value; 480 var necrosisValue = necrosisElement.options[necrosisElement.selectedIndex].value; 481 var fatValue = fatElement.options[fatElement.selectedIndex].value; 482 483 // Generate partition comment string 484 if (frm.elements['bloody'+i].checked == true) partitionComment += 'BLOODY'; 485 if (appearanceValue != '') partitionComment += (partitionComment.length>0 ? ':' : '') + appearanceValue; 486 if (necrosisValue != '0') partitionComment += (partitionComment.length>0 ? ':' : '') + 'NECROSIS'+necrosisValue+'%'; 487 if (fatValue != '0') partitionComment += (partitionComment.length>0 ? ':' : '') + 'FAT'+fatValue+'%'; 488 if (frm.elements['coloured'+i].checked == true) partitionComment += partitionComment.length>0 ? ':COLOURED' : 'COLOURED'; 489 490 specimenTube.otherPartitionComment = partitionComment.length > 0 ? partitionComment : null; 491 492 specimens[i] = specimenTube; 493 } 494 tubeInfo.specimens = specimens; 475 495 var submitInfo = new Object(); 476 submitInfo. caseInfo = caseInfo;496 submitInfo.tubeInfo = tubeInfo; 477 497 478 498 if (debug) Main.debug(JSON.stringify(caseInfo)); … … 481 501 var url = 'PartitionRegistration.servlet?ID=<%=ID%>&cmd=CreatePartitions'; 482 502 request.open("POST", url, false); 483 request.setRequestHeader("Content-Type", "application/json"); 503 request.setRequestHeader("Content-Type", "application/json"); 484 504 request.send(JSON.stringify(submitInfo)); 485 505 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/SpecimenTube.java
r1421 r1425 105 105 106 106 ItemQuery<Sample> tubeQuery = Sample.getQuery(); 107 tubeQuery.restrict(Restrictions.rlike(Hql.property("name"), Expressions.parameter("name", "^.+\\.[0-9]+$", Type.STRING))); 107 tubeQuery.restrict(Restrictions.and(Restrictions.eq(Hql.property("originalQuantity"), null), 108 Restrictions.rlike(Hql.property("name"), Expressions.parameter("name", "^.+\\.[0-9]+$", Type.STRING)))); 108 109 tubeQuery.order(Orders.desc(Hql.property("name"))); 109 110 tubeQuery.include(Include.ALL); … … 120 121 private final String row; 121 122 private final String column; 122 private final Float originalQuantity;123 // private final Float originalQuantity; 123 124 124 125 private SpecimenTube(Sample sample) … … 133 134 row = wcfRow.format(well.getRow()); 134 135 column = wcfColumn.format(well.getColumn()); 135 originalQuantity = sample.getOriginalQuantity();136 // originalQuantity = sample.getOriginalQuantity(); 136 137 } 137 138 else … … 140 141 row = null; 141 142 column = null; 142 originalQuantity = null;143 // originalQuantity = null; 143 144 } 144 145 } … … 176 177 return column; 177 178 } 178 179 public Float getOriginalQuantity()180 {181 return originalQuantity;182 }179 // 180 // public Float getOriginalQuantity() 181 // { 182 // return originalQuantity; 183 // } 183 184 184 185 @SuppressWarnings("unchecked") … … 189 190 json.put("row", row); 190 191 json.put("column", column); 191 json.put("originalQuantity", originalQuantity);192 // json.put("originalQuantity", originalQuantity); 192 193 } 193 194 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PartitionRegistrationServlet.java
r1419 r1425 28 28 import net.sf.basedb.reggie.Reggie; 29 29 import net.sf.basedb.reggie.converter.StringToDateConverter; 30 import net.sf.basedb.reggie.dao.Case;31 30 import net.sf.basedb.reggie.dao.SpecimenTube; 32 31 import net.sf.basedb.util.Values; … … 115 114 dc = sc.newDbControl(); 116 115 JSONObject jsonReq = (JSONObject)new JSONParser().parse(req.getReader()); 117 JSONObject json Case = (JSONObject)jsonReq.get("caseInfo");118 JSONArray jsonSpecimens = (JSONArray)json Case.get("specimen");116 JSONObject jsonInfo = (JSONObject)jsonReq.get("tubeInfo"); 117 JSONArray jsonSpecimens = (JSONArray)jsonInfo.get("specimens"); 119 118 120 119 AnnotationType partitionDateType = Reggie.findAnnotationType(dc, new Item[]{Item.EXTRACT, Item.SAMPLE}, Reggie.ANNOTATION_PARTITION_DATE, true); … … 122 121 AnnotationType nofPiecesType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_NOF_PIECES, true); 123 122 124 StringToDateConverter dateConverter = new StringToDateConverter(new SimpleDateFormat("yyyyMMdd")); 125 String otherPartitionComment = Values.getStringOrNull((String)jsonCase.get("otherPartitionComment")); 126 Date partitionDate = dateConverter.convert((String)jsonCase.get("partitionDate")); 123 StringToDateConverter dateConverter = new StringToDateConverter(new SimpleDateFormat("yyyyMMdd")); 124 Date partitionDate = dateConverter.convert((String)jsonInfo.get("partitionDate")); 127 125 128 126 if (jsonSpecimens != null && jsonSpecimens.size()>0) … … 143 141 Float apWeight = Values.getFloat((String)jsonSpecimen.get("apWeight"), null); 144 142 Float hisWeight = Values.getFloat((String)jsonSpecimen.get("hisWeight"), null); 145 Integer nofPieces = Values.getInteger((String)jsonSpecimen.get("nofPieces"), null); 143 Integer nofPieces = Values.getInteger((String)jsonSpecimen.get("nofPieces"), null); 144 String otherPartitionComment = Values.getStringOrNull((String)jsonSpecimen.get("otherPartitionComment")); 146 145 147 146 if (spWeight != null) spWeight = spWeight *1000;
Note: See TracChangeset
for help on using the changeset viewer.