Changeset 4057
- Timestamp:
- Dec 13, 2007, 1:45:00 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/CellValue.java
r3675 r4057 23 23 */ 24 24 package net.sf.basedb.clients.web.taglib.table; 25 26 import java.util.List;27 25 28 26 import javax.servlet.jsp.JspException; … … 97 95 */ 98 96 private Object value = null; 99 private List<?> list = null;97 private Iterable<?> list = null; 100 98 private String separator = "; "; 101 99 … … 113 111 } 114 112 115 public void setList( List<?> list)113 public void setList(Iterable<?> list) 116 114 { 117 115 this.list = list; 118 116 } 119 117 120 public List<?> getList()118 public Iterable<?> getList() 121 119 { 122 120 return list; … … 151 149 theSeparator = separator; 152 150 } 153 if (list != null && list.size() > 0)151 if (list != null) 154 152 { 155 153 for (Object o : list) -
trunk/src/core/net/sf/basedb/core/AnnotationRestriction.java
r3857 r4057 191 191 192 192 sqlQuery = HibernateUtil.createSqlQuery(session, sql); 193 sqlQuery.addScalar(" annotationset_id", org.hibernate.Hibernate.INTEGER);193 sqlQuery.addScalar("sid", org.hibernate.Hibernate.INTEGER); 194 194 if (debugSqlEnabled) logSql.debug("Executing annotation query: " + sql); 195 195 List<Integer> ids = HibernateUtil.loadList(Integer.class, sqlQuery, sc); -
trunk/src/core/net/sf/basedb/core/PropertyFilter.java
r3679 r4057 189 189 property before proceeding. 190 190 <p> 191 If the property starts with a # it is a filter on annotations. The rest of191 If the property starts with a # or ## it is a filter on annotations. The rest of 192 192 the property is the ID of the annotation type, and we use a 193 {@link AnnotationSimpleRestriction} object for the restriction. 193 {@link AnnotationSimpleRestriction} object for the restriction. If there 194 is only one # in the prefix only direct annotations are searched, if there 195 are two ##, inherited annotations are also searched. 194 196 <p> 195 197 If the property starts with a @ the property is a collection of values and … … 227 229 { 228 230 // Property is id of annotation type: #id 229 int annotationTypeId = (Integer)Type.INT.parseString(property.substring(1)); 231 // If prefixed with two ## inherited annotations should be searched 232 boolean searchInherited = property.startsWith("##"); 233 int annotationTypeId = (Integer)Type.INT.parseString(property.substring(searchInherited ? 2 : 1)); 230 234 restriction = new AnnotationSimpleRestriction(alias, annotationTypeId, getValueType(), 231 getOperator(), getValueAsObject(), false);235 getOperator(), getValueAsObject(), searchInherited); 232 236 } 233 237 else -
trunk/www/views/experiments/bioassays/list_bioassays.jsp
r3679 r4057 88 88 ItemResultIterator<BioAssay> bioAssays = null; 89 89 ItemResultList<AnnotationType> annotationTypes = null; 90 ItemResultList<AnnotationType> experimentalFactors = null; 90 91 try 91 92 { … … 93 94 final BioAssaySet bioAssaySet = BioAssaySet.getById(dc, bioAssaySetId); 94 95 final Experiment experiment = bioAssaySet.getExperiment(); 96 final ItemQuery<AnnotationType> experimentalFactorQuery = experiment.getExperimentalFactors(); 97 experimentalFactorQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS); 95 98 final int experimentId = experiment.getId(); 96 99 final RawDataType rawDataType = experiment.getRawDataType(); … … 108 111 Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); 109 112 annotationTypes = annotationTypeQuery.list(dc); 113 experimentalFactors = experimentalFactorQuery.list(dc); 110 114 try 111 115 { 112 116 final ItemQuery<BioAssay> query = Base.getConfiguredQuery(cc, true, bioAssaySet.getBioAssays(), mode); 117 query.join(Hql.leftJoin("rawParents", "rba")); 113 118 bioAssays = query.iterate(dc); 114 119 } 115 120 catch (Throwable t) 116 121 { 122 t.printStackTrace(); 117 123 cc.setMessage(t.getMessage()); 118 124 } 119 125 int numListed = 0; 120 126 %> 121 <base:page title="<%=title%>" type="<%=mode.getPageType()%>"> 127 <%@page import="net.sf.basedb.util.BioAssaySetUtil"%> 128 <base:page title="<%=title%>" type="<%=mode.getPageType()%>"> 122 129 <base:head scripts="table.js,tabcontrol.js" styles="table.css,headertabcontrol.css,path.css"> 123 130 <script language="JavaScript"> … … 292 299 title="<%=HTML.encodeTags(at.getName())+" [A]"%>" 293 300 property="<%="#"+at.getId()%>" 301 annotation="true" 302 datatype="<%=at.getValueType().getStringValue()%>" 303 enumeration="<%=annotationEnum%>" 304 sortable="false" 305 filterable="true" 306 exportable="true" 307 formatter="<%=formatter%>" 308 /> 309 <% 310 } 311 %> 312 <% 313 for (AnnotationType at : experimentalFactors) 314 { 315 Enumeration<String, String> annotationEnum = null; 316 Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); 317 if (at.isEnumeration()) 318 { 319 annotationEnum = new Enumeration<String, String>(); 320 List<?> values = at.getValues(); 321 for (Object value : values) 322 { 323 String encoded = formatter.format(value); 324 annotationEnum.add(encoded, encoded); 325 } 326 } 327 %> 328 <tbl:columndef 329 id="<%="ef"+at.getId()%>" 330 title="<%=HTML.encodeTags(at.getName())+" [EF]"%>" 331 property="<%="$rba.##"+at.getId()%>" 294 332 annotation="true" 295 333 datatype="<%=at.getValueType().getStringValue()%>" … … 484 522 } 485 523 } 524 for (AnnotationType at : experimentalFactors) 525 { 526 %> 527 <tbl:cell column="<%="ef"+at.getId()%>" 528 ><tbl:cellvalue 529 list="<%=BioAssaySetUtil.getAnnotationValues(dc, item, at)%>" 530 /></tbl:cell> 531 <% 532 } 486 533 %> 487 534 <tbl:cell column="tools"> -
trunk/www/views/experiments/bioassays/view_bioassay.jsp
r3679 r4057 36 36 import="net.sf.basedb.core.BioAssay" 37 37 import="net.sf.basedb.core.RawBioAssay" 38 import="net.sf.basedb.core.Annotatable" 39 import="net.sf.basedb.core.AnnotationSet" 40 import="net.sf.basedb.core.AnnotationType" 41 import="net.sf.basedb.core.Annotation" 38 42 import="net.sf.basedb.core.ItemQuery" 39 43 import="net.sf.basedb.core.ItemResultList" … … 45 49 import="net.sf.basedb.core.query.Orders" 46 50 import="net.sf.basedb.core.query.Hql" 51 import="net.sf.basedb.util.formatter.Formatter" 52 import="net.sf.basedb.clients.web.formatter.FormatterFactory" 47 53 import="net.sf.basedb.clients.web.Base" 48 54 import="net.sf.basedb.clients.web.PermissionUtil" … … 50 56 import="net.sf.basedb.util.Values" 51 57 import="java.util.Map" 58 import="java.util.List" 59 import="java.util.HashMap" 60 import="java.util.LinkedList" 52 61 %> 53 62 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> … … 214 223 title="Description" 215 224 /> 225 <% 226 ItemQuery<AnnotationType> efQuery = experiment.getExperimentalFactors(); 227 efQuery.include(Include.ALL); 228 efQuery.order(Orders.asc(Hql.property("name"))); 229 ItemResultList<AnnotationType> experimentalFactors = efQuery.list(dc); 230 for (AnnotationType at : experimentalFactors) 231 { 232 Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); 233 %> 234 <tbl:columndef 235 id="<%="at"+at.getId()%>" 236 title="<%=HTML.encodeTags(at.getName())%>" 237 formatter="<%=formatter%>" 238 /> 239 <% 240 } 241 %> 216 242 <tbl:data> 217 243 <tbl:columns> … … 226 252 <tbl:cell column="spots"><%=item.getSpots()%></tbl:cell> 227 253 <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> 254 <% 255 AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null; 256 for (AnnotationType at : experimentalFactors) 257 { 258 String value = "<i>- none -</i>"; 259 List<Annotation> all = as == null ? null : as.findAnnotations(dc, at, true); 260 Map<Annotatable, List> factorValues = new HashMap<Annotatable, List>(); 261 if (all != null && all.size() > 0) 262 { 263 for (Annotation a : all) 264 { 265 List values = a.getValues(); 266 Annotatable aItem = null; 267 try 268 { 269 aItem = a.getAnnotationSet().getItem(); 270 } 271 catch (Throwable t) 272 {} 273 List toAdd = factorValues.get(aItem); 274 if (toAdd == null) 275 { 276 toAdd = new LinkedList(); 277 factorValues.put(aItem, toAdd); 278 } 279 toAdd.addAll(values); 280 } 281 } 282 %> 283 <tbl:cell column="<%="at"+at.getId()%>" 284 > 285 <% 286 for (Map.Entry<Annotatable, List> entry : factorValues.entrySet()) 287 { 288 Annotatable aItem = entry.getKey(); 289 List values = entry.getValue(); 290 %> 291 <tbl:cellvalue list="<%=values%>" /> 292 <% 293 if (aItem != null && aItem.hasPermission(Permission.WRITE)) 294 { 295 %>: <base:icon image="edit.gif" 296 onclick="<%="editInheritedAnnotation('"+aItem.getType().name()+"',"+aItem.getId()+","+at.getId()+")"%>" 297 tooltip="Modify the values of this experimental factor" /> 298 <% 299 } 300 } 301 %> 302 </tbl:cell> 303 <% 304 } 305 %> 228 306 </tbl:row> 229 307 <%
Note: See TracChangeset
for help on using the changeset viewer.