Changeset 1774


Ignore:
Timestamp:
Dec 11, 2012, 2:13:41 PM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #451: Change 'storage location' for paraffin blocks and HE glass

The storage location is now stored in 'tray' and 'position' fields. Need to write an update note for the server admin.

File:
1 edited

Legend:

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

    r1695 r1774  
    77import java.util.Set;
    88import java.util.TreeSet;
    9 import java.util.regex.Matcher;
    10 import java.util.regex.Pattern;
    119
    1210import javax.servlet.ServletException;
     
    212210        // Load child HEglass plates
    213211        List<ReactionPlate> heGlassPlates = paraffinBlock.findChildPlates(dc, BioplateType.HE_GLASS);
    214        
    215         Pattern storagePattern = Pattern.compile("Stored in glass box\\: (\\d+)\\; position\\: (\\d+)");
    216        
     212               
    217213        if (heGlassPlates.size() > 0)
    218214        {
     
    225221            BioPlate hePlate = heGlass.getBioPlate();
    226222           
    227             if (hePlate.getDescription() != null)
     223            if (hePlate.getTray() != null && hePlate.getPosition() != null)
    228224            {
    229               Matcher m = storagePattern.matcher(hePlate.getDescription());
    230               if (m.matches())
    231               {
    232                 heGlass.setAnnotation("storageBox", m.group(1));
    233                 heGlass.setAnnotation("position", m.group(2));
    234               }
     225              heGlass.setAnnotation("storageBox", hePlate.getTray());
     226              heGlass.setAnnotation("position", hePlate.getPosition());
    235227            }
    236228           
     
    257249        {
    258250          BioPlate heGlass = result.get(0);
    259           if (heGlass.getDescription() != null)
    260           {
    261             Pattern storagePattern = Pattern.compile("Stored in glass box\\: (\\d+)\\; position\\: (\\d+)");
    262             Matcher m = storagePattern.matcher(heGlass.getDescription());
    263             if (m.matches())
    264             {
    265               json.put("storageBox", Integer.parseInt(m.group(1)));
    266               json.put("position", Integer.parseInt(m.group(2)));
    267             }
     251          if (heGlass.getTray() != null && heGlass.getPosition() != null)
     252          {
     253            json.put("storageBox", Values.getInt(heGlass.getTray()));
     254            json.put("position", Values.getInt(heGlass.getPosition()));
    268255          }
    269256        }
     
    406393        Date moveDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonReq.get("moveDate"));
    407394        Number protocolId = (Number)jsonReq.get("protocolId");
    408         String storageBox = "";
     395        String storageBox = null;
    409396       
    410397        dc = sc.newDbControl();
     
    456443          {
    457444            JSONObject jsonBlock = (JSONObject)jsonBlocks.get(blockNo);
    458             storageBox = (String)jsonBlock.get("storageBox");
     445            storageBox = Values.getStringOrNull((String)jsonBlock.get("storageBox"));
    459446            Number blockId = (Number)jsonBlock.get("id");
    460447            blockPos = 0;
     
    463450            paraffinBlock = BioPlate.getById(dc, blockId.intValue());
    464451            paraffinBlock.setEventDate(moveDate);
    465             paraffinBlock.setDescription("Stored in block box: " + storageBox);
     452            paraffinBlock.setTray(storageBox);
    466453           
    467454            // Attach the new paraffin block to the PLACE-ON-PLATE event
     
    471458            int numSamples = remainingBioMaterial > Histology.SAMPLES_PER_BLOCK ? Histology.SAMPLES_PER_BLOCK : remainingBioMaterial;
    472459           
    473             jsonMessages.add("Moved " + numSamples + " samples to '" + paraffinBlock.getName() + "' (" + paraffinBlock.getDescription() + ")");
     460            jsonMessages.add("Moved " + numSamples + " samples to '" + paraffinBlock.getName() + "'");
    474461          }
    475462         
     
    495482        // Mark the work list as removed
    496483        workList.setRemoved(true);
    497         sc.setUserClientSetting("net.sf.basedb.reggie.histology.last-block-box", storageBox);
     484        if (storageBox != null)
     485        {
     486          sc.setUserClientSetting("net.sf.basedb.reggie.histology.last-block-box", storageBox);
     487        }
    498488
    499489        dc.commit();
     
    550540        {
    551541          JSONObject jsonGlass = (JSONObject)jsonHeGlass.get(stainNo-1);
    552           String storageBox = (String)jsonGlass.get("storageBox");
    553           String position = (String)jsonGlass.get("position");
     542          String storageBox = Values.getStringOrNull((String)jsonGlass.get("storageBox"));
     543          String position = Values.getStringOrNull((String)jsonGlass.get("position"));
    554544         
    555545          // Try to find an existing HE glass
     
    575565          }
    576566         
    577           heGlass.setDescription("Stored in glass box: " + storageBox + "; position: " + position);
     567          heGlass.setTray(storageBox);
     568          heGlass.setPosition(position);
    578569         
    579570          int numGoodStains = 0;
     
    628619          if (hePlate == null)
    629620          {
    630             jsonMessages.add("Created '" + heGlass.getName() + "' with " +  numGoodStains + " good stains. (" + heGlass.getDescription() + ")");
     621            jsonMessages.add("Created '" + heGlass.getName() + "' with " +  numGoodStains + " good stains.");
    631622          }
    632623          else
Note: See TracChangeset for help on using the changeset viewer.