Changeset 6992


Ignore:
Timestamp:
Nov 3, 2015, 8:19:18 AM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #1958: Add Kit item

Kits can now be selected for extracts in the web client.

Subtype relationships has been implemented and the installer creates "Extraction", "Labeling" and "Library preparation" kit types linked to "Extract", "Labeled extract" and "Library" item types.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/Extract.java

    r6881 r6992  
    156156  @Override
    157157  @SupportsPushAnnotations
    158   @SubtypableRelatedItems({Item.PROTOCOL, Item.HARDWARE, Item.TAG, Item.SAMPLE, Item.EXTRACT})
     158  @SubtypableRelatedItems({Item.PROTOCOL, Item.KIT, Item.HARDWARE, Item.TAG, Item.SAMPLE, Item.EXTRACT})
    159159  public ItemSubtype getItemSubtype()
    160160  {
  • trunk/src/core/net/sf/basedb/core/Install.java

    r6990 r6992  
    456456      ItemSubtypeData labelingProtocol = createItemSubtype(Item.PROTOCOL, Protocol.LABELING,
    457457          "Labeling", "Protocols used for creating labeled extracts.", protocolFileType);
    458       ItemSubtypeData libraryPreparation = createItemSubtype(Item.PROTOCOL, Protocol.LIBRARY_PREPARATION,
     458      ItemSubtypeData libraryPrepProtocol = createItemSubtype(Item.PROTOCOL, Protocol.LIBRARY_PREPARATION,
    459459          "Library preparation", "Protocols used for library preparation", protocolFileType);
    460460      createItemSubtype(Item.PROTOCOL, Protocol.POOLING, "Pooling", "Protocols used for creating pooled biomaterails.", protocolFileType);
     
    473473      createItemSubtype(Item.PROTOCOL, Protocol.FEATURE_EXTRACTION, "Feature extraction", "Protocols used for extracting features from microarray images.", protocolFileType);
    474474 
     475      // Kit subtypes
     476      createItemSubtype(Item.KIT, Kit.EXTRACTION, "Extraction", "Kits used for creating extracts.");
     477      ItemSubtypeData labelingKit = createItemSubtype(Item.KIT, Kit.LABELING,
     478          "Labeling", "Kits used for creating labeled extracts.");
     479      ItemSubtypeData libraryPrepKit = createItemSubtype(Item.KIT, Kit.LIBRARY_PREPARATION,
     480          "Library preparation", "Kits used for creating libraries.");
     481
    475482      // Hardware subtypes
    476483      ItemSubtypeData scanner = createItemSubtype(Item.HARDWARE, Hardware.SCANNER,
     
    502509      ItemSubtypeData labeledExtract = createItemSubtype(Item.EXTRACT, Extract.LABELED,
    503510        "Labeled extract", "A labeled extract is an extract which has been tagged with a label",
    504         labelTag, labelingProtocol);
     511        labelTag, labelingProtocol, labelingKit);
    505512      ItemSubtypeData library = createItemSubtype(Item.EXTRACT, Extract.LIBRARY,
    506513        "Library", "An extract that has been prepared with an adaptor sequence before sequencing",
    507         barcodeTag, libraryPreparation);
     514        barcodeTag, libraryPrepProtocol, libraryPrepKit);
    508515     
    509516      // Physical bioassay subtypes
     
    16981705      if (subtype != null)
    16991706      {
     1707        if (related != null)
     1708        {
     1709          // Add related subtypes that are missing
     1710          Map<Integer, ItemSubtypeData> allRelated = subtype.getRelatedSubtypes();
     1711          for (ItemSubtypeData rel : related)
     1712          {
     1713            if (!allRelated.containsKey(rel.getItemType()))
     1714            {
     1715              allRelated.put(rel.getItemType(), rel);
     1716            }
     1717          }
     1718        }
     1719
    17001720        log.info("createItemSubtype: EXISTS [SYSTEM ID="+systemId+"; name="+name+"]");
    17011721        HibernateUtil.commit(tx);
  • trunk/src/core/net/sf/basedb/core/Kit.java

    r6990 r6992  
    4646  private static final Item TYPE = Item.KIT;
    4747
     48  /**
     49    The ID for the extraction kit type, for example a kit
     50    used when creating an {@link Extract} from a {@link
     51    Sample}.
     52  */
     53  public static final String EXTRACTION = "net.sf.basedb.core.KitType.EXTRACTION";
     54
     55  /**
     56    The ID for the labeling kit type, for example a kit
     57    used when creating a labeled extract from an {@link Extract}.
     58  */
     59  public static final String LABELING = "net.sf.basedb.core.KitType.LABELING";
     60 
     61  /**
     62    The ID for the library preparation kit type, for example a kit
     63    used when creating a library extract from an {@link Extract}.
     64  */
     65  public static final String LIBRARY_PREPARATION = "net.sf.basedb.core.KitType.LIBRARY_PREPARATION";
     66 
    4867  /**
    4968    Create a new <code>Kit</code> item.
  • trunk/www/biomaterials/extracts/edit_extract.jsp

    r6947 r6992  
    4040  import="net.sf.basedb.core.BioPlate"
    4141  import="net.sf.basedb.core.BioWell"
     42  import="net.sf.basedb.core.Kit"
    4243  import="net.sf.basedb.core.Protocol"
    4344  import="net.sf.basedb.core.Project"
     
    102103  boolean readCurrentProtocol = true;
    103104  Protocol currentProtocol = null;
     105  boolean readCurrentKit = true;
     106  Kit currentKit = null;
    104107  boolean readCurrentTag = true;
    105108  Tag currentTag = null;
     
    123126      currentProtocol = Base.getFirstMatching(dc, Protocol.getQuery(), "name", cc.getPropertyFilter("creationEvent.protocol.name"));
    124127    }
     128    if (cc.getPropertyFilter("creationEvent.kit.name") != null)
     129    {
     130      currentKit = Base.getFirstMatching(dc, Kit.getQuery(), "name", cc.getPropertyFilter("creationEvent.kit.name"));
     131    }
    125132    if (cc.getPropertyFilter("tag.name") != null)
    126133    {
     
    212219    {
    213220      readCurrentProtocol = false;
     221    }
     222   
     223    try
     224    {
     225      currentKit = creationEvent.getKit();
     226    }
     227    catch (PermissionDeniedException ex)
     228    {
     229      readCurrentKit = false;
    214230    }
    215231 
     
    272288
    273289  // Load recently used items
     290  List<Kit> recentKits = (List<Kit>)cc.getRecent(dc, Item.KIT, currentSubtype);
    274291  List<Protocol> recentProtocols = (List<Protocol>)cc.getRecent(dc, Item.PROTOCOL, currentSubtype);
    275292  List<Sample> recentSamples = (List<Sample>)cc.getRecent(dc, Item.SAMPLE);
     
    324341    <div id="page-data" class="datacontainer"
    325342      data-extraction-protocoltype-id="<%=SystemItems.getId(Protocol.EXTRACTION)%>"
     343      data-extraction-kittype-id="<%=SystemItems.getId(Kit.EXTRACTION) %>"
    326344      data-extract-type="<%=Item.EXTRACT.getValue()%>"
    327345      <%
     
    450468            recent="<%=recentProtocols%>"
    451469            defaultitems="<%=defaultProtocols%>"
     470            newitem="<%=extract == null%>"
     471            disabled="<%=lockEventProperties%>"
     472          />
     473        </td>
     474        <td></td>
     475      </tr>
     476      <tr>
     477        <th>Kit</th>
     478        <td>
     479          <base:select
     480            id="kit_id"
     481            clazz="selectionlist"
     482            required="false"
     483            current="<%=currentKit%>"
     484            denied="<%=!readCurrentKit%>"
     485            recent="<%=recentKits%>"
    452486            newitem="<%=extract == null%>"
    453487            disabled="<%=lockEventProperties%>"
  • trunk/www/biomaterials/extracts/extracts.js

    r6947 r6992  
    5353      Buttons.addClickHandler('protocol_id.select', extracts.selectProtocol);
    5454      Events.addEventHandler('protocol_id', 'base-selected', extracts.setProtocolCallback);
     55      // Kit
     56      Buttons.addClickHandler('kit_id.select', extracts.selectKit);
     57      Events.addEventHandler('kit_id', 'base-selected', extracts.setKitCallback);
    5558      // Subtype
    5659      Events.addEventHandler('subtype_id', 'change', extracts.subtypeOnChange);
     
    266269    var tagId = Math.abs(parseInt(frm.tag_id.value));
    267270    if (tagId > 0) parents[parents.length] = 'TAG:'+tagId;
     271    var kitId = Math.abs(parseInt(frm.kit_id.value));
     272    if (kitId > 0) parents[parents.length] = 'KIT:'+kitId;
     273    var protocolId = Math.abs(parseInt(frm.protocol_id.value));
     274    if (protocolId > 0) parents[parents.length] = 'PROTOCOL:'+protocolId;
    268275    return parents;
    269276  }
     
    333340  }
    334341
     342  extracts.selectKit = function()
     343  {
     344    var frm = document.forms['extract'];
     345    var url = '&resetTemporary=1';
     346    url += ItemSubtype.createRelatedFilter('subtype_id', 'KIT', Data.int('page-data', 'extraction-kittype-id'));
     347    if (frm.kit_id.length > 1)
     348    {
     349      var id = Math.abs(parseInt(frm.kit_id[1].value));       
     350      url += '&item_id='+id;
     351    }
     352    Dialogs.selectItem('KIT', 'kit_id', 0, url);
     353  }
     354 
     355  extracts.setKitCallback = function(event)
     356  {
     357    var frm = document.forms['extract'];
     358    var list = frm.kit_id;
     359    if (list.length < 2 || list[1].value == '0')
     360    {
     361      Forms.addListOption(list, 1, new Option());
     362    }
     363    list[1].value = event.detail.id;
     364    list[1].text = event.detail.name;
     365    list.selectedIndex = 1;
     366  }
     367
     368 
    335369  extracts.selectBioPlate = function()
    336370  {
  • trunk/www/biomaterials/extracts/index.jsp

    r6756 r6992  
    3535  import="net.sf.basedb.core.BioPlateEventType"
    3636  import="net.sf.basedb.core.BioWell"
     37  import="net.sf.basedb.core.Kit"
    3738  import="net.sf.basedb.core.Protocol"
    3839  import="net.sf.basedb.core.Tag"
     
    262263          if (pt != null) cc.setRecent(pt, subtype, maxRecent);
    263264        }
     265        int kitId = Values.getInt(request.getParameter("kit_id"), -1);
     266        if (kitId >= 0) // < 0 = denied or unchanged
     267        {
     268          Kit kit = kitId == 0 ? null : Kit.getById(dc, kitId);
     269          creationEvent.setKit(kit);
     270          if (kit != null) cc.setRecent(kit, subtype, maxRecent);
     271        }
    264272      }
    265273     
  • trunk/www/biomaterials/extracts/list_extracts.jsp

    r6834 r6992  
    310310      />
    311311      <tbl:columndef
     312        id="kit"
     313        property="creationEvent.kit"
     314        sortproperty="creationEvent.kit.name"
     315        filterproperty="creationEvent.kit.name"
     316        exportproperty="creationEvent.kit.name"
     317        datatype="string"
     318        title="Kit"
     319        sortable="true"
     320        filterable="true"
     321        exportable="true"
     322      />
     323      <tbl:columndef
    312324        id="eventDate"
    313325        property="creationEvent.eventDate"
     
    758770                    item="<%=creationEvent%>"
    759771                    property="protocol"
     772                    enableEditLink="<%=mode.hasEditLink()%>"
     773                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
     774                  /></tbl:cell>
     775                <tbl:cell column="kit"
     776                  ><base:propertyvalue
     777                    item="<%=creationEvent%>"
     778                    property="kit"
    760779                    enableEditLink="<%=mode.hasEditLink()%>"
    761780                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
  • trunk/www/biomaterials/extracts/view_extract.jsp

    r6605 r6992  
    285285          <th>Protocol</th>
    286286          <td><base:propertyvalue item="<%=creationEvent%>" property="protocol"/></td>
     287        </tr>
     288        <tr>
     289          <th>Kit</th>
     290          <td><base:propertyvalue item="<%=creationEvent%>" property="kit"/></td>
    287291        </tr>
    288292        <tr>
Note: See TracChangeset for help on using the changeset viewer.