Changeset 5249


Ignore:
Timestamp:
Feb 17, 2010, 1:38:58 PM (12 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1309: externalId for protocols

Added to the web interface and batch importers.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/AbstractItemImporter.java

    r5177 r5249  
    185185      "protocolColumnMapping",
    186186      "Protocol",
    187       "Mapping that picks the name or ID of a protocol from the data columns. The plug-in will first " +
    188       "try to find a protocol with the given name. If none is found and the value is numeric it will " +
     187      "Mapping that picks the name, external or internal ID of a protocol from the data columns. The plug-in will first " +
     188      "try to find a protocol with the given name or external id. If none is found and the value is numeric it will " +
    189189      "try to load by internal ID. " +
    190190      "Example: \\Protocol\\",
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ArrayBatchImporter.java

    r4551 r5249  
    201201      String nameOrId = protocolMapper.getValue(data);
    202202      ProtocolType type = ProtocolType.getById(dc, SystemItems.getId(ProtocolType.PRINTING));
    203       Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type);
     203      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    204204      if (nameOrId == null || protocol != null) batch.setProtocol(protocol);
    205205    }
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ExtractImporter.java

    r4844 r5249  
    214214      ProtocolType type = ProtocolType.getById(dc,
    215215          SystemItems.getId(extract.isPooled() ? ProtocolType.POOLING : ProtocolType.EXTRACTION));
    216       Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type);
     216      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    217217      if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol);
    218218    }
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/HybridizationImporter.java

    r4891 r5249  
    264264      String nameOrId = protocolMapper.getValue(data);
    265265      ProtocolType type = ProtocolType.getById(dc, SystemItems.getId(ProtocolType.HYBRIDIZATION));
    266       Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type);
     266      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    267267      if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol);
    268268    }
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/LabeledExtractImporter.java

    r4844 r5249  
    243243      ProtocolType type = ProtocolType.getById(dc,
    244244          SystemItems.getId(extract.isPooled() ? ProtocolType.POOLING : ProtocolType.LABELING));
    245       Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type);
     245      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    246246      if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol);
    247247    }
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/RawBioAssayImporter.java

    r5177 r5249  
    432432      String nameOrId = protocolMapper.getValue(data);
    433433      ProtocolType type = ProtocolType.getById(dc, SystemItems.getId(ProtocolType.FEATURE_EXTRACTION));
    434       Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type);
     434      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    435435      if (nameOrId == null || protocol != null) rba.setProtocol(protocol);
    436436    }
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/SampleImporter.java

    r4888 r5249  
    319319      ProtocolType type = ProtocolType.getById(dc,
    320320          SystemItems.getId(sample.isPooled() ? ProtocolType.POOLING : ProtocolType.SAMPLING));
    321       Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type);
     321      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    322322      if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol);
    323323    }
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ScanImporter.java

    r4922 r5249  
    300300      String nameOrId = protocolMapper.getValue(data);
    301301      ProtocolType type = ProtocolType.getById(dc, SystemItems.getId(ProtocolType.SCANNING));
    302       Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type);
     302      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    303303      if (nameOrId == null || protocol != null) scan.setProtocol(protocol);
    304304    }
  • trunk/src/test/TestProtocol.java

    r5248 r5249  
    8585        p.setExternalId("External protocol id");
    8686      }
    87       if (name != null) p.setName(name);
     87      if (name != null)
     88      {
     89        p.setName(name);
     90        p.setExternalId(name + ".id");
     91      }
    8892      dc.saveItem(p);
    8993      dc.commit();
  • trunk/src/test/data/test.batchimport.samples.txt

    r4366 r5249  
    11Name  Description External ID Pooled  Parent  Used quantity Created Original quantity Protocol
    2 Sample 1.1  First sample from bs.1  smp.1.1   Biosource 1   2008-01-01  200 Sampling
     2Sample 1.1  First sample from bs.1  smp.1.1   Biosource 1   2008-01-01  200 Sampling.id
    33Sample 2.1  Second sample from bs.1 smp.2.1   Biosource 2   2008-01-01  350 Sampling
    44Sample X  A sample with no parent or other info
  • trunk/www/admin/protocols/edit_protocol.jsp

    r4938 r5249  
    292292      </tr>
    293293      <tr>
     294        <td class="prompt">External ID</td>
     295        <td><input <%=clazz%> type="text" name="external_id"
     296          value="<%=HTML.encodeTags(protocol == null ? Values.getString(cc.getPropertyValue("externalId"), "") : protocol.getExternalId())%>"
     297          size="40" maxlength="<%=Protocol.MAX_EXTERNAL_ID_LENGTH%>"></td>
     298      </tr>
     299      <tr>
    294300        <td class="prompt">File</td>
    295301        <td>
  • trunk/www/admin/protocols/index.jsp

    r5060 r5249  
    145145    protocol.setName(Values.getStringOrNull(request.getParameter("name")));
    146146    protocol.setDescription(Values.getStringOrNull(request.getParameter("description")));
     147    protocol.setExternalId(Values.getStringOrNull(request.getParameter("external_id")));
    147148    if (protocolTypeId >= 0) // < 0 = denied or unchanged
    148149    {
  • trunk/www/admin/protocols/list_protocol.jsp

    r5165 r5249  
    258258      }
    259259      %>
     260      <tbl:columndef
     261        id="externalId"
     262        property="externalId"
     263        datatype="string"
     264        title="External id"
     265        sortable="true"
     266        filterable="true"
     267        exportable="true"
     268      />     
    260269      <tbl:columndef
    261270        id="protocolType"
     
    527536                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
    528537                  /></tbl:cell>
     538                <tbl:cell column="externalId"><%=HTML.encodeTags(item.getExternalId())%></tbl:cell>               
    529539                <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
    530540                <%
  • trunk/www/admin/protocols/view_protocol.jsp

    r5069 r5249  
    265265        <td class="prompt">Type</td>
    266266        <td><base:propertyvalue item="<%=protocol%>" property="protocolType" /></td>
     267      </tr>
     268      <tr>
     269        <td class="prompt">External ID</td>
     270        <td><%=HTML.encodeTags(protocol.getExternalId())%></td>
    267271      </tr>
    268272      <tr>
Note: See TracChangeset for help on using the changeset viewer.