Changeset 7390


Ignore:
Timestamp:
Jun 7, 2017, 1:28:31 PM (5 years ago)
Author:
Nicklas Nordborg
Message:

Merge patch release 3.11.1 to the trunk.

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/doc/src/docbook/admin/installation.xml

    r7221 r7390  
    4747
    4848    <important id="installation.upgrade.important">
    49       <title>Important information for upgrading to BASE 3.10</title>
     49      <title>Important information for upgrading to BASE 3.11.1</title>
    5050      <para>
    5151        This section list some important information that may or may not
    5252        apply when upgrading from the <emphasis>previous</emphasis> BASE
    53         release to the current release (eg. 3.9 to 3.10). If you are
    54         upgrading from a BASE installation that is older (3.0-3.8)
     53        release to the current release (eg. 3.10 to 3.11). If you are
     54        upgrading from a BASE installation that is older (3.0-3.9)
    5555        you should also read <xref linkend="appendix.update_warnings" />.
    5656      </para>
    5757
    58       <bridgehead>Changed permissions for annotating items</bridgehead>
     58      <bridgehead>Free wells on bioplates</bridgehead>
    5959      <para>
    60         Before BASE 3.10 a user was able to create/change/delete annotations on
    61         an item if the user has <code>WRITE</code> permission on the item and
    62         <code>READ</code> permission on the  annotation type.
    63         In BASE 3.10 several changes has been made:
     60        A bug that affected the free wells information on bioplates
     61        has been fixed. Existing bioplates may have incorrect number of
     62        free wells and can be fixed by running a special script.
     63       
     64        After installing the BASE 3.11.1 update, change directory to
     65        <filename class="directory">&lt;base-dir&gt;/bin/</filename>
     66        and issue
     67  <programlisting>
     68  ./onetimefix.sh free_wells -u &lt;root login&gt; -p &lt;root pwd&gt;
     69  </programlisting>
    6470      </para>
    65      
    66       <itemizedlist>
    67         <listitem>
    68           <para>
    69             <code>USE</code> permission is required on the annotation type to be able
    70             to create/change/delete annotations of that type. This may cause user to no
    71             longer be able to annotate certain items, unless their permissions
    72             are upgraded to <code>USE</code>. Users with <code>READ</code> permission
    73             can only read the annotation values.
    74           </para>
    75         </listitem>
    76        
    77         <listitem>
    78           <para>
    79             A new permission level, <code>ANNOTATE</code>, has been introduced.
    80             In the permission hierarchy this sits between the <code>READ</code>
    81             and <code>WRITE</code> permission and can be used to give users
    82             permissions to manage annotations but not other properties of an item.
    83             All users with <code>WRITE</code> permission automatically get
    84             <code>ANNOTATE</code> permission so this change should not affect current
    85             users.
    86           </para>
    87         </listitem>
    88       </itemizedlist>
    8971    </important>
    9072   
  • trunk/doc/src/docbook/appendix/update_warnings.xml

    r7221 r7390  
    3535    to the current version.
    3636  </para>
     37 
     38  <sect1 id="appendix.update_warnings.3.11.1">
     39    <title>BASE 3.11.1</title>
     40 
     41    <bridgehead>Free wells on bioplates</bridgehead>
     42    <para>
     43      A bug that affected the free wells information on bioplates
     44      has been fixed. Existing bioplates may have incorrect number of
     45      free wells and can be fixed by running a special script.
     46     
     47      After installing the BASE 3.11.1 update, change directory to
     48      <filename class="directory">&lt;base-dir&gt;/bin/</filename>
     49      and issue
     50<programlisting>
     51./onetimefix.sh free_wells -u &lt;root login&gt; -p &lt;root pwd&gt;
     52</programlisting>
     53    </para>
     54   
     55  </sect1>
    3756 
    3857  <sect1 id="appendix.update_warnings.3.10">
  • trunk/src/clients/web/net/sf/basedb/clients/web/fileupload/FileUpload.java

    r7160 r7390  
    3636import java.io.IOException;
    3737import java.net.SocketTimeoutException;
     38import java.nio.charset.Charset;
    3839
    3940import javax.servlet.ServletRequest;
     
    4142
    4243import net.sf.basedb.util.FileUtil;
     44import net.sf.basedb.util.Values;
    4345
    4446/**
     
    103105  */
    104106  private int transferRate = 0;
     107 
     108  /**
     109    The charset used for decoding header lines.
     110  */
     111  private Charset charset;
    105112
    106113  /**
     
    151158    this.boundary = sectionBoundary.getBytes();
    152159    long contentLength = request.getContentLengthLong();
     160   
     161    String encoding = Values.getString(request.getCharacterEncoding(), "UTF-8");
     162    try
     163    {
     164      this.charset = Charset.forName(encoding);
     165    }
     166    catch (Exception ex)
     167    {
     168      this.charset = Charset.forName("UTF-8");
     169    }
     170   
    153171    this.progress = new FileUploadProgress(contentLength);
    154172    try
     
    484502      if (bytes >= 3)
    485503      {
    486         return new String(line, 0, bytes - 2);  // -2 because we strip CRLF at the end of the line.
     504        return new String(line, 0, bytes - 2, charset); // -2 because we strip CRLF at the end of the line.
    487505      }
    488506      else
     
    522540        if (!status.atBoundary)
    523541        {
    524           sb.append(new String(line, 0, bytes));
     542          sb.append(new String(line, 0, bytes, charset));
    525543        }
    526544      }
  • trunk/src/core/net/sf/basedb/core/MeasuredBioMaterial.java

    r7381 r7390  
    539539    {
    540540      currentWell.setBioMaterial(null);
    541       currentWell.getBioPlate().updateFreeWells(1);
     541      updateFreeWells(currentWell.getBioPlate(), 1);
    542542    }
    543543    if (newWell != null)
    544544    {
    545545      newWell.setBioMaterial(myData);
    546       newWell.getBioPlate().updateFreeWells(-1);
     546      updateFreeWells(newWell.getBioPlate(), -1);
    547547    }
    548548    myData.setBioWell(newWell);
     
    558558  {
    559559    return getDbControl().getItem(BioWell.class, getData().getBioWell());
     560  }
     561 
     562  private void updateFreeWells(BioPlateData plate, int delta)
     563  {
     564    // Ensure that the changes are made to an instance in this session
     565    if (plate.getId() != 0)
     566    {
     567      plate = HibernateUtil.loadData(getDbControl().getHibernateSession(), BioPlateData.class, plate.getId());
     568    }
     569    plate.updateFreeWells(delta);
    560570  }
    561571 
  • trunk/src/core/net/sf/basedb/core/Update.java

    r7381 r7390  
    20502050  }
    20512051
    2052  
     2052  /**
     2053    Vefify and update the free wells of all bioplates.
     2054    @return The number of bioplates fixed
     2055  */
     2056  public static int recalculateFreeWells(ProgressReporter progress)
     2057    throws BaseException
     2058  {
     2059    org.hibernate.Session session = null;
     2060    org.hibernate.Transaction tx = null;
     2061    int numUpdated = 0;
     2062    try
     2063    {
     2064      session = HibernateUtil.newSession();
     2065      tx = HibernateUtil.newTransaction(session);
     2066     
     2067      progress.display(10, "Updating bioplates...\n");
     2068     
     2069      // Subquery that counts the number of free wells on
     2070      // a bioplate by checking the "BioMaterials.biowell_id" column
     2071      String countSql =
     2072        "select count(*) from [BioWells] bw " +
     2073        "left join [BioMaterials] bm on bm.[biowell_id]=bw.[id] " +
     2074        "where bw.[bioplate_id] = bp.[id] and bm.[id] is null";
     2075     
     2076      // Query to update the free wells on plates that have an incorrect value
     2077      org.hibernate.query.NativeQuery<?> updateQuery = HibernateUtil.createSqlQuery(session,
     2078        "update [BioPlates] bp "+
     2079        "set [free_wells] = (" + countSql + ") "+
     2080        "where bp.[free_wells] <> ("+countSql+")");
     2081     
     2082      numUpdated = updateQuery.executeUpdate();
     2083      if (numUpdated == 0)
     2084      {
     2085        progress.display(100, "Found " + numUpdated + " bioplates to fix\n");
     2086      }
     2087      else
     2088      {
     2089        progress.display(95, "Found " + numUpdated + " bioplates to fix. Comitting transaction...\n");
     2090        // Commit the changes
     2091        HibernateUtil.commit(tx);
     2092        progress.display(100, "Completed update of " + numUpdated + " bioplates\n");
     2093      }
     2094    }
     2095    catch (BaseException ex)
     2096    {
     2097      if (tx != null) HibernateUtil.rollback(tx);
     2098      throw ex;
     2099    }
     2100    return numUpdated;
     2101  }
     2102
    20532103
    20542104  private static TableInfo getTableInfo(org.hibernate.Session session, final String tableName)
  • trunk/src/core/net/sf/basedb/util/export/spotdata/AbstractBioAssaySetExporter.java

    r6875 r7390  
    559559    }
    560560    query.select(Selects.expression(posExpression, "pos"));
     561    query.order(Orders.asc(posExpression));
    561562    return query;
    562563  }
  • trunk/src/install/net/sf/basedb/install/OneTimeFix.java

    r6600 r7390  
    8888        Application.stop();
    8989      }
     90      else if ("free_wells".equals(cmd))
     91      {
     92        String login = getOption(args, "-u", "root");
     93        String pwd = getOption(args, "-p", "root");
     94       
     95        String msg =
     96          "-------------------------------------------------------------------\n" +
     97          "This script re-calculates the free wells on all bioplate items\n" +
     98          "since it may have become incorrect due to a bug.\n" +
     99          "For more information see: http://base.thep.lu.se/ticket/2088\n\n" +
     100          "Press ENTER to continue or CTRL+C to abort\n" +
     101          "-------------------------------------------------------------------";
     102        System.out.println(msg);
     103        waitForEnter();
     104        showDbInfo(null);
     105        System.out.println("Starting BASE. Please wait...");
     106        Application.start(false);
     107        SessionControl sc = Application.newSessionControl(null, null, null);
     108        sc.login(new LoginRequest(login, pwd));
     109        int numModified = Update.recalculateFreeWells(new ConsoleProgressReporter(false));
     110        sc.logout();
     111        sc.close();
     112        Application.stop();
     113      }
    90114      else
    91115      {
     
    106130    System.out.println("    -u <login>    : Login name for the root user account; (root)");
    107131    System.out.println("    -p <password> : Password for the root user account; (root)");
     132    System.out.println("cmd:");
     133    System.out.println("    remaining_quantity: Re-calculate remaining quantity of biomaterials");
     134    System.out.println("    free_wells: Re-calculate free wells on all bioplates");
    108135  }
    109136
  • trunk/www/biomaterials/extracts/extracts.js

    r7003 r7390  
    332332    var frm = document.forms['extract'];
    333333    var url = '&resetTemporary=1';
    334     url += '&tmpfilter:INT:bioPlateType.bioMaterialType=|'+Data.get('page-data', 'extract-type');
     334    url += '&tmpfilter:INT:bioPlateType.bioMaterialType='+encodeURIComponent('|'+Data.get('page-data', 'extract-type'));
    335335    var subtypeId = ItemSubtype.getSubtypeId('subtype_id');
    336336    // Restrict to plates with the given subtype
    337     url += '&tmpfilter:INT:bioPlateType.itemSubtype='+(subtypeId ? '|' + subtypeId : '=');
     337    url += '&tmpfilter:INT:bioPlateType.itemSubtype='+encodeURIComponent(subtypeId ? '|' + subtypeId : '=');
    338338    url += '&tmpfilter:BOOLEAN:destroyed=false';
    339339    Dialogs.selectItem('BIOPLATE', 'bioplate_id', 0, url);
  • trunk/www/biomaterials/samples/samples.js

    r7003 r7390  
    217217    var frm = document.forms['sample'];
    218218    var url = '&resetTemporary=1';
    219     url += '&tmpfilter:INT:bioPlateType.bioMaterialType=|'+Data.get('page-data', 'sample-type');
     219    url += '&tmpfilter:INT:bioPlateType.bioMaterialType='+encodeURIComponent('|'+Data.get('page-data', 'sample-type'));
    220220    var subtypeId = ItemSubtype.getSubtypeId('subtype_id');
    221221    // Restrict to plates with the given subtype
    222     url += '&tmpfilter:INT:bioPlateType.itemSubtype='+(subtypeId ? '|' + subtypeId : '=');
     222    url += '&tmpfilter:INT:bioPlateType.itemSubtype='+encodeURIComponent(subtypeId ? '|' + subtypeId : '=');
    223223    url += '&tmpfilter:BOOLEAN:destroyed=false';
    224224    Dialogs.selectItem('BIOPLATE', 'bioplate_id', 0, url);
  • trunk/www/biomaterials/wizards/create_child_bioplate.js

    r7001 r7390  
    248248    var childType = frm.child_biomaterial_type.value;
    249249    // Restrict to plates that can holds to target biomaterial
    250     url += '&tmpfilter:INT:bioMaterialType=|'+Data.int('page-data', childType);
     250    url += '&tmpfilter:INT:bioMaterialType='+encodeURIComponent('|'+Data.int('page-data', childType));
    251251    var subtypeId = ItemSubtype.getSubtypeId(childType+'_subtype_id');
    252252    // Restrict to plates with the given subtype
    253     url += '&tmpfilter:INT:itemSubtype='+(subtypeId ? '|' + subtypeId : '=');
     253    url += '&tmpfilter:INT:itemSubtype='+encodeURIComponent(subtypeId ? '|' + subtypeId : '=');
    254254 
    255255    Dialogs.selectItem('BIOPLATETYPE', 'bioplatetype_id', 0, url);
  • trunk/www/biomaterials/wizards/move_biomaterial.js

    r6997 r7390  
    9191    if (bioMaterialType)
    9292    {
    93       url += '&tmpfilter:INT:bioPlateType.bioMaterialType=|'+bioMaterialType;
     93      url += '&tmpfilter:INT:bioPlateType.bioMaterialType='+encodeURIComponent('|'+bioMaterialType);
    9494    }
    9595    var commonSubtype = Data.int('page-data', 'common-subtype');
    9696    if (commonSubtype)
    9797    {
    98       url += '&tmpfilter:INT:bioPlateType.itemSubtype=|'+commonSubtype;
     98      url += '&tmpfilter:INT:bioPlateType.itemSubtype='+encodeURIComponent('|'+commonSubtype);
    9999    }
    100100
  • trunk/www/biomaterials/wizards/place_on_plate.js

    r6997 r7390  
    9696    var url = '&resetTemporary=1';
    9797    var bioMaterialType = Data.int('page-data', 'biomaterial-type');
    98     url += '&tmpfilter:INT:bioPlateType.bioMaterialType=|'+bioMaterialType;
     98    url += '&tmpfilter:INT:bioPlateType.bioMaterialType='+encodeURIComponent('|'+bioMaterialType);
    9999    var commonSubtype = Data.int('page-data', 'common-subtype');
    100100    if (commonSubtype)
    101101    {
    102       url += '&tmpfilter:INT:bioPlateType.itemSubtype=|'+commonSubtype;
     102      url += '&tmpfilter:INT:bioPlateType.itemSubtype='+encodeURIComponent('|'+commonSubtype);
    103103    }
    104104    Dialogs.selectItem('BIOPLATE', 'btnSelectPlate', 0, url);
  • trunk/www/views/derivedbioassays/bioassays.js

    r7003 r7390  
    391391    if (relatedExtractIds)
    392392    {
    393       url += '&tmpfilter:INT:id='+relatedExtractIds.join('|');
     393      url += '&tmpfilter:INT:id='+encodeURIComponent(relatedExtractIds.join('|'));
    394394    }
    395395    url += ItemSubtype.createRelatedFilter('subtype_id', 'EXTRACT');
  • trunk/www/views/rawbioassays/bioassays.js

    r7003 r7390  
    382382    if (relatedExtractIds)
    383383    {
    384       url += '&tmpfilter:INT:id='+relatedExtractIds.join('|');
     384      url += '&tmpfilter:INT:id='+encodeURIComponent(relatedExtractIds.join('|'));
    385385    }
    386386    if (frm.extract_id.length > 1)
Note: See TracChangeset for help on using the changeset viewer.