Changeset 5120
- Timestamp:
- Oct 8, 2009, 2:30:00 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/Annotation.java
r5056 r5120 194 194 } 195 195 196 /** 197 Get the date and time the values in this annotation was last 198 updated. 199 @since 2.14 200 */ 201 public Date getLastUpdate() 202 { 203 return DateUtil.copy(getData().getLastUpdate()); 204 } 205 196 206 /** 197 207 Check if this annotation belongs to the primaray annotations for a specified annotation set. -
trunk/src/core/net/sf/basedb/core/AnnotationSet.java
r5118 r5120 23 23 package net.sf.basedb.core; 24 24 25 import java.io.Serializable; 26 import java.util.ArrayList; 25 27 import java.util.Collections; 26 28 import java.util.Date; … … 35 37 import net.sf.basedb.core.query.Restrictions; 36 38 import net.sf.basedb.core.query.Hql; 39 import net.sf.basedb.core.snapshot.AnnotationSetSnapshot; 40 import net.sf.basedb.core.snapshot.AnnotationSnapshot; 41 import net.sf.basedb.core.snapshot.SnapshotManager; 37 42 38 43 import net.sf.basedb.core.data.AnnotationData; … … 40 45 import net.sf.basedb.core.data.AnnotationTypeData; 41 46 import net.sf.basedb.util.AnnotationUtil; 47 import net.sf.basedb.util.StaticCache; 42 48 import net.sf.basedb.util.filter.Filter; 43 49 … … 797 803 } 798 804 805 /** 806 Create a new annotation snapshot for the given annotation set. 807 NOTE! This method will create a new snapshot from the database. 808 Snapshots can be cached as files which are much quicker to load. 809 It is recommended that {@link SnapshotManager#getSnapshot(int)} 810 is used instead of this method. 811 812 @param dc A DbControl to use for database access 813 @param annotationSetId The ID of the annotation set 814 @return A snapshot, or null if the annotation set with the given 815 id doens't exist 816 @since 2.14 817 */ 818 public static AnnotationSetSnapshot createSnapshot(DbControl dc, int annotationSetId) 819 { 820 821 AnnotationSetData set = HibernateUtil.loadData(dc.getHibernateSession(), AnnotationSetData.class, annotationSetId); 822 if (set == null) return null; 823 824 AnnotationSetSnapshot snapshot = new AnnotationSetSnapshot(); 825 snapshot.init(set); 826 return snapshot; 827 } 828 829 799 830 private static class QueryRuntimeFilterImpl 800 831 implements QueryRuntimeFilter -
trunk/www/views/experiments/view_experiment.jsp
r5117 r5120 57 57 import="net.sf.basedb.clients.web.util.HTML" 58 58 import="net.sf.basedb.util.Values" 59 import="net.sf.basedb.core.snapshot.SnapshotManager" 60 import="net.sf.basedb.core.snapshot.AnnotationSetSnapshot" 61 import="net.sf.basedb.core.snapshot.AnnotationSnapshot" 59 62 import="net.sf.basedb.util.formatter.Formatter" 60 63 import="net.sf.basedb.clients.web.formatter.FormatterFactory" … … 545 548 else 546 549 { 550 long time = 0; 547 551 %> 548 552 <base:section … … 582 586 <tbl:rows> 583 587 <% 588 time -= System.currentTimeMillis(); 589 SnapshotManager manager = new SnapshotManager(); 584 590 for (RawBioAssay item : rawBioAssays) 585 591 { 592 //System.out.println("processing rba: " + item); 586 593 AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null; 594 //System.out.println("got annotation set: " + as); 595 AnnotationSetSnapshot snapshot = as == null ? null : manager.getSnapshot(dc, as.getId()); 596 //System.out.println("got snapshot: " + snapshot); 587 597 %> 588 598 <tbl:row> … … 600 610 601 611 String value = "<i>- none -</i>"; 602 List<Annotation> all = as == null ? null : as.findAnnotations(dc, at, true); 612 //System.out.println("load annotations: " + at); 613 List<AnnotationSnapshot> all = snapshot == null ? 614 null : manager.findAnnotations(dc, snapshot, at, true); 615 //System.out.println("loaded annotations: " + at); 603 616 Map<Annotatable, List> factorValues = new HashMap<Annotatable, List>(); 604 617 if (all != null && all.size() > 0) 605 618 { 606 for (Annotation a : all)619 for (AnnotationSnapshot a : all) 607 620 { 608 621 List values = a.getValues(); … … 612 625 try 613 626 { 614 aItem = a.getAnnotationSet().getItem(); 627 //System.out.println("load item: "+ a.getItemType() + a.getItemId()); 628 aItem = a.getItem(dc); 629 //System.out.println("loaded item: "+ a.getItemType() + a.getItemId()); 615 630 } 616 631 catch (Throwable t) … … 653 668 <% 654 669 } 670 time += System.currentTimeMillis(); 655 671 %> 656 672 </tbl:rows> 657 673 </tbl:data> 658 674 </tbl:table> 675 <%=time %> ms 659 676 </base:section> 660 677 <%
Note: See TracChangeset
for help on using the changeset viewer.