Changeset 1970


Ignore:
Timestamp:
May 8, 2013, 2:55:14 PM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #480: Register pooled libraries

Preliminary registration form which only register the date, protocol and comments. May need to discuss if there is other information to store (freezer location, etc).

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/index.jsp

    r1959 r1970  
    264264            <ul>
    265265            <li><a href="libprep/create_pools.jsp?ID=<%=ID%>">Create pooled libraries</a>
    266             <li><a href="libprep/pool_protocol.jsp?ID=<%=ID%>">Lab protocols for pooling</a> (preliminary)
    267             <li><a href="libprep/pool_registration.jsp?ID=<%=ID%>" class="not-implemented">Register pooled libraries</a>
     266            <li><a href="libprep/pool_protocol.jsp?ID=<%=ID%>">Lab protocols for pooling</a>
     267            <li><a href="libprep/pool_registration.jsp?ID=<%=ID%>">Register pooled libraries</a>
    268268            <li><a href="libprep/flowcell_registration.jsp?ID=<%=ID%>" class="not-implemented">Register flow cells</a>
    269269            </ul>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PoolServlet.java

    r1959 r1970  
    44
    55import java.util.Arrays;
     6import java.util.Date;
    67import java.util.List;
    78
     
    2526import net.sf.basedb.core.ItemQuery;
    2627import net.sf.basedb.core.ItemSubtype;
     28import net.sf.basedb.core.Protocol;
    2729import net.sf.basedb.core.SessionControl;
    2830import net.sf.basedb.core.Type;
     
    385387          jsonMessages.add("Created '" + pool.getName() + "' from " + jsonLibs.size() + " libraries; pool molarity=" + Values.formatNumber(summedPoolMolarity / jsonLibs.size(), 2)); // conc="+Values.formatNumber(poolQuantity * 1000 / poolVolume, 2) + "ng/µl; quantity="+Values.formatNumber(poolQuantity*1000, 2)+"ng; volume="+Values.formatNumber(poolVolume, 2) + "µl");
    386388        }
     389        dc.commit();
     390      }
     391      else if ("RegisterPooledLibraries".equals(cmd))
     392      {
     393        JSONObject jsonReq = (JSONObject)new JSONParser().parse(req.getReader());
     394        dc = sc.newDbControl();
     395       
     396        Number poolProtocolId = (Number)jsonReq.get("poolProtocol");
     397        Date poolDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonReq.get("poolDate"));
     398        String operator = Values.getStringOrNull((String)jsonReq.get("poolOperator"));
     399        String comment = Values.getStringOrNull((String)jsonReq.get("comments"));
     400       
     401        Protocol poolProtocol = poolProtocolId == null ? null : Protocol.getById(dc, poolProtocolId.intValue());
     402       
     403        JSONArray jsonPools = (JSONArray)jsonReq.get("pools");       
     404        for (int i = 0; i < jsonPools.size(); i++)
     405        {
     406          Number poolId = (Number)jsonPools.get(i);
     407          Extract pool = Extract.getById(dc, poolId.intValue());
     408          BioMaterialEvent creationEvent = pool.getCreationEvent();
     409         
     410          creationEvent.setEventDate(poolDate);
     411          creationEvent.setProtocol(poolProtocol);
     412          pool.setDescription(comment);
     413         
     414          jsonMessages.add("Pool '" + pool.getName() + "' registered as completed.");
     415        }
    387416       
    388417        dc.commit();
Note: See TracChangeset for help on using the changeset viewer.