Changeset 6567
- Timestamp:
- Oct 21, 2014, 10:00:30 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/plugins/SimpleExport.java
r6319 r6567 23 23 24 24 import net.sf.basedb.core.Annotatable; 25 import net.sf.basedb.core.Annotation;26 import net.sf.basedb.core.AnnotationSet;27 25 import net.sf.basedb.core.BasicItem; 28 26 import net.sf.basedb.core.BooleanParameterType; … … 44 42 import net.sf.basedb.core.Type; 45 43 import net.sf.basedb.core.Unit; 46 47 44 import net.sf.basedb.core.Job.ExecutionTime; 48 45 import net.sf.basedb.core.data.BasicData; … … 66 63 import net.sf.basedb.core.signal.SignalTarget; 67 64 import net.sf.basedb.core.signal.ThreadSignalHandler; 65 import net.sf.basedb.core.snapshot.AnnotationSetSnapshot; 66 import net.sf.basedb.core.snapshot.AnnotationSnapshot; 67 import net.sf.basedb.core.snapshot.AnnotationTypeFilter; 68 import net.sf.basedb.core.snapshot.SnapshotManager; 68 69 import net.sf.basedb.util.Enumeration; 69 70 import net.sf.basedb.util.Values; 70 71 import net.sf.basedb.util.formatter.Formatter; 72 import net.sf.basedb.util.units.UnitConverter; 71 73 72 74 import java.io.IOException; … … 514 516 boolean hasAnnotations = false; 515 517 long totalItems = query.getMaxResults() == 0 ? query.count(dc) : query.getMaxResults(); 518 SnapshotManager manager = new SnapshotManager(); 519 AnnotationTypeFilter filter = new AnnotationTypeFilter(); 516 520 517 521 for (ExportedProperty ep : exportedProperties) … … 566 570 567 571 int id = queryWrapper.getId(item); 568 AnnotationSet as= null;572 AnnotationSetSnapshot snapshot = null; 569 573 if (hasAnnotations) 570 574 { 571 575 Annotatable a = (Annotatable)item; 572 if (a.isAnnotated()) as = a.getAnnotationSet();576 if (a.isAnnotated()) snapshot = manager.getSnapshot(dc, a.getAnnotationSet().getId()); 573 577 } 574 578 … … 582 586 if (ep.dataloader == null) 583 587 { 584 Annotation a = as != null && as.hasAnnotation(ep.annotationType) ? 585 as.getAnnotation(ep.annotationType) : null; 586 if (a != null) 588 if (snapshot != null) 587 589 { 588 values = a.getValues(ep.unit); 589 if (ep.unit == null) unitSymbol = a.getUnitSymbol(null); 590 filter.setAnnotationType(ep.annotationType); 591 List<AnnotationSnapshot> s = manager.findAnnotations(dc, snapshot, filter, false); 592 if (s.size() == 1) 593 { 594 Unit defaultUnit = ep.annotationType.getDefaultUnit(); 595 UnitConverter unitConverter = null; 596 if (defaultUnit != null) 597 { 598 if (ep.unit != null) unitConverter = ep.unit.getUnitConverter(defaultUnit); 599 if (ep.unit == null) unitSymbol = defaultUnit.getDisplaySymbol(); 600 } 601 values = s.get(0).getValues(unitConverter, ep.annotationType.getValueType()); 602 } 590 603 } 591 604 }
Note: See TracChangeset
for help on using the changeset viewer.