Changeset 1372


Ignore:
Timestamp:
May 23, 2011, 4:40:03 PM (11 years ago)
Author:
Martin Svensson
Message:

References #317. The installation wizzard install new annotations. The new specimentube form is almost complete, some background-functionality is still missing.

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

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/META-INF/servlets.xml

    r1354 r1372  
    1717    <servlet-class>net.sf.basedb.reggie.servlet.ConsentFormServlet</servlet-class>
    1818  </servlet>
     19  <servlet>
     20    <servlet-name>SpecimenTubeRegistration</servlet-name>
     21    <servlet-class>net.sf.basedb.reggie.servlet.SpecimenTubeServlet</servlet-class>
     22  </servlet>
    1923
    2024</servlets>
  • extensions/net.sf.basedb.reggie/trunk/resources/index.jsp

    r1342 r1372  
    77  import="net.sf.basedb.core.Group"
    88  import="net.sf.basedb.core.DbControl"
     9  import="net.sf.basedb.core.Item"
     10  import="net.sf.basedb.core.Permission"
    911  import="net.sf.basedb.core.SessionControl"
    1012  import="net.sf.basedb.core.SystemItems"
     
    3133  boolean isAdmin = false;
    3234  boolean isPatientCurator = false;
     35  boolean hasCreateSamplePermission = false;
    3336  try
    3437  {
     
    5053  catch (RuntimeException ex)
    5154  {}
     55  try
     56  {
     57    if (sc.hasPermission(Permission.CREATE, Item.SAMPLE))
     58    {
     59      hasCreateSamplePermission = true;
     60    }
     61  }
     62  catch(RuntimeException ex)
     63  {}
    5264%>
    5365<base:page type="default" >
     
    150162        <%
    151163      }
     164      if (hasCreateSamplePermission)
     165      {
     166        %>
     167        <dt>
     168          <table border="0" cellspacing="0" cellpadding="0">
     169          <tr>
     170            <td><base:icon image="file.gif" style="padding-right: 4px;"/></td>
     171            <td><a href="specimentube.jsp?ID=<%=ID%>">Specimen tube registration wizard</a></td>
     172          </tr>
     173          </table>
     174        </dt>
     175        <dd>
     176          <ul>
     177          <li>Register new specimen tubes.
     178          <li>Update existing specimen tubes.
     179          </ul>
     180        </dd>
     181        <%
     182      }
    152183      %>
    153184      </dl>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/Reggie.java

    r1365 r1372  
    118118  public static final String ANNOTATION_CONSENT_DATE = "ConsentDate";
    119119
     120  /**
     121    The name of the "ArrivalDate" annotation type, used
     122    for samples (Specimen tube). It is a timestamp annotation.
     123  */
     124  public static final String ANNOTATION_ARRIVAL_DATE = "ArrivalDate";
     125 
     126  /**
     127    The name of the "NofDeliveredTubes" annotation type, used
     128    for samples (Specimen tube). It is an Integer annotation type.
     129  */
     130  public static final String ANNOTATION_NOF_DELIVERED_TUBES = "NofDeliveredTubes";
    120131 
    121132  /**
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/SpecimenTube.java

    r1366 r1372  
    66import net.sf.basedb.core.DbControl;
    77import net.sf.basedb.core.Include;
     8import net.sf.basedb.core.InvalidDataException;
    89import net.sf.basedb.core.ItemQuery;
    910import net.sf.basedb.core.Sample;
     
    6869  }
    6970 
     71 
     72  public static SpecimenTube findByTubeName(DbControl dc, String tubeName)
     73  {
     74    SpecimenTube tube = null;
     75   
     76    ItemQuery<Sample> tubeQuery = Sample.getQuery();
     77    tubeQuery.restrict(Restrictions.like(Hql.property("name"), Expressions.string(tubeName)));
     78    tubeQuery.order(Orders.desc(Hql.property("name")));       
     79    tubeQuery.include(Include.ALL);
     80   
     81    List<Sample> tubes = tubeQuery.list(dc);
     82    if (tubes.size() > 1)
     83    {
     84      throw new InvalidDataException(
     85          "More than one specimen tube with the name " + tubeName + " was found. " +
     86          "This wizard can't be used until that is corrected.");
     87    }
     88    if (tubes.size() == 1)
     89    {
     90      tube = new SpecimenTube(tubes.get(0));
     91    }
     92    return tube;
     93  }
     94 
    7095  private SpecimenTube(Sample sample)
    7196  {
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r1360 r1372  
    125125        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_CONSENT_DATE, Item.SAMPLE, Type.DATE, 1,
    126126            null, effectiveOptions, createIfMissing));
     127        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_ARRIVAL_DATE, Item.SAMPLE, Type.DATE, 1,
     128            null, effectiveOptions, createIfMissing));
     129        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_NOF_DELIVERED_TUBES, Item.SAMPLE, Type.STRING, 1,
     130            null, effectiveOptions, createIfMissing));
    127131       
    128132        json.put("checks", jsonChecks);
Note: See TracChangeset for help on using the changeset viewer.