Ignore:
Timestamp:
Oct 28, 2011, 2:35:36 PM (10 years ago)
Author:
Martin Svensson
Message:

References #330 The partition wizard is now fully functional. Some testings are left to do.

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  
    151151    var bloodyTitle = 'Bloody<br>';
    152152   
    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>';
    163163   
    164164    var fatOptions = '<option selected value=0>0</option>';
     
    202202      inputWeightHtml += '<tr>';
    203203      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>';     
    206205      inputWeightHtml += '<tr><td>&nbsp;</td></tr>';
    207206    }
     
    439438function goCreate()
    440439{
    441   alert('goCreate');
    442440  if (!step3IsValid()) return;
    443441 
    444442  Main.hide('gocancel');
    445443  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;
    449449  var nofTubes = specimens.length;
    450450  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;
    455452  for (var i=0; i<nofTubes; i++)
    456453  {
     
    459456    frm.elements['hisWeight'+i].disabled = true;
    460457    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       
    462464    var specimenTube = specimens[i];
    463465   
     
    471473    if (nofPiecesValue != '') specimenTube.nofPieces = nofPiecesValue;
    472474   
    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;
    475495  var submitInfo = new Object();
    476   submitInfo.caseInfo = caseInfo;
     496  submitInfo.tubeInfo = tubeInfo;
    477497 
    478498  if (debug) Main.debug(JSON.stringify(caseInfo));
     
    481501  var url = 'PartitionRegistration.servlet?ID=<%=ID%>&cmd=CreatePartitions';
    482502  request.open("POST", url, false);
    483   request.setRequestHeader("Content-Type", "application/json");
     503  request.setRequestHeader("Content-Type", "application/json"); 
    484504  request.send(JSON.stringify(submitInfo));
    485505
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/SpecimenTube.java

    r1421 r1425  
    105105   
    106106    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))));
    108109    tubeQuery.order(Orders.desc(Hql.property("name")));
    109110    tubeQuery.include(Include.ALL);
     
    120121  private final String row;
    121122  private final String column;
    122   private final Float originalQuantity;
     123//  private final Float originalQuantity;
    123124 
    124125  private SpecimenTube(Sample sample)
     
    133134      row = wcfRow.format(well.getRow());     
    134135      column = wcfColumn.format(well.getColumn());
    135       originalQuantity = sample.getOriginalQuantity();
     136//      originalQuantity = sample.getOriginalQuantity();
    136137    }
    137138    else
     
    140141      row = null;
    141142      column = null;
    142       originalQuantity = null;
     143//      originalQuantity = null;
    143144    }
    144145  }
     
    176177    return column;
    177178  }
    178  
    179   public Float getOriginalQuantity()
    180   {
    181     return originalQuantity;
    182   }
     179// 
     180//  public Float getOriginalQuantity()
     181//  {
     182//    return originalQuantity;
     183//  }
    183184 
    184185  @SuppressWarnings("unchecked")
     
    189190    json.put("row", row);
    190191    json.put("column", column);
    191     json.put("originalQuantity", originalQuantity);
     192//    json.put("originalQuantity", originalQuantity);
    192193  }
    193194}
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PartitionRegistrationServlet.java

    r1419 r1425  
    2828import net.sf.basedb.reggie.Reggie;
    2929import net.sf.basedb.reggie.converter.StringToDateConverter;
    30 import net.sf.basedb.reggie.dao.Case;
    3130import net.sf.basedb.reggie.dao.SpecimenTube;
    3231import net.sf.basedb.util.Values;
     
    115114        dc = sc.newDbControl();
    116115        JSONObject jsonReq = (JSONObject)new JSONParser().parse(req.getReader());       
    117         JSONObject jsonCase = (JSONObject)jsonReq.get("caseInfo");       
    118         JSONArray jsonSpecimens = (JSONArray)jsonCase.get("specimen");
     116        JSONObject jsonInfo = (JSONObject)jsonReq.get("tubeInfo");       
     117        JSONArray jsonSpecimens = (JSONArray)jsonInfo.get("specimens");
    119118       
    120119        AnnotationType partitionDateType = Reggie.findAnnotationType(dc, new Item[]{Item.EXTRACT, Item.SAMPLE}, Reggie.ANNOTATION_PARTITION_DATE, true);
     
    122121        AnnotationType nofPiecesType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_NOF_PIECES, true);
    123122       
    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"));
    127125       
    128126        if (jsonSpecimens != null && jsonSpecimens.size()>0)
     
    143141            Float apWeight = Values.getFloat((String)jsonSpecimen.get("apWeight"), null);
    144142            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"));
    146145           
    147146            if (spWeight != null) spWeight = spWeight *1000;
Note: See TracChangeset for help on using the changeset viewer.