Changeset 7478


Ignore:
Timestamp:
Apr 16, 2018, 9:03:52 AM (5 years ago)
Author:
Nicklas Nordborg
Message:

Merge patch release 3.12.2 to the trunk.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/core/net/sf/basedb/core/hibernate/NativeQueryWrapper.java

    r7469 r7478  
    522522    with a shorter list, Hibernate will try to set the non-existing parameters
    523523    which causes an exception. See http://base.thep.lu.se/ticket/2110
     524    UPDATE: We also need to check for copied parameter (name) in case the list
     525    contained only a single element. See http://base.thep.lu.se/ticket/2113
    524526  */
    525527  @SuppressWarnings({ "unchecked", "rawtypes" })
     
    540542      {
    541543        String name = i.next().getName();
    542         if (name.startsWith(prefixOfParametersToRemove))
     544        if (name.startsWith(prefixOfParametersToRemove) || name.equals(parameterName))
    543545        {
    544546          i.remove();
  • trunk/src/plugins/core/net/sf/basedb/plugins/AnnotationFlatFileImporter.java

    r7204 r7478  
    643643  private int numRemoved;
    644644  private ProgressReporter progress;
     645  // Percentages will be adjusted based on number of annotations
     646  private int progressParser = 50; // Progress percentage for file-parsing
     647  private int progressDatabase = 48; // Progress percentage for database update
    645648 
    646649  @Override
     
    761764      ++i;
    762765    }
     766   
     767    // Recalculate progress parts so that the file parsing is between 10-50% depedning on number of annotations
     768    int dbPart = (1 + mappers.size() % 20);
     769    progressParser = Math.max(100 / (1+dbPart), 10);
     770    progressDatabase = 98 - progressParser;
     771   
    763772    batcher = new AnnotationBatcher(dc, itemType);
    764773    batcher.addAnnotationTypes(mappers.values());
     
    948957        for (Set<NewAnnotations> n : itemCache.values())
    949958        {
    950           if (progress != null && current % 100 == 0)
    951           {
    952             progress.display(50 + (48 * current) / total, "Saving to database (" + current + " of  " + total + " items done)...");
     959          // progressParser should be between 10-50 and is a good interval for progress reporting
     960          if (progress != null && current % progressParser == 0)
     961          {
     962            progress.display(progressParser + (progressDatabase * current) / total, "Saving to database (" + current + " of  " + total + " items done)...");
    953963          }
    954964          current++;
     
    9961006  /**
    9971007    Overriding default implementation since we want file parsing to
    998     only use 50% and the remaining 50% for storing to the database.
     1008    only use 'progressParser'% and the remaining 'progressDatabase'%
     1009    for storing to the database.
    9991010   */
    10001011  @Override
    10011012  protected int getProgress(FlatFileParser ffp)
    10021013  {
    1003     return super.getProgress(ffp) * 50 / 100;
     1014    if (ffp.getParsedDataLines() == 0) return 0;
     1015    return super.getProgress(ffp) * progressParser / 100;
    10041016  }
    10051017  // -------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.