Changeset 7129
- Timestamp:
- Apr 21, 2016, 9:51:07 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/core/net/sf/basedb/plugins/AnnotationFlatFileImporter.java
r7127 r7129 29 29 import java.util.Collection; 30 30 import java.util.Collections; 31 import java.util.Date;32 31 import java.util.EnumSet; 33 32 import java.util.HashMap; … … 722 721 protected void beginData() 723 722 { 724 System.out.println(new Date()+": begin");725 723 this.dc = sc.newDbControl(); 726 724 this.unitCache = new UnitCache(dc); … … 773 771 { 774 772 775 if (data.dataLineNo() % 100 == 0)776 {777 System.out.println(new Date()+": line " + data.dataLineNo());778 }779 780 773 // Find the item(s) to annotate. Mapper gives us name OR external ID 781 774 String nameOrId = itemMapper.getValue(data); … … 931 924 protected void end(boolean success) 932 925 { 933 System.out.println(new Date()+": end start");934 926 try 935 927 { … … 941 933 for (Set<NewAnnotations> n : itemCache.values()) 942 934 { 935 if (progress != null && current % 100 == 0) 936 { 937 progress.display(50 + (48 * current) / total, "Saving to database (" + current + " of " + total + " items done)..."); 938 } 943 939 current++; 944 945 if (progress != null)946 {947 progress.display(75 + (20 * current) / total, "Saving to database...");948 }949 940 numItems += n.size(); 950 941 for (NewAnnotations na : n) 951 942 { 952 943 na.setNewAnnotations(batcher, addToUnlimited, replaceExisting, failIfTooManyValues, removeExisting); 953 if (na.getNumSet() == 0) numItems--;954 944 numAnnotations += na.getNumSet(); 955 945 numError += na.getNumError(); … … 958 948 ThreadSignalHandler.checkInterrupted(); 959 949 } 960 961 if (current % 100 == 0)962 {963 System.out.println(new Date()+": " + current + "; " + numItems + " items; " + numAnnotations + " annotations");964 }965 966 950 } 967 951 batcher.close(); 968 System.out.println(new Date()+": commit start");952 if (progress != null) progress.display(99, "Committing transaction (" + numItems + " items)"); 969 953 dc.commit(); 970 System.out.println(new Date()+": commit end");971 954 if (progress != null) progress.display(100, "Done"); 972 //if (true) throw new RuntimeException("success!!");973 955 } 974 956 } … … 991 973 { 992 974 String msg = numItems + " item(s) annotated with " + numAnnotations + " annotation(s)"; 993 if (numReplaced > 0) msg += " (" + numReplaced + " was replaced)";975 if (numReplaced > 0) msg += "; " + numReplaced + " was replaced)"; 994 976 if (numRemoved > 0) msg += "; " + numRemoved + " annotations removed"; 995 977 if (numItemNotFound > 0) msg += "; " + numItemNotFound + " row(s) skipped because no item was found"; … … 999 981 /** 1000 982 Overriding default implementation since we want file parsing to 1001 only use 75% and the remaining 25% for storing to the database.983 only use 50% and the remaining 50% for storing to the database. 1002 984 */ 1003 985 @Override 1004 986 protected int getProgress(FlatFileParser ffp) 1005 987 { 1006 return super.getProgress(ffp) * 75/ 100;988 return super.getProgress(ffp) * 50 / 100; 1007 989 } 1008 990 // ------------------------------------------- … … 1408 1390 continue; // Do not try to set too many values 1409 1391 } 1410 1392 1411 1393 List<Object> theValues = new ArrayList<Object>(newValues.size()); 1412 1394 // Make sure all annotation values are converted to the same unit
Note: See TracChangeset
for help on using the changeset viewer.