Changeset 5649
- Timestamp:
- May 30, 2011, 2:23:32 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/core/core-plugins.xml
r5637 r5649 535 535 </plugin-definition> 536 536 537 <!-- 538 Used for backwards compatibility with older server installations 537 539 <plugin-definition id="LabeledExtractImporter"> 538 540 <about> … … 547 549 </settings> 548 550 </plugin-definition> 549 551 --> 552 <!-- 553 Used for backwards compatibility with older server installations 550 554 <plugin-definition id="HybridizationImporter"> 551 555 <about> … … 560 564 </settings> 561 565 </plugin-definition> 562 566 --> 567 <plugin-definition id="PhysicalBioAssayImporter"> 568 <about> 569 <name>Physical bioassay importer</name> 570 <description> 571 Imports and updates physical bioassays in a batch. 572 </description> 573 </about> 574 <plugin-class>net.sf.basedb.plugins.batchimport.PhysicalBioAssayImporter</plugin-class> 575 <settings> 576 <property name="everyone-use">1</property> 577 </settings> 578 </plugin-definition> 579 563 580 <plugin-definition id="ScanImporter"> 564 581 <about> -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/HybridizationImporter.java
r5642 r5649 44 44 import net.sf.basedb.core.SystemItems; 45 45 import net.sf.basedb.core.plugin.GuiContext; 46 import net.sf.basedb.core.query.Expressions; 47 import net.sf.basedb.core.query.Hql; 48 import net.sf.basedb.core.query.Restrictions; 46 49 import net.sf.basedb.util.parser.FlatFileParser; 47 50 import net.sf.basedb.util.parser.Mapper; … … 197 200 protected ItemQuery<PhysicalBioAssay> createItemQuery() 198 201 { 199 return PhysicalBioAssay.getQuery(); 202 ItemQuery<PhysicalBioAssay> query = PhysicalBioAssay.getQuery(); 203 query.restrictPermanent( 204 Restrictions.eq( 205 Hql.property("itemSubtype"), 206 Expressions.integer(SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION)) 207 ) 208 ); 209 return query; 200 210 } 201 211 … … 222 232 { 223 233 PhysicalBioAssay hyb = PhysicalBioAssay.getNew(dc); 234 hyb.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION))); 224 235 updateItem(dc, hyb, data); 225 236 return hyb; … … 289 300 { 290 301 String nameOrId = parentMapper.getValue(data); 291 Extract parent = findExtract(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId); 302 ItemSubtype type = ItemSubtype.getById(dc, SystemItems.getId(Extract.LABELED)); 303 Extract parent = findExtract(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type); 292 304 if (parent != null) 293 305 { -
trunk/src/test/TestItemImporter.java
r5648 r5649 136 136 // Import hybridizations 137 137 int hybFileId = TestFile.test_create("data/test.batchimport.hybridizations.txt", false, false); 138 int hybImporterId = TestPluginDefinition.test_get("net.sf.basedb.plugins.batchimport. HybridizationImporter");138 int hybImporterId = TestPluginDefinition.test_get("net.sf.basedb.plugins.batchimport.PhysicalBioAssayImporter"); 139 139 int hybJobId = test_create_item_import_job(Item.PHYSICALBIOASSAY, hybImporterId, hybFileId); 140 140 ok &= TestJob.test_execute(hybJobId, false); … … 359 359 if (itemType == Item.PHYSICALBIOASSAY) 360 360 { 361 request.setParameterValue("numArraysColumnMapping", "\\Num arrays\\"); 361 request.setParameterValue("subtypeColumnMapping", "Hybridization"); 362 request.setParameterValue("sizeColumnMapping", "\\Size\\"); 362 363 request.setParameterValue("protocolColumnMapping", "\\Protocol\\"); 363 request.setParameterValue("hardwareColumnMapping", "\\H yb station\\");364 request.setParameterValue("hardwareColumnMapping", "\\Hardware\\"); 364 365 request.setParameterValue("createdColumnMapping", "\\Created\\"); 365 366 request.setParameterValue("parentColumnMapping", "\\Parent\\"); 366 367 request.setParameterValue("usedQuantityColumnMapping", "\\Used quantity\\"); 367 request.setParameterValue(" arrayIndexColumnMapping", "\\Array index\\");368 request.setParameterValue("extractPositionColumnMapping", "\\Position\\"); 368 369 request.setParameterValue("arraySlideColumnMapping", "\\Array slide\\"); 369 370 } -
trunk/src/test/data/test.batchimport.hybridizations.txt
r4434 r5649 1 Name Description Num arrays Protocol Hyb station Array slide Created Parent Used quantity Array index1 Name Description Size Protocol Hardware Array slide Created Parent Used quantity Position 2 2 Hyb 1 The first 1 Hybridization Hybstation Slide 1.2 2008-01-01 Labeled 1.1 50 3 3 Hyb 1 Labeled 1.2 50 -
trunk/src/test/net/sf/basedb/test/roles/AdminTest.java
r5630 r5649 50 50 import net.sf.basedb.plugins.batchimport.BioSourceImporter; 51 51 import net.sf.basedb.plugins.batchimport.ExtractImporter; 52 import net.sf.basedb.plugins.batchimport.HybridizationImporter; 53 import net.sf.basedb.plugins.batchimport.LabeledExtractImporter; 52 import net.sf.basedb.plugins.batchimport.PhysicalBioAssayImporter; 54 53 import net.sf.basedb.plugins.batchimport.RawBioAssayImporter; 55 54 import net.sf.basedb.plugins.batchimport.SampleImporter; … … 116 115 plugins.add(PluginDefinition.getByClassName(dc, SampleImporter.class.getName())); 117 116 plugins.add(PluginDefinition.getByClassName(dc, ExtractImporter.class.getName())); 118 plugins.add(PluginDefinition.getByClassName(dc, LabeledExtractImporter.class.getName())); 119 plugins.add(PluginDefinition.getByClassName(dc, HybridizationImporter.class.getName())); 117 plugins.add(PluginDefinition.getByClassName(dc, PhysicalBioAssayImporter.class.getName())); 120 118 plugins.add(PluginDefinition.getByClassName(dc, ScanImporter.class.getName())); 121 119 plugins.add(PluginDefinition.getByClassName(dc, RawBioAssayImporter.class.getName())); -
trunk/src/test/net/sf/basedb/test/roles/UserTest.java
r5648 r5649 442 442 TestUtil.write("--Creating hybridization: " + name + "\n"); 443 443 PhysicalBioAssay hyb = PhysicalBioAssay.getNew(dc); 444 hyb.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION))); 444 445 hyb.setName(name); 445 446 hyb.setArraySlide(Util.findArraySlide(dc, arraySlideName)); -
trunk/www/views/physicalbioassays/edit_bioassay.jsp
r5642 r5649 35 35 import="net.sf.basedb.core.PhysicalBioAssay" 36 36 import="net.sf.basedb.core.BioMaterialEvent" 37 import="net.sf.basedb.core.ItemSubtype" 37 38 import="net.sf.basedb.core.ArraySlide" 38 39 import="net.sf.basedb.core.Protocol" … … 83 84 ItemQuery<Extract> extractsQuery = null; 84 85 86 boolean readCurrentSubtype = true; 87 int currentSubtypeId = 0; 85 88 boolean readCurrentArraySlide = true; 86 89 ArraySlide currentArraySlide = null; … … 123 126 title = "Create physical bioassay"; 124 127 cc.removeObject("item"); 128 currentSubtypeId = Values.getInt(request.getParameter("subtype_id")); 129 if (currentSubtypeId == 0) 130 { 131 int recentSubtypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0)); 132 currentSubtypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), recentSubtypeId); 133 } 125 134 if (cc.getPropertyFilter("creationEvent.protocol.name") != null) 126 135 { … … 162 171 { 163 172 pba = PhysicalBioAssay.getById(dc, itemId); 173 pba.checkPermission(Permission.WRITE); 164 174 creationEvent = pba.getCreationEvent(); 165 175 eventDate = creationEvent.getEventDate(); … … 167 177 title = "Edit physical bioassay -- " + HTML.encodeTags(pba.getName()); 168 178 name = pba.getName(); 179 180 try 181 { 182 ItemSubtype subtype = pba.getItemSubtype(); 183 if (subtype != null) currentSubtypeId = subtype.getId(); 184 } 185 catch (PermissionDeniedException ex) 186 { 187 readCurrentSubtype = false; 188 } 189 169 190 try 170 191 { … … 198 219 199 220 } 200 if (pba != null) pba.checkPermission(Permission.WRITE); 221 // Query to retrieve item types 222 final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType); 223 subtypesQuery.include(Include.ALL); 201 224 202 225 final String clazz = "class=\"text\""; … … 210 233 %> 211 234 <base:page type="popup" title="<%=title%>"> 212 <base:head scripts="tabcontrol.js,annotations.js,linkitems.js, ajax.js,json2.js" styles="tabcontrol.css">235 <base:head scripts="tabcontrol.js,annotations.js,linkitems.js,subtypes.js,ajax.js,json2.js" styles="tabcontrol.css"> 213 236 <ext:scripts context="<%=jspContext%>" /> 214 237 <ext:stylesheets context="<%=jspContext%>" /> … … 313 336 { 314 337 var frm = document.forms['bioassay']; 315 var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setProtocolCallback'; 338 var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone'; 339 url += '&callback=setProtocolCallback&resetTemporary=1'; 340 url += ItemSubtype.createRelatedFilter('bioassay', 'PROTOCOL'); 316 341 if (frm.protocol_id.length > 1) 317 342 { … … 319 344 url += '&item_id='+id; 320 345 } 321 url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Protocol.HYBRIDIZATION)%>';322 346 Main.openPopup(url, 'SelectProtocol', 1000, 700); 323 347 } … … 343 367 { 344 368 var frm = document.forms['bioassay']; 345 var url = '../../admin/hardware/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setHardwareCallback'; 369 var url = '../../admin/hardware/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone'; 370 url += '&callback=setHardwareCallback&resetTemporary=1'; 371 url += ItemSubtype.createRelatedFilter('bioassay', 'HARDWARE'); 346 372 if (frm.hardware_id.length > 1) 347 373 { … … 349 375 url += '&item_id='+id; 350 376 } 351 url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Hardware.HYBRIDIZATION_STATION)%>';352 377 Main.openPopup(url, 'SelectHardware', 1000, 700); 353 378 } … … 399 424 parentsChanged = true; 400 425 } 401 function update NumArrays(arraySlideId)426 function updateSize(arraySlideId) 402 427 { 403 428 var request = Ajax.getXmlHttpRequest(); … … 406 431 var url = '../../lims/arrayslides/ajax.jsp?ID=<%=ID%>&cmd=GetArrayDesign&item_id=' + arraySlideId; 407 432 request.open("GET", url, true); 408 Ajax.setReadyStateHandler(request, update NumArraysCallback);433 Ajax.setReadyStateHandler(request, updateSizeCallback); 409 434 request.send(null); 410 435 } 411 436 return request != null; 412 437 } 413 function update NumArraysCallback(request)438 function updateSizeCallback(request) 414 439 { 415 440 var frm = document.forms['bioassay']; … … 433 458 var excludes = ids.join(','); 434 459 435 var url = '../../biomaterials/extracts/index.jsp?ID=<%=ID%>&mode=selectmultiple&callback=addExtractCallback'; 460 var url = '../../biomaterials/extracts/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectmultiple'; 461 url += '&callback=addExtractCallback&resetTemporary=1'; 462 url += ItemSubtype.createRelatedFilter('bioassay', 'EXTRACT'); 436 463 url += '&exclude='+excludes; 437 464 Main.openPopup(url, 'AddExtracts', 1000, 700); … … 554 581 value="<%=name%>" 555 582 size="40" maxlength="<%=PhysicalBioAssay.MAX_NAME_LENGTH%>"></td> 583 </tr> 584 <tr valign="top"> 585 <td class="prompt">Type</td> 586 <td colspan="2"> 587 <select name="subtype_id" 588 <%=!readCurrentSubtype ? "disabled readonly class=\"disabled selectionlist\"" : "class=\"selectionlist\""%>> 589 <% 590 if (!readCurrentSubtype) 591 { 592 %> 593 <option value="-1">- denied - 594 <% 595 } 596 else 597 { 598 %> 599 <option value="0">-none- 600 <% 601 for (ItemSubtype subtype : subtypesQuery.list(dc)) 602 { 603 int id = subtype.getId(); 604 if (id != currentSubtypeId && subtype.isRemoved()) continue; 605 %> 606 <option value="<%=id == currentSubtypeId && pba != null ? -id : id%>" 607 <%=id == currentSubtypeId ? "selected" : ""%> 608 title="<%=HTML.encodeTags(subtype.getDescription()) %>" 609 ><%=HTML.encodeTags(subtype.getName())%> 610 <% 611 } 612 } 613 %> 614 </select> 615 </td> 556 616 </tr> 557 617 <tr> -
trunk/www/views/physicalbioassays/index.jsp
r5642 r5649 35 35 import="net.sf.basedb.core.Protocol" 36 36 import="net.sf.basedb.core.Hardware" 37 import="net.sf.basedb.core.ItemSubtype" 37 38 import="net.sf.basedb.core.ItemQuery" 38 39 import="net.sf.basedb.core.ItemResultIterator" … … 75 76 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 76 77 <%! 77 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name, extracts,arraySlide,scans,description");78 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,itemSubtype,extracts,arraySlide,scans,description"); 78 79 private static final Item itemType = Item.PHYSICALBIOASSAY; 79 80 … … 212 213 } 213 214 215 int subtypeId = Values.getInt(request.getParameter("subtype_id"), -1); 216 if (subtypeId >= 0) // < 0 = denied or unchanged 217 { 218 ItemSubtype subtype = subtypeId == 0 ? null : ItemSubtype.getById(dc, subtypeId); 219 pba.setItemSubtype(subtype); 220 if (subtype != null) cc.setRecent(subtype, maxRecent); 221 } 222 214 223 //Hardware 215 224 int hardwareId = Values.getInt(request.getParameter("hardware_id"), -1); -
trunk/www/views/physicalbioassays/list_bioassays.jsp
r5642 r5649 36 36 import="net.sf.basedb.core.AnnotationSet" 37 37 import="net.sf.basedb.core.Annotation" 38 import="net.sf.basedb.core.ItemSubtype" 38 39 import="net.sf.basedb.core.ItemQuery" 39 40 import="net.sf.basedb.core.Include" … … 94 95 { 95 96 final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType); 97 final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType); 96 98 97 99 // Query for extracts relatated to the current bioassay … … 254 256 exportable="true" 255 257 show="always" 258 /> 259 <tbl:columndef 260 id="itemSubtype" 261 property="itemSubtype" 262 sortproperty="itemSubtype.name" 263 exportproperty="itemSubtype.name" 264 datatype="int" 265 enumeration="<%=Enumeration.fromItems(subtypesQuery.list(dc), "-none-")%>" 266 title="Type" 267 sortable="true" 268 filterable="true" 269 exportable="true" 256 270 /> 257 271 <tbl:columndef … … 568 582 title="<%=tooltip%>"><%=name%></div></tbl:cell> 569 583 <tbl:cell column="id"><%=item.getId()%></tbl:cell> 584 <tbl:cell column="itemSubtype"><base:propertyvalue 585 item="<%=item%>" 586 property="itemSubtype" 587 enableEditLink="<%=mode.hasEditLink()%>" 588 enablePropertyLink="<%=mode.hasPropertyLink()%>" 589 /></tbl:cell> 570 590 <tbl:cell column="size"><%=item.getSize()%></tbl:cell> 571 591 <tbl:cell column="extracts"> -
trunk/www/views/physicalbioassays/view_bioassay.jsp
r5642 r5649 282 282 <td class="prompt">Name</td> 283 283 <td><%=HTML.encodeTags(pba.getName())%></td> 284 </tr> 285 <tr> 286 <td class="prompt">Type</td> 287 <td><base:propertyvalue item="<%=pba%>" property="itemSubtype" /></td> 284 288 </tr> 285 289 <tr>
Note: See TracChangeset
for help on using the changeset viewer.