Changeset 5648
- Timestamp:
- May 30, 2011, 12:31:51 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/BasicItem.java
r5590 r5648 284 284 for (Integer itemId : HibernateUtil.loadList(Integer.class, query, getSessionControl())) 285 285 { 286 using.add(new ItemProxy(itemId, itemType));286 if (itemId != null) using.add(new ItemProxy(itemId, itemType)); 287 287 } 288 288 } -
trunk/src/core/net/sf/basedb/core/Extract.java
r5643 r5648 200 200 throws BaseException 201 201 { 202 return /*countPhysicalBioAssays() > 0 || */super.isUsed();202 return super.isUsed(); 203 203 } 204 204 /** 205 205 Get all: 206 206 <ul> 207 <li>{@link PhysicalBio assay}:s created from this extract207 <li>{@link PhysicalBioAssay}:s created from this extract 208 208 <ul> 209 209 @since 2.2 … … 213 213 { 214 214 Set<ItemProxy> using = super.getUsingItems(); 215 // TODO 215 org.hibernate.Session session = getDbControl().getHibernateSession(); 216 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, 217 "GET_SOURCEEVENTS_FOR_BIOMATERIAL", "bme.physicalBioAssay.id"); 218 /* 219 SELECT {1} 220 FROM BioMaterialEventData bme 221 JOIN bme.sources src 222 WHERE index(src) = :bioMaterial 223 */ 224 query.setEntity("bioMaterial", this.getData()); 225 addUsingItems(using, Item.PHYSICALBIOASSAY, query); 216 226 return using; 217 227 } -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/AbstractItemImporter.java
r5647 r5648 1471 1471 @param dc The DbControl to use for database access 1472 1472 @param identifier The identifier protocol 1473 @param subtype The biosource subtype, or null if the type doesn't matter1473 @param subtype The sample subtype, or null if the type doesn't matter 1474 1474 @return A sample, or null if no item could be found 1475 1475 @since 3.0 … … 1486 1486 1487 1487 private ItemQuery<Extract> extractQuery; 1488 /** 1489 Same as {@link #findSample(DbControl, IdMethod, String, ItemSubtype)} 1490 with a null subtype. 1491 */ 1492 protected Extract findExtract(DbControl dc, IdMethod idMethod, String identifier) 1493 { 1494 return findExtract(dc, idMethod, identifier, null); 1495 } 1496 1488 1497 /** 1489 1498 Find an extract with a given identifier. This is a utility method that … … 1494 1503 Subsequent calls uses the same query. Thus, this method should always be 1495 1504 called with the same id method object, otherwise the result is undefined. 1496 1505 <p> 1506 NOTE! If this method is called with a non-null item subtype parameter and 1507 no extract is found the query will be retried without any subtype. 1508 1497 1509 @param dc The DbControl to use for database access 1498 1510 @param identifier The identifier protocol 1511 @param subtype The extract subtype, or null if the type doesn't matter 1499 1512 @return An extract, or null if no item could be found 1500 */ 1501 protected Extract findExtract(DbControl dc, IdMethod idMethod, String identifier) 1513 @since 3.0 1514 */ 1515 protected Extract findExtract(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype) 1502 1516 { 1503 1517 if (identifier == null) return null; 1504 1518 if (extractQuery == null) 1505 1519 { 1506 extractQuery = initReferenceQuery(dc, idMethod, Extract.getQuery(), false);1507 } 1508 return findReferencedItem (dc, idMethod, extractQuery, identifier, 0, false);1520 extractQuery = initReferenceQuery(dc, idMethod, Extract.getQuery(), true); 1521 } 1522 return findReferencedItemWithSubtype(dc, idMethod, extractQuery, identifier, subtype, false); 1509 1523 } 1510 1524 … … 1536 1550 ); 1537 1551 } 1538 return findReferencedItem(dc, idMethod, labeledExtractQuery, identifier, 0, false);1552 return findReferencedItem(dc, idMethod, labeledExtractQuery, identifier, SystemItems.getId(Extract.LABELED), false); 1539 1553 } 1540 1554 … … 1978 1992 T item = null; 1979 1993 Item itemType = query.getItemType(); 1980 String cacheKey = itemType.name() + ":" + identifier + ":" + subtypeId; 1981 if (itemCache.containsKey(cacheKey)) 1982 { 1983 item = (T)itemCache.get(cacheKey); 1994 String cacheKey1 = itemType.name() + ":" + identifier; 1995 String cacheKey2 = cacheKey1 + ":" + subtypeId; 1996 if (itemCache.containsKey(cacheKey2)) 1997 { 1998 item = (T)itemCache.get(cacheKey2); 1999 } 2000 else if (itemCache.containsKey(cacheKey1)) 2001 { 2002 item = (T)itemCache.get(cacheKey1); 1984 2003 } 1985 2004 else … … 2025 2044 item = accessibleItems.get(0); 2026 2045 } 2027 itemCache.put(cacheKey , item);2046 itemCache.put(cacheKey2, item); 2028 2047 } 2029 2048 } -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ExtractImporter.java
r5630 r5648 38 38 import net.sf.basedb.core.Sample; 39 39 import net.sf.basedb.core.SystemItems; 40 import net.sf.basedb.core.Tag; 40 41 import net.sf.basedb.core.plugin.GuiContext; 41 42 import net.sf.basedb.util.Values; … … 57 58 private static final Set<GuiContext> guiContexts = 58 59 Collections.singleton(new GuiContext(Item.EXTRACT, GuiContext.Type.LIST)); 59 60 61 protected static final PluginParameter<String> tagColumnMapping = new PluginParameter<String>( 62 "tagColumnMapping", 63 "Tag", 64 "Mapping that picks the name or ID of a tag from the data columns. The plug-in will first " + 65 "try to find a tag with the given name. If none is found and the value is numeric it will " + 66 "try to load by internal ID. " + 67 "Example: \\Tag\\", 68 optionalColumnMapping 69 ); 70 60 71 public ExtractImporter() 61 72 {} … … 80 91 private Mapper descriptionMapper; 81 92 private Mapper externalIdMapper; 93 private Mapper tagMapper; 82 94 private Mapper originalQuantityMapper; 83 95 private Mapper createdMapper; … … 106 118 } 107 119 120 @Override 121 protected Item getItemForSubtypes() 122 { 123 return Item.EXTRACT; 124 } 125 108 126 /** 109 127 Adds column mappings for name, externalId, description, … … 116 134 parameters.add(internalIdColumnMapping); 117 135 parameters.add(nameColumnMapping); 136 parameters.add(subtypeColumnMapping); 118 137 parameters.add(externalIdColumnMapping); 138 parameters.add(tagColumnMapping); 119 139 parameters.add(descriptionColumnMapping); 120 140 parameters.add(protocolColumnMapping); … … 149 169 externalIdMapper = getMapper(ffp, (String)job.getValue("externalIdColumnMapping"), 150 170 cropStrings ? Extract.MAX_EXTERNAL_ID_LENGTH : null, null); 171 tagMapper = getMapper(ffp, (String)job.getValue("tagColumnMapping"), null, null); 151 172 originalQuantityMapper = getMapper(ffp, (String)job.getValue("originalQuantityColumnMapping"), null, null); 152 173 createdMapper = getMapper(ffp, (String)job.getValue("createdColumnMapping"), null, null); … … 177 198 BioMaterialEvent creationEvent = extract.getCreationEvent(); 178 199 if (createdMapper != null) creationEvent.setEventDate(parseDate(createdMapper.getValue(data))); 200 updateItemSubtype(dc, extract, data); 179 201 if (pooledMapper != null) 180 202 { 181 203 extract.setPooled(Values.getBoolean(pooledMapper.getValue(data))); 182 204 } 205 206 if (tagMapper != null) 207 { 208 String nameOrId = tagMapper.getValue(data); 209 ItemSubtype type = ItemSubtype.getRelatedSubtype(dc, extract, Item.TAG, 0); 210 Tag tag = findTag(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type); 211 if (nameOrId == null || tag != null) extract.setTag(tag); 212 } 213 183 214 if (protocolMapper != null) 184 215 { 185 216 String nameOrId = protocolMapper.getValue(data); 186 ItemSubtype type = ItemSubtype.get ById(dc,217 ItemSubtype type = ItemSubtype.getRelatedSubtype(dc, extract, Item.PROTOCOL, 187 218 SystemItems.getId(extract.isPooled() ? Protocol.POOLING : Protocol.EXTRACTION)); 188 219 Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type); … … 206 237 { 207 238 String nameOrId = parentMapper.getValue(data); 208 Sample sample = findSample(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId); 239 ItemSubtype type = ItemSubtype.getRelatedSubtype(dc, extract, Item.SAMPLE, 0); 240 Sample sample = findSample(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type); 209 241 Float usedQuantity = usedQuantityMapper == null ? 210 242 null : usedQuantityMapper.getFloat(data); … … 228 260 { 229 261 String nameOrId = parentMapper.getValue(data); 230 Extract parent = findExtract(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId); 262 ItemSubtype type = ItemSubtype.getRelatedSubtype(dc, extract, Item.EXTRACT, 0); 263 Extract parent = findExtract(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type); 231 264 if (parent != null) 232 265 { … … 234 267 null : usedQuantityMapper.getFloat(data); 235 268 extract.getCreationEvent().addSource(parent, usedQuantity); 269 // Use same tag as parent if not yet set and not mapped in the file 270 if (tagMapper == null && parent.getTag() != null && extract.getTag() == null) 271 { 272 extract.setTag(parent.getTag()); 273 } 236 274 } 237 275 } -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/LabeledExtractImporter.java
r5641 r5648 148 148 149 149 /** 150 Calls {@link Extract#getQuery()}. 150 Calls {@link Extract#getQuery()} and set a subtype filter for 151 {@link Extract#LABELED}. 151 152 */ 152 153 @Override … … 187 188 protected Extract createItem(DbControl dc, FlatFileParser.Data data) 188 189 { 189 Tag label = null;190 if (labelMapper != null)191 {192 ItemSubtype labelType = ItemSubtype.getById(dc, SystemItems.getId(Tag.LABEL));193 label = findTag(dc, FallbackIdMethod.NAME_OR_ID, labelMapper.getValue(data), labelType);194 }195 if (label == null)196 {197 // If pooled, try to get the label from the first parent198 if (pooledMapper != null && parentMapper != null &&199 Values.getBoolean(pooledMapper.getValue(data)))200 {201 Extract parent = findLabeledExtract(dc, FallbackIdMethod.NAME_OR_ID, parentMapper.getValue(data));202 if (parent != null) label = parent.getTag();203 }204 }205 190 Extract e = Extract.getNew(dc); 206 e.set Tag(label);191 e.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(Extract.LABELED))); 207 192 updateItem(dc, e, data); 208 193 return e; … … 230 215 if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol); 231 216 } 232 if (labelMapper != null && extract.isInDatabase()) 217 218 if (labelMapper != null) 233 219 { 234 220 String nameOrId = labelMapper.getValue(data); 235 if (nameOrId != null) 236 { 237 ItemSubtype labelType = ItemSubtype.getById(dc, SystemItems.getId(Tag.LABEL)); 238 Tag label = findTag(dc, FallbackIdMethod.NAME_OR_ID, labelMapper.getValue(data), labelType); 239 extract.setTag(label); 240 } 241 } 221 ItemSubtype labelType = ItemSubtype.getById(dc, SystemItems.getId(Tag.LABEL)); 222 Tag label = findTag(dc, FallbackIdMethod.NAME_OR_ID, labelMapper.getValue(data), labelType); 223 if (nameOrId == null || label != null) extract.setTag(label); 224 } 225 242 226 if (bioPlateMapper != null && bioWellRowMapper != null && bioWellColMapper != null) 243 227 { … … 285 269 null : usedQuantityMapper.getFloat(data); 286 270 extract.getCreationEvent().addSource(parent, usedQuantity); 271 // Use same tag as parent if not yet set and not mapped in the file 272 if (labelMapper == null && parent.getTag() != null && extract.getTag() == null) 273 { 274 extract.setTag(parent.getTag()); 275 } 287 276 } 288 277 } -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/SampleImporter.java
r5647 r5648 295 295 if (createdMapper != null) creationEvent.setEventDate(parseDate(createdMapper.getValue(data))); 296 296 updateItemSubtype(dc, sample, data); 297 if (pooledMapper != null) 298 { 299 sample.setPooled(Values.getBoolean(pooledMapper.getValue(data))); 300 } 297 301 if (protocolMapper != null) 298 302 { … … 315 319 } 316 320 } 317 if (pooledMapper != null)318 {319 sample.setPooled(Values.getBoolean(pooledMapper.getValue(data)));320 }321 321 if (!sample.isPooled()) 322 322 { -
trunk/src/test/TestItemImporter.java
r5642 r5648 104 104 // Import labeled extracts 105 105 int labledExtractFileId = TestFile.test_create("data/test.batchimport.labeledextracts.txt", false, false); 106 int labledExtractImporterId = TestPluginDefinition.test_get("net.sf.basedb.plugins.batchimport.LabeledExtractImporter");106 int labledExtractImporterId = extractImporterId; 107 107 int labledExtractJobId = test_create_item_import_job(Item.EXTRACT, labledExtractImporterId, labledExtractFileId); 108 108 ok &= TestJob.test_execute(labledExtractJobId, false); … … 353 353 if (file.getName().contains("labeledextracts")) 354 354 { 355 request.setParameterValue("labelColumnMapping", "\\Label\\"); 355 request.setParameterValue("tagColumnMapping", "\\Label\\"); 356 request.setParameterValue("subtypeColumnMapping", "Labeled extract"); 357 request.setParameterValue("pooledColumnMapping", "1"); 356 358 } 357 359 if (itemType == Item.PHYSICALBIOASSAY) -
trunk/src/test/net/sf/basedb/test/roles/UserTest.java
r5642 r5648 37 37 import net.sf.basedb.core.File; 38 38 import net.sf.basedb.core.FileParameterType; 39 import net.sf.basedb.core.ItemSubtype; 39 40 import net.sf.basedb.core.PhysicalBioAssay; 40 41 import net.sf.basedb.core.Include; … … 411 412 412 413 Extract labeledExtract = Extract.getNew(dc); 414 labeledExtract.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(Extract.LABELED))); 413 415 labeledExtract.setName(name); 414 416 labeledExtract.setOriginalQuantity(100.0f); -
trunk/www/biomaterials/extracts/edit_extract.jsp
r5630 r5648 34 34 import="net.sf.basedb.core.Sample" 35 35 import="net.sf.basedb.core.Extract" 36 import="net.sf.basedb.core.ItemSubtype" 37 import="net.sf.basedb.core.Tag" 36 38 import="net.sf.basedb.core.BioMaterialEvent" 37 39 import="net.sf.basedb.core.BioPlate" … … 85 87 WellCoordinateFormatter columnFormatter = new WellCoordinateFormatter(false); 86 88 89 boolean readCurrentSubtype = true; 90 int currentSubtypeId = 0; 87 91 boolean readCurrentProtocol = true; 88 92 Protocol currentProtocol = null; 89 93 Protocol defaultProtocol = null; 94 boolean readCurrentTag = true; 95 Tag currentTag = null; 90 96 boolean readCurrentSample = true; 91 97 Sample currentSample = null; … … 103 109 List<Sample> recentSamples = (List<Sample>)cc.getRecent(dc, Item.SAMPLE); 104 110 List<BioPlate> recentBioPlates = (List<BioPlate>)cc.getRecent(dc, Item.BIOPLATE); 111 List<Tag> recentTags = (List<Tag>)cc.getRecent(dc, Item.TAG); 105 112 106 113 int activeProjectId = sc.getActiveProjectId(); … … 125 132 currentProtocol = Base.getFirstMatching(dc, Protocol.getQuery(), "name", cc.getPropertyFilter("creationEvent.protocol.name")); 126 133 } 134 if (cc.getPropertyFilter("tag.name") != null) 135 { 136 currentTag = Base.getFirstMatching(dc, Tag.getQuery(), "name", cc.getPropertyFilter("tag.name")); 137 } 138 currentSubtypeId = Values.getInt(request.getParameter("subtype_id")); 139 if (currentSubtypeId == 0) 140 { 141 int recentSubtypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0)); 142 currentSubtypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), recentSubtypeId); 143 } 127 144 int sampleId = Values.getInt(request.getParameter("sample_id")); 128 145 if (sampleId != 0) … … 147 164 { 148 165 extract = Extract.getById(dc, itemId); 166 extract.checkPermission(Permission.WRITE); 149 167 cc.setObject("item", extract); 150 168 title = "Edit extract -- " + HTML.encodeTags(extract.getName()); … … 158 176 try 159 177 { 178 ItemSubtype subtype = extract.getItemSubtype(); 179 if (subtype != null) currentSubtypeId = subtype.getId(); 180 } 181 catch (PermissionDeniedException ex) 182 { 183 readCurrentSubtype = false; 184 } 185 186 try 187 { 160 188 currentProtocol = creationEvent.getProtocol(); 161 189 } … … 165 193 } 166 194 195 try 196 { 197 currentTag = extract.getTag(); 198 } 199 catch (PermissionDeniedException ex) 200 { 201 readCurrentTag = false; 202 } 203 167 204 try 168 205 { … … 195 232 196 233 } 197 if (extract != null && !extract.hasPermission(Permission.WRITE)) 198 { 199 throw new PermissionDeniedException(Permission.WRITE, itemType.toString()); 200 } 234 235 // Query to retrieve item types 236 final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType); 237 subtypesQuery.include(Include.ALL); 238 201 239 final String clazz = "class=\"text\""; 202 240 final String requiredClazz = "class=\"text required\""; … … 209 247 %> 210 248 <base:page type="popup" title="<%=title%>"> 211 <base:head scripts="tabcontrol.js,annotations.js,linkitems.js " styles="tabcontrol.css">249 <base:head scripts="tabcontrol.js,annotations.js,linkitems.js,subtypes.js,ajax.js,json2.js" styles="tabcontrol.css"> 212 250 <ext:scripts context="<%=jspContext%>" /> 213 251 <ext:stylesheets context="<%=jspContext%>" /> … … 309 347 { 310 348 var frm = document.forms['extract']; 311 var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setProtocolCallback'; 349 var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone'; 350 url += '&callback=setProtocolCallback&resetTemporary=1'; 351 url += ItemSubtype.createRelatedFilter('extract', 'PROTOCOL', <%=SystemItems.getId(Protocol.EXTRACTION)%>); 312 352 if (frm.protocol_id.length > 1) 313 353 { … … 315 355 url += '&item_id='+id; 316 356 } 317 url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Protocol.EXTRACTION)%>';318 357 Main.openPopup(url, 'SelectProtocol', 1000, 700); 319 358 } … … 334 373 { 335 374 protocolChanged = true; 375 } 376 function selectTagOnClick() 377 { 378 var frm = document.forms['extract']; 379 var url = '../tags/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone'; 380 url += '&callback=setTagCallback&resetTemporary=1'; 381 url += ItemSubtype.createRelatedFilter('extract', 'TAG'); 382 if (frm.tag_id.length > 1) 383 { 384 var id = Math.abs(parseInt(frm.tag_id[1].value)); 385 url += '&item_id='+id; 386 } 387 Main.openPopup(url, 'SelectTag', 1000, 700); 388 } 389 function setTagCallback(id, name) 390 { 391 var frm = document.forms['extract']; 392 var list = frm.tag_id; 393 if (list.length < 2 || list[1].value == '0') // > 394 { 395 Forms.addListOption(list, 1, new Option()); 396 } 397 list[1].value = id; 398 list[1].text = name; 399 list.selectedIndex = 1; 336 400 } 337 401 function selectBioPlateOnClick() … … 446 510 return; 447 511 } 448 var url = '../samples/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setSampleCallback'; 512 var url = '../samples/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone'; 513 url += '&callback=setSampleCallback&resetTemporary=1'; 514 url += ItemSubtype.createRelatedFilter('extract', 'SAMPLE'); 449 515 if (frm.sample_id.length > 1) 450 516 { … … 476 542 return; 477 543 } 478 Main.openPopup('index.jsp?ID=<%=ID%>&mode=selectmultiple&callback=addExtractCallback', 'AddExtracts', 1000, 700); 544 var url = 'index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectmultiple'; 545 url += '&callback=addExtractCallback&resetTemporary=1'; 546 url += ItemSubtype.createRelatedFilter('extract', 'EXTRACT'); 547 Main.openPopup(url, 'AddExtracts', 1000, 700); 479 548 } 480 549 … … 595 664 value="<%=HTML.encodeTags(name)%>" 596 665 size="40" maxlength="<%=Extract.MAX_NAME_LENGTH%>"></td> 666 </tr> 667 <tr valign="top"> 668 <td class="prompt">Type</td> 669 <td colspan="2"> 670 <select name="subtype_id" 671 <%=!readCurrentSubtype ? "disabled readonly class=\"disabled selectionlist\"" : "class=\"selectionlist\""%>> 672 <% 673 if (!readCurrentSubtype) 674 { 675 %> 676 <option value="-1">- denied - 677 <% 678 } 679 else 680 { 681 %> 682 <option value="0">-none- 683 <% 684 for (ItemSubtype subtype : subtypesQuery.list(dc)) 685 { 686 int id = subtype.getId(); 687 if (id != currentSubtypeId && subtype.isRemoved()) continue; 688 %> 689 <option value="<%=id == currentSubtypeId && extract != null ? -id : id%>" 690 <%=id == currentSubtypeId ? "selected" : ""%> 691 title="<%=HTML.encodeTags(subtype.getDescription()) %>" 692 ><%=HTML.encodeTags(subtype.getName())%> 693 <% 694 } 695 } 696 %> 697 </select> 698 </td> 699 </tr> 700 <tr> 701 <td class="prompt">Tag</td> 702 <td> 703 <base:select 704 id="tag_id" 705 clazz="selectionlist" 706 required="false" 707 current="<%=currentTag%>" 708 denied="<%=!readCurrentTag%>" 709 recent="<%=recentTags%>" 710 newitem="<%=extract == null%>" 711 onselect="selectTagOnClick()" 712 /> 713 </td> 597 714 </tr> 598 715 <tr> -
trunk/www/biomaterials/extracts/index.jsp
r5642 r5648 35 35 import="net.sf.basedb.core.BioWell" 36 36 import="net.sf.basedb.core.Protocol" 37 import="net.sf.basedb.core.Tag" 37 38 import="net.sf.basedb.core.PhysicalBioAssay" 39 import="net.sf.basedb.core.ItemSubtype" 38 40 import="net.sf.basedb.core.ItemQuery" 39 41 import="net.sf.basedb.core.ItemResultIterator" … … 77 79 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 78 80 <%! 79 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name, originalQuantity,remainingQuantity,physicalBioAssays,description");81 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,itemSubtype,originalQuantity,remainingQuantity,physicalBioAssays,description"); 80 82 private static final Item itemType = Item.EXTRACT; 81 83 … … 243 245 } 244 246 247 int subtypeId = Values.getInt(request.getParameter("subtype_id"), -1); 248 if (subtypeId >= 0) // < 0 = denied or unchanged 249 { 250 ItemSubtype subtype = subtypeId == 0 ? null : ItemSubtype.getById(dc, subtypeId); 251 extract.setItemSubtype(subtype); 252 if (subtype != null) cc.setRecent(subtype, maxRecent); 253 } 254 255 int tagId = Values.getInt(request.getParameter("tag_id"), -1); 256 if (tagId >= 0) // < 0 = denied or unchanged 257 { 258 Tag tag = tagId == 0 ? null : Tag.getById(dc, tagId); 259 extract.setTag(tag); 260 if (tag != null) cc.setRecent(tag, maxRecent); 261 } 262 245 263 int biowellId = Values.getInt(request.getParameter("biowell_id"), -1); 246 264 if (biowellId >= 0) // < 0 = denied or unchanged -
trunk/www/biomaterials/extracts/list_extracts.jsp
r5642 r5648 34 34 import="net.sf.basedb.core.BioMaterialEvent" 35 35 import="net.sf.basedb.core.BioWell" 36 import="net.sf.basedb.core.ItemSubtype" 36 37 import="net.sf.basedb.core.AnnotationType" 37 38 import="net.sf.basedb.core.AnnotationSet" … … 99 100 { 100 101 final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType); 102 final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType); 101 103 final boolean createBioAssayPermission = sc.hasPermission(Permission.CREATE, Item.PHYSICALBIOASSAY); 102 104 … … 291 293 exportable="true" 292 294 show="always" 295 /> 296 <tbl:columndef 297 id="itemSubtype" 298 property="itemSubtype" 299 sortproperty="itemSubtype.name" 300 exportproperty="itemSubtype.name" 301 datatype="int" 302 enumeration="<%=Enumeration.fromItems(subtypesQuery.list(dc), "-none-")%>" 303 title="Type" 304 sortable="true" 305 filterable="true" 306 exportable="true" 293 307 /> 294 308 <tbl:columndef … … 704 718 title="<%=tooltip%>"><%=name%></div></tbl:cell> 705 719 <tbl:cell column="id"><%=item.getId()%></tbl:cell> 720 <tbl:cell column="itemSubtype"><base:propertyvalue 721 item="<%=item%>" 722 property="itemSubtype" 723 enableEditLink="<%=mode.hasEditLink()%>" 724 enablePropertyLink="<%=mode.hasPropertyLink()%>" 725 /></tbl:cell> 706 726 <tbl:cell column="externalId"><%=HTML.encodeTags(item.getExternalId())%></tbl:cell> 707 727 <tbl:cell column="originalQuantity"><%=Values.formatNumber(item.getOriginalQuantity(), 2)%></tbl:cell> -
trunk/www/biomaterials/extracts/view_extract.jsp
r5642 r5648 296 296 </tr> 297 297 <tr> 298 <td class="prompt">Type</td> 299 <td><base:propertyvalue item="<%=extract%>" property="itemSubtype" /></td> 300 </tr> 301 <tr> 298 302 <td class="prompt">External ID</td> 299 303 <td><%=HTML.encodeTags(extract.getExternalId())%></td> -
trunk/www/biomaterials/samples/edit_sample.jsp
r5645 r5648 340 340 url += '&item_id='+id; 341 341 } 342 url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Protocol.SAMPLING)%>';343 342 Main.openPopup(url, 'SelectProtocol', 1000, 700); 344 343 } … … 473 472 var url = '../biosources/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone'; 474 473 url += '&callback=setBioSourceCallback&resetTemporary=1'; 475 ItemSubtype.createRelatedFilter('sample', 'BIOSOURCE');474 url += ItemSubtype.createRelatedFilter('sample', 'BIOSOURCE'); 476 475 if (frm.biosource_id.length > 1) 477 476 {
Note: See TracChangeset
for help on using the changeset viewer.