Changeset 6586
- Timestamp:
- Oct 31, 2014, 11:13:09 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-stable/src/core/net/sf/basedb/core/RawDataBatcher.java
r6582 r6586 39 39 import java.util.Set; 40 40 import java.sql.SQLException; 41 41 42 42 43 /** … … 161 162 @see FeatureIdentificationMethod 162 163 */ 163 private Map<Object, FeatureData> preloaded; 164 private Map<Object, FeatureInfo> preloaded; 165 166 private ReporterProxy reporterProxy; 167 private FeatureProxy featureProxy; 164 168 165 169 /** … … 523 527 "] has already been used by another spot."); 524 528 } 525 Feature Datafeature = preloaded.get(featureId);529 FeatureInfo feature = preloaded.get(featureId); 526 530 if (feature == null) 527 531 { … … 531 535 "=" + featureId + "] doesn't exist on array design"); 532 536 } 533 ReporterData reporterOnFeature = feature.getReporter( );537 ReporterData reporterOnFeature = feature.getReporter(reporterProxy); 534 538 if (reporterOnFeature == null && acceptInsertIfNullReporterOnFeature) 535 539 { … … 547 551 } 548 552 data.setPosition(feature.getPosition()); 549 setPropertyValue(data, "feature", feature );553 setPropertyValue(data, "feature", feature.getFeature(featureProxy)); 550 554 data.setReporter(reporterOnFeature); 551 555 } … … 567 571 query.setInteger("arrayDesign", arrayDesign.getId()); 568 572 int numFeatures = HibernateUtil.loadData(Long.class, query).intValue(); 569 preloaded = new HashMap<Object, FeatureData>(numFeatures); 573 preloaded = new HashMap<Object, FeatureInfo>(numFeatures); 574 reporterProxy = new ReporterProxy(); 575 featureProxy = new FeatureProxy(); 570 576 query = HibernateUtil.getPredefinedQuery(dc.getStatelessSession(), "PRELOAD_FEATURES"); 571 577 /* … … 592 598 FeatureData feature = si.next(); 593 599 Object featureId = fiMethod.getIdentifier(feature); 594 if (preloaded.put(featureId, feature) != null)600 if (preloaded.put(featureId, new FeatureInfo(feature)) != null) 595 601 { 596 602 throw new InvalidDataException("Can't identify features with " + fiMethod + … … 652 658 } 653 659 660 661 static class FeatureInfo 662 { 663 private final int featureId; 664 private final int position; 665 private final int reporterId; 666 private final String externalReporterId; 667 668 FeatureInfo(FeatureData feature) 669 { 670 featureId = feature.getId(); 671 position = feature.getPosition(); 672 ReporterData reporter = feature.getReporter(); 673 if (reporter != null) 674 { 675 reporterId = reporter.getId(); 676 externalReporterId = reporter.getExternalId(); 677 } 678 else 679 { 680 reporterId = 0; 681 externalReporterId = null; 682 } 683 } 684 685 int getPosition() 686 { 687 return position; 688 } 689 690 ReporterData getReporter(ReporterProxy proxy) 691 { 692 return reporterId == 0 ? null : proxy.setTheId(reporterId, externalReporterId); 693 } 694 695 FeatureData getFeature(FeatureProxy proxy) 696 { 697 return proxy.setTheId(featureId); 698 } 699 700 } 701 702 static class ReporterProxy 703 extends ReporterData 704 { 705 private int id; 706 private String externalId; 707 708 ReporterProxy() 709 {} 710 711 ReporterProxy setTheId(int id, String externalId) 712 { 713 this.id = id; 714 this.externalId = externalId; 715 return this; 716 } 717 @Override 718 public int getId() 719 { 720 return id; 721 } 722 723 @Override 724 public String getExternalId() 725 { 726 return externalId; 727 } 728 } 729 730 static class FeatureProxy 731 extends FeatureData 732 { 733 private int id; 734 735 FeatureProxy() 736 { 737 super(null, (ReporterData)null); 738 } 739 740 FeatureProxy setTheId(int id) 741 { 742 this.id = id; 743 return this; 744 } 745 @Override 746 public int getId() 747 { 748 return id; 749 } 750 } 751 654 752 }
Note: See TracChangeset
for help on using the changeset viewer.