Changeset 6600


Ignore:
Timestamp:
Nov 17, 2014, 8:41:18 AM (8 years ago)
Author:
Nicklas Nordborg
Message:

Merge BASE 3.3.3 to the trunk.

There is a test failure in "TestFile?" for the https file. I guess this due to updates to the Http client library in #1809 and that it existed already in BASE 3.3.2 when the urls changed due to server move.

Location:
trunk
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/config/dist/base.config

    r6468 r6600  
    4141#db.driver           = org.postgresql.Driver
    4242#db.url              = jdbc:postgresql:base2
    43 #db.dynamic.catalog  = base2
    4443#db.dynamic.schema   = dynamic
    4544#db.queries          = /postgres-queries.xml
  • trunk/credits.txt

    r6576 r6600  
    11$Id$
    22
    3 The current BASE team is (at BASE 3.3.2 release)
     3The current BASE team is (at BASE 3.3.3 release)
    44{{{
    55Jari Häkkinen
  • trunk/doc/src/docbook/appendix/update_warnings.xml

    r6479 r6600  
    6161      since the <classname>org.hibernate.dialect.PostgreSQLDialect</classname> has
    6262      been deprecated.
     63    </para>
     64   
     65  </sect1>
     66
     67  <sect1 id="appendix.update_warnings.3.3.3">
     68    <title>BASE 3.3.3</title>
     69 
     70    <bridgehead>Remaining quantity</bridgehead>
     71    <para>
     72      A bug that affected remaining quantity calculations for
     73      biomaterial item has been fixed. Existing items may have been
     74      saved with incorrect remaining quantity and must be fixed.
     75      After installing the BASE 3.3.3 update, the existing
     76      remaining quantity values are fix by running a special script.
     77      Change directory to <filename class="directory">&lt;base-dir&gt;/bin/</filename>
     78      and issue
     79<programlisting>
     80./onetimefix.sh remaining_quantity -u &lt;root login&gt; -p &lt;root pwd&gt;
     81</programlisting>
    6382    </para>
    6483   
  • trunk/src/clients/web/net/sf/basedb/clients/web/extensions/ExtensionsControl.java

    r6520 r6600  
    804804  {
    805805    ExtensionPoint<?> ep = getExtensionPoint(ex.getExtends());
     806    if (ep == null) return false;
    806807    // The extension point cant violoate the policy
    807808    if (!ep.getActionClass().isAnnotationPresent(UnsafeScriptable.class)) return false;
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/path/Path.java

    r6127 r6600  
    146146    sb.append("<h1");
    147147    addIdAndStyles(sb);
     148    addDynamicAttributes(sb);
    148149    sb.append(">");
    149150
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/path/PathElement.java

    r6127 r6600  
    225225    sb.append("<span");
    226226    addIdAndStyles(sb);
     227    addDynamicAttributes(sb);
    227228    sb.append(">");
    228229    if (getHref() != null && isEnabled())
  • trunk/src/core/net/sf/basedb/core/BioMaterialEvent.java

    r6268 r6600  
    2626import net.sf.basedb.core.query.Restrictions;
    2727import net.sf.basedb.core.query.Hql;
    28 
    2928import net.sf.basedb.core.data.BioMaterialData;
    3029import net.sf.basedb.core.data.BioMaterialEventData;
     
    719718    checkPermission(Permission.RESTRICTED_WRITE);
    720719    if (bioMaterial == null) throw new InvalidUseOfNullException("bioMaterial");
    721     BioMaterialData data = (BioMaterialData)bioMaterial.getData();
     720    BioMaterialData data = (BioMaterialData)HibernateUtil.unwrapIfProxy(getDbControl().getHibernateSession(), bioMaterial.getData());
    722721    Map<BioMaterialData, BioMaterialEventSourceData> sources = getData().getSources();
    723722    BioMaterialEventSourceData src = sources.remove(data);
     
    858857    Map<BioMaterialData, BioMaterialEventSourceData> sources = getData().getSources();
    859858    int parentId = parent == null ? 0 : parent.getId();
    860    
     859
    861860    Iterator<Map.Entry<BioMaterialData, BioMaterialEventSourceData>> it = sources.entrySet().iterator();
    862861    while (it.hasNext())
     
    865864     
    866865      BioMaterialEventSourceData src = entry.getValue();
    867       BioMaterialData bioMaterial = entry.getKey();
     866      BioMaterialData bioMaterial = (BioMaterialData)HibernateUtil.unwrapIfProxy(dc.getHibernateSession(), entry.getKey());
    868867     
    869868      if (bioMaterial.getId() != parentId)
  • trunk/src/core/net/sf/basedb/core/BioMaterialEventSource.java

    r5963 r6600  
    2525import java.util.Set;
    2626
     27import net.sf.basedb.core.data.BioMaterialData;
    2728import net.sf.basedb.core.data.BioMaterialEventSourceData;
    2829import net.sf.basedb.core.data.MeasuredBioMaterialData;
     
    167168  {
    168169    checkPermission(Permission.RESTRICTED_WRITE);
    169     if (data.getBioMaterial() instanceof MeasuredBioMaterialData)
    170     {
    171       MeasuredBioMaterialData mbData = (MeasuredBioMaterialData)data.getBioMaterial();
     170    BioMaterialData bm = (BioMaterialData)HibernateUtil.unwrapIfProxy(dc.getHibernateSession(), data.getBioMaterial());
     171    if (bm instanceof MeasuredBioMaterialData)
     172    {
     173      MeasuredBioMaterialData mbData = (MeasuredBioMaterialData)bm;
    172174      Float delta = 0.0f;
    173175      if (data.getUsedQuantity() != null)
  • trunk/src/core/net/sf/basedb/core/HibernateUtil.java

    r6542 r6600  
    14531453      throw new BaseException(ex);
    14541454    }   
     1455  }
     1456 
     1457  /**
     1458    If the given data object is a proxy, load the real data object instead.
     1459    @since 3.3.3
     1460  */
     1461  static BasicData unwrapIfProxy(Session session, BasicData data)
     1462  {
     1463    if (data instanceof org.hibernate.proxy.HibernateProxy)
     1464    {
     1465      org.hibernate.proxy.HibernateProxy proxy = (org.hibernate.proxy.HibernateProxy)data;
     1466      org.hibernate.proxy.LazyInitializer li = proxy.getHibernateLazyInitializer();
     1467      if (li.isUninitialized())
     1468      {
     1469        if (session instanceof SessionWrapper)
     1470        {
     1471          session = ((SessionWrapper)session).getParentSession();
     1472        }
     1473        li.setSession((org.hibernate.internal.SessionImpl)session);
     1474      }
     1475      data = (BasicData)li.getImplementation();
     1476    }
     1477
     1478    return data;
    14551479  }
    14561480 
  • trunk/src/core/net/sf/basedb/core/RawDataBatcher.java

    r6468 r6600  
    3939import java.util.Set;
    4040import java.sql.SQLException;
     41
    4142
    4243/**
     
    161162    @see FeatureIdentificationMethod
    162163  */
    163   private final Map<Object, FeatureData> preloaded;
     164  private Map<Object, FeatureInfo> preloaded;
     165 
     166  private ReporterProxy reporterProxy;
     167  private FeatureProxy featureProxy;
    164168 
    165169  /**
     
    230234    }
    231235   
    232     // Preload features
    233     if (arrayDesign != null && arrayDesign.getHasFeatures() && rawBioAssay.getNumDbSpots() == 0)
    234     {
    235       org.hibernate.Query query = HibernateUtil.getPredefinedQuery(dc.getStatelessSession(), "COUNT_FEATURES_FOR_ARRAYDESIGN");
    236       /*
    237         SELECT count(*)
    238         FROM FeatureData f
    239         WHERE f.arrayDesignBlock.arrayDesign = :arrayDesign
    240       */
    241       query.setInteger("arrayDesign", arrayDesign.getId());
    242       int numFeatures = HibernateUtil.loadData(Long.class, query).intValue();
    243       preloaded = new HashMap<Object, FeatureData>(numFeatures);
    244       query = HibernateUtil.getPredefinedQuery(dc.getStatelessSession(), "PRELOAD_FEATURES");
    245       /*
    246         SELECT f
    247         FROM FeatureData f
    248         JOIN FETCH f.arrayDesignBlock b
    249         LEFT JOIN FETCH f.reporter
    250         WHERE b.arrayDesign = :arrayDesign
    251       */
    252       query.setInteger("arrayDesign", arrayDesign.getId());
    253       ScrollIterator<FeatureData> si = null;
    254       try
    255       {
    256         si = QueryExecutor.loadIterator(FeatureData.class, query,
    257             dc.getStatelessSession(), dc.getSessionControl());
    258       }
    259       catch (InterruptedException ex)
    260       {
    261         throw new SignalException("Aborted by user", ex);
    262       }
    263       while (si.hasNext())
    264       {
    265         ThreadSignalHandler.checkInterrupted();
    266         FeatureData feature = si.next();
    267         Object featureId = fiMethod.getIdentifier(feature);
    268         if (preloaded.put(featureId, feature) != null)
    269         {
    270           throw new InvalidDataException("Can't identify features with " + fiMethod +
    271             ". Found duplicate feature: " + featureId);
    272         }
    273       }
    274       si.close();
    275     }
    276     else
    277     {
    278       this.preloaded = null;
    279     }
    280     this.usedFeatures = new HashSet<Object>(preloaded == null ? 100 : preloaded.size());
    281236    setDbControl(dc);
    282237  }
     
    529484    throws BaseException
    530485  {
     486    if (usedFeatures == null) preloadFeatures();
    531487    if (externalReporterId != null) externalReporterId = externalReporterId.trim();
    532488    if (preloaded == null)
     
    571527          "] has already been used by another spot.");
    572528      }
    573       FeatureData feature = preloaded.get(featureId);
     529      FeatureInfo feature = preloaded.get(featureId);
    574530      if (feature == null)
    575531      {
     
    579535            "=" + featureId + "] doesn't exist on array design");
    580536      }
    581       ReporterData reporterOnFeature = feature.getReporter();
     537      ReporterData reporterOnFeature = feature.getReporter(reporterProxy);
    582538      if (reporterOnFeature == null && acceptInsertIfNullReporterOnFeature)
    583539      {
     
    595551      }
    596552      data.setPosition(feature.getPosition());
    597       setPropertyValue(data, "feature", feature);
     553      setPropertyValue(data, "feature", feature.getFeature(featureProxy));
    598554      data.setReporter(reporterOnFeature);
    599555    }
    600556    super.insert(data);
     557  }
     558 
     559  private void preloadFeatures()
     560  {
     561    // Preload features
     562    if (arrayDesign != null && arrayDesign.getHasFeatures() && rawBioAssay.getNumDbSpots() == 0)
     563    {
     564      DbControl dc = getDbControl();
     565      org.hibernate.Query query = HibernateUtil.getPredefinedQuery(dc.getStatelessSession(), "COUNT_FEATURES_FOR_ARRAYDESIGN");
     566      /*
     567        SELECT count(*)
     568        FROM FeatureData f
     569        WHERE f.arrayDesignBlock.arrayDesign = :arrayDesign
     570      */
     571      query.setInteger("arrayDesign", arrayDesign.getId());
     572      int numFeatures = HibernateUtil.loadData(Long.class, query).intValue();
     573      preloaded = new HashMap<Object, FeatureInfo>(numFeatures);
     574      reporterProxy = new ReporterProxy();
     575      featureProxy = new FeatureProxy();
     576      query = HibernateUtil.getPredefinedQuery(dc.getStatelessSession(), "PRELOAD_FEATURES");
     577      /*
     578        SELECT f
     579        FROM FeatureData f
     580        JOIN FETCH f.arrayDesignBlock b
     581        LEFT JOIN FETCH f.reporter
     582        WHERE b.arrayDesign = :arrayDesign
     583      */
     584      query.setInteger("arrayDesign", arrayDesign.getId());
     585      ScrollIterator<FeatureData> si = null;
     586      try
     587      {
     588        si = QueryExecutor.loadIterator(FeatureData.class, query,
     589            dc.getStatelessSession(), dc.getSessionControl());
     590      }
     591      catch (InterruptedException ex)
     592      {
     593        throw new SignalException("Aborted by user", ex);
     594      }
     595      while (si.hasNext())
     596      {
     597        ThreadSignalHandler.checkInterrupted();
     598        FeatureData feature = si.next();
     599        Object featureId = fiMethod.getIdentifier(feature);
     600        if (preloaded.put(featureId, new FeatureInfo(feature)) != null)
     601        {
     602          throw new InvalidDataException("Can't identify features with " + fiMethod +
     603            ". Found duplicate feature: " + featureId);
     604        }
     605      }
     606      si.close();
     607    }
     608    else
     609    {
     610      this.preloaded = null;
     611    }
     612    this.usedFeatures = new HashSet<Object>(preloaded == null ? 100 : preloaded.size());
    601613  }
    602614 
     
    646658  }
    647659
     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 
    648752}
  • trunk/src/core/net/sf/basedb/core/Update.java

    r6520 r6600  
    2626import java.util.ArrayList;
    2727import java.util.Arrays;
     28import java.util.HashMap;
    2829import java.util.HashSet;
    2930import java.util.Iterator;
     
    4950import net.sf.basedb.core.data.ItemSubtypeData;
    5051import net.sf.basedb.core.data.JobData;
     52import net.sf.basedb.core.data.MeasuredBioMaterialData;
    5153import net.sf.basedb.core.data.PropertyFilterData;
    5254import net.sf.basedb.core.data.ReporterCloneTemplateData;
     
    930932  }
    931933 
     934  /**
     935    Vefify and update the remaining quantity of all biomaterials.
     936    @return The number of biomaterial fixed
     937  */
     938  public static int recalculateRemainingQuantity(ProgressReporter progress)
     939    throws BaseException
     940  {
     941    org.hibernate.Session session = null;
     942    org.hibernate.Transaction tx = null;
     943    int numUpdated = 0;
     944    try
     945    {
     946      session = HibernateUtil.newSession();
     947      tx = HibernateUtil.newTransaction(session);
     948     
     949      // For temporary storing the new remaining quantities
     950      Map<Integer, Double> remaining = new HashMap<Integer, Double>();
     951     
     952      // Load used quantity for all events
     953      org.hibernate.Query eventQuery = HibernateUtil.createQuery(session,
     954        "SELECT evt.bioMaterial.id, evt.usedQuantity FROM BioMaterialEventData evt WHERE NOT evt.usedQuantity IS NULL");
     955     
     956      // Load used quantity for sources to all events
     957      org.hibernate.Query sourcesQuery = HibernateUtil.createQuery(session,
     958        "SELECT src.bioMaterial.id, src.usedQuantity FROM BioMaterialEventSourceData src WHERE NOT src.usedQuantity IS NULL");
     959 
     960      progress.display(10, "Loading biomaterial items...\n");
     961     
     962      List<Object[]> events = HibernateUtil.loadList(Object[].class, eventQuery, null);
     963      events.addAll(HibernateUtil.loadList(Object[].class, sourcesQuery, null));
     964 
     965      // Calculate the remaining quantity for each biomaterial
     966      // o[0] = biomaterial id, o[1] = used quantity     
     967      for (Object[] o : events)
     968      {
     969        Integer id = (Integer)o[0];
     970        Float usedQuantity = (Float)o[1];
     971        Double currentRemaining = remaining.get(id);
     972        if (currentRemaining == null) currentRemaining = 0.0;
     973        currentRemaining = currentRemaining - usedQuantity.doubleValue();
     974        remaining.put(id, currentRemaining);
     975      }
     976      progress.display(30, "Found "+ remaining.size() + " items. Checking remaining quantity...\n");
     977     
     978      // Update the remaining quantity
     979      org.hibernate.Query updateQuery = HibernateUtil.createQuery(session,
     980        "UPDATE MeasuredBioMaterialData mbm " +
     981        "SET mbm.remainingQuantity = :remain "+
     982        "WHERE mbm = :bioMaterial");
     983      int numProcessed = 0;
     984      for (Map.Entry<Integer, Double> entry : remaining.entrySet())
     985      {
     986        MeasuredBioMaterialData bioMaterial = HibernateUtil.loadData(session, MeasuredBioMaterialData.class, entry.getKey());
     987        Double remainingQuantity = entry.getValue();
     988        Float currentRemaining = bioMaterial.getRemainingQuantity();
     989        if (currentRemaining == null || Math.abs(currentRemaining-remainingQuantity) > Math.abs(currentRemaining / 10000))
     990        {
     991          updateQuery.setEntity("bioMaterial", bioMaterial);
     992          updateQuery.setFloat("remain", remainingQuantity.floatValue());
     993          updateQuery.executeUpdate();
     994          numUpdated++;
     995        }
     996        numProcessed++;
     997        if (numProcessed % 100 == 0)
     998        {
     999          progress.display(30 + numProcessed * 60 / remaining.size(), "Processed " + numProcessed + " biomaterial items...                   ");
     1000        }
     1001      }
     1002      progress.append("\n");
     1003      if (numUpdated == 0)
     1004      {
     1005        progress.display(100, "Found " + numUpdated + " items to fix\n");
     1006      }
     1007      else
     1008      {
     1009        progress.display(95, "Found " + numUpdated + " items to fix. Comitting transaction...\n");
     1010        // Commit the changes
     1011        HibernateUtil.commit(tx);
     1012        progress.display(100, "Completeted update of " + numUpdated + " items\n");
     1013      }
     1014    }
     1015    catch (BaseException ex)
     1016    {
     1017      if (tx != null) HibernateUtil.rollback(tx);
     1018      throw ex;
     1019    }
     1020    return numUpdated;
     1021  }
     1022
    9321023 
    9331024
  • trunk/src/install/net/sf/basedb/install/OneTimeFix.java

    r5735 r6600  
    3131
    3232
     33
     34
     35
     36
    3337import net.sf.basedb.core.Application;
    3438import net.sf.basedb.core.Config;
    3539import net.sf.basedb.core.ProgressReporter;
     40import net.sf.basedb.core.SessionControl;
     41import net.sf.basedb.core.Update;
     42import net.sf.basedb.core.authentication.LoginRequest;
     43import net.sf.basedb.util.ConsoleProgressReporter;
    3644
    3745/**
     
    5563    try
    5664    {
    57       String cmd = args[0];   
    58       if ("foo".equals(cmd))
     65      String cmd = args[0];
     66      if ("remaining_quantity".equals(cmd))
    5967      {
    60         showUsage();
     68        String login = getOption(args, "-u", "root");
     69        String pwd = getOption(args, "-p", "root");
     70       
     71        String msg =
     72          "-------------------------------------------------------------------\n" +
     73          "This script re-calculates the remaining quantity of all biomaterial\n" +
     74          "items since it may have become incorrect due to a bug.\n" +
     75          "For more information see: http://base.thep.lu.se/ticket/1873\n\n" +
     76          "Press ENTER to continue or CTRL+C to abort\n" +
     77          "-------------------------------------------------------------------";
     78        System.out.println(msg);
     79        waitForEnter();
     80        showDbInfo(null);
     81        System.out.println("Starting BASE. Please wait...");
     82        Application.start(false);
     83        SessionControl sc = Application.newSessionControl(null, null, null);
     84        sc.login(new LoginRequest(login, pwd));
     85        int numModified = Update.recalculateRemainingQuantity(new ConsoleProgressReporter(false));
     86        sc.logout();
     87        sc.close();
     88        Application.stop();
    6189      }
    6290      else
  • trunk/src/test/TestChangeHistory.java

    r6430 r6600  
    9595    TestExtract.test_delete(extractId);
    9696   
     97    // 1 CREATE event only
    9798    test_list_by_item(Item.BIOSOURCE, bioSourceId, 1);
    98     test_list_by_item(Item.SAMPLE, sampleId, 7);
     99   
     100    /*
     101      1 CREATE
     102      2 UPDATE (name and externalId)
     103      3 ADD+UPDATE+REMOVE ('change' annotation)
     104      2 UPDATE (remainingQuantity when creating/deleting extract)
     105    */
     106    test_list_by_item(Item.SAMPLE, sampleId, 8);
    99107    /*
    100108      Total change log events:
    101       5 CREATE (biosource, sample, annotationtype, extract, annotation)
    102       4 UPDATE (when updating and removing the annotation from the sample)
    103       2 DELETE (extract, annotation)
     109      4 CREATE (biosource, sample, annotationtype, extract)
     110      1 ADD (annotation)
     111      5 UPDATE (when updating the sample, it's annotation and child extract)
     112      1 REMOVE (annotation)
     113      1 DELETE (extract)
    104114    */
    105     test_list_by_user(TestUtil.getSessionControl().getLoggedInUserId(), since, 11);
     115    test_list_by_user(TestUtil.getSessionControl().getLoggedInUserId(), since, 12);
    106116   
    107117    if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter();
     
    110120    TestBioSource.test_delete(bioSourceId);
    111121    TestAnnotationType.test_delete(annotationTypeId);
    112     // 14 = The original 11 create+update + 3 delete
    113     test_delete_stray(14);
     122    // 15 = The original 12 create+update + 3 delete
     123    test_delete_stray(15);
    114124   
    115125    xtRegistry.unregisterExtension("test.db-logger");
  • trunk/www/WEB-INF/path.tld

    r6154 r6600  
    4545    </attribute>
    4646    <attribute>
     47      <name>subclass</name>
     48      <rtexprvalue>true</rtexprvalue>
     49    </attribute>
     50    <attribute>
    4751      <name>style</name>
    4852      <rtexprvalue>true</rtexprvalue>
    4953    </attribute>
     54    <dynamic-attributes>true</dynamic-attributes>
    5055  </tag>
    5156
     
    6065    <attribute>
    6166      <name>clazz</name>
     67      <rtexprvalue>true</rtexprvalue>
     68    </attribute>
     69    <attribute>
     70      <name>subclass</name>
    6271      <rtexprvalue>true</rtexprvalue>
    6372    </attribute>
     
    8796      <rtexprvalue>true</rtexprvalue>
    8897    </attribute>
     98    <dynamic-attributes>true</dynamic-attributes>
    8999  </tag>
    90100</taglib>
  • trunk/www/admin/pluginconfigurations/configurations.js

    r6400 r6600  
    6969      Buttons.addClickHandler('btnConfigure', configurations.configurePlugin, attributes);
    7070     
     71      if (Doc.element('main.annotations'))
     72      {
     73        TabControl.addTabActivateListener('main.annotations', AnnotationsList.loadOnce);
     74      }
    7175      TabControl.addTabActivateListener('main.history', History.loadOnce);
    7276    }
  • trunk/www/admin/pluginconfigurations/view_configuration.jsp

    r6311 r6600  
    404404      <t:tab id="annotations" title="Annotations"
    405405        tooltip="View annotation values" clazz="white"
    406         visible="<%=plugin != null && plugin.supports("net.sf.basedb.core.plugin.AnnotationSetterPlugin") %>"
    407         activate="AnnotationsList.loadOnce()">
     406        visible="<%=plugin != null && plugin.supports("net.sf.basedb.core.plugin.AnnotationSetterPlugin") %>">
    408407        <jsp:include page="../../common/annotations/list_frameset.jsp">
    409408          <jsp:param name="item_type" value="<%=itemType.name()%>" />
  • trunk/www/admin/plugindefinitions/plugins.js

    r6400 r6600  
    118118      Buttons.addClickHandler('btnUnload', plugins.unloadPlugin, attributes);
    119119      Buttons.addClickHandler('btnToggleDisabled', plugins.toggleDisabled);
    120      
     120
     121      if (Doc.element('main.annotations'))
     122      {
     123        TabControl.addTabActivateListener('main.annotations', AnnotationsList.loadOnce);
     124      }
    121125      TabControl.addTabActivateListener('main.history', History.loadOnce);
    122126    }
  • trunk/www/admin/plugindefinitions/view_plugin.jsp

    r6381 r6600  
    675675    <t:tab id="annotations" title="Annotations"
    676676      tooltip="View annotation values" clazz="white"
    677       visible="<%=!plugin.requiresConfiguration() && plugin.supports("net.sf.basedb.core.plugin.AnnotationSetterPlugin") %>"
    678       activate="AnnotationsList.loadOnce()">
     677      visible="<%=!plugin.requiresConfiguration() && plugin.supports("net.sf.basedb.core.plugin.AnnotationSetterPlugin") %>">
    679678      <jsp:include page="../../common/annotations/list_frameset.jsp">
    680679        <jsp:param name="item_type" value="<%=itemType.name()%>" />
  • trunk/www/common/annotations/list.js

    r6568 r6600  
    7171    url += '&item_type='+Data.get('annotate-data', 'item-type');
    7272    url += '&item_id='+Data.get('annotate-data', 'item-id');
    73     frames['annotations'].location.href = url;
     73    frames['annotations'].location.replace(url);
    7474    loaded = true;
    7575  }
  • trunk/www/common/history/history.js

    r6307 r6600  
    6060    url += '&source_type='+Data.get('history-data', 'source-type');
    6161    url += '&source_id='+Data.get('history-data', 'source-id');
    62     frames['history-frame'].location.href = url;
     62    frames['history-frame'].location.replace(url);
    6363    loaded = true;
    6464  }
  • trunk/www/common/overview/overview.js

    r6242 r6600  
    4141    url += '&item_type='+Data.get('overview-data', 'item-type');
    4242    url += '&item_id='+Data.get('overview-data', 'item-id');
    43     frames['overview'].location.href = url;
     43    frames['overview'].location.replace(url);
    4444    loaded = true;
    4545  }
     
    5151    url += '&item_type='+Data.get('overview-data', 'item-type');
    5252    url += '&item_id='+Data.get('overview-data', 'item-id');
    53     frames['overview'].location.href = url;
     53    frames['overview'].location.replace(url);
    5454  }
    5555 
     
    6060    url += '&item_type='+Data.get('overview-data', 'item-type');
    6161    url += '&item_id='+Data.get('overview-data', 'item-id');
    62     frames['overview'].location.href = url;
     62    frames['overview'].location.replace(url);
    6363  }
    6464
  • trunk/www/common/plugin/parse_file.jsp

    r6540 r6600  
    197197    id="parsedFile"
    198198    subclass="absolutefull dialogtabcontrol"
    199     position="top"
     199    position="top" active="filedata"
    200200    >
    201201  <t:tab
  • trunk/www/views/jobs/index.jsp

    r6447 r6600  
    5858  import="java.util.List"
    5959  import="java.util.ArrayList"
     60  import="java.util.Collection"
    6061  import="java.util.Collections"
    6162%>
     
    278279    redirect = viewPage;
    279280  }
     281  else if ("AbortJobs".equals(cmd))
     282  {
     283    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     284    dc = sc.newDbControl();
     285    int numAborted = 0;
     286    int numSelected = 0;
     287    for (int jobId : cc.getSelected())
     288    {
     289      numSelected++;
     290      Job job = Job.getById(dc, jobId);
     291      SignalTransporter signalTransporter = job.getSignalTransporter();
     292      if (signalTransporter == null)
     293      {
     294        if (job.getStatus() == Job.Status.WAITING)
     295        {
     296          job.doneError("Aborted by user");
     297          numAborted++;
     298        }
     299      }
     300      else
     301      {
     302        Collection<Signal> supportedSignals = signalTransporter.getSupportedSignals();
     303        if (supportedSignals == null || supportedSignals.contains(Signal.ABORT))
     304        {
     305          signalTransporter.send(Signal.ABORT);
     306          numAborted++;
     307        }
     308      }
     309    }
     310    dc.commit();
     311   
     312    message = numAborted + " of " + numSelected + " jobs have been aborted ";
     313    Thread.sleep(500);
     314    redirect = listPage;
     315  }
    280316  else if ("AbortJob".equals(cmd))
    281317  {
  • trunk/www/views/jobs/jobs.js

    r6342 r6600  
    6262      Buttons.addClickHandler('btnDeleteItems', Buttons.deleteItems, tableAttributes);
    6363      Buttons.addClickHandler('btnRestoreItems', Buttons.restoreItems, tableAttributes);
     64      Buttons.addClickHandler('btnAbort', jobs.abortJobs, tableAttributes);
    6465      Buttons.addClickHandler('btnShareItems', Buttons.shareItems, tableAttributes);
    6566      Buttons.addClickHandler('btnSetOwner', Buttons.setOwnerOfItems, tableAttributes);
     
    8081  }
    8182
     83 
     84  jobs.abortJobs = function()
     85  {
     86    var frm = document.forms['jobs'];
     87    var numSelected = Table.checkIfSelected('jobs');
     88    if (numSelected == 0) return;
     89    if (!confirm('You are about to abort '+numSelected+' jobs. This can\'t be undone. Continue?'))
     90    {
     91      return;
     92    }
     93    frm.cmd.value = 'AbortJobs';
     94    frm.submit();
     95  }
    8296 
    8397  jobs.abortJob = function()
  • trunk/www/views/jobs/list_jobs.jsp

    r6447 r6600  
    413413            title="Restore"
    414414            tooltip="Restore the selected (deleted) items"
     415          />
     416          <tbl:button
     417            id="btnAbort"
     418            image="abort.png"
     419            title="Abort&hellip;"
     420            tooltip="Abort the selected items"
    415421          />
    416422          <tbl:button
  • trunk/www/views/rawbioassays/index.jsp

    r6413 r6600  
    347347      {
    348348        ad = arrayDesignId == 0 ? null : ArrayDesign.getById(dc, arrayDesignId);
    349         if (!rba.isSameArrayDesign(ad))
     349        if (!rba.isSameArrayDesign(ad) || !rba.isInDatabase())
    350350        {
    351351          if (rba.hasData())
Note: See TracChangeset for help on using the changeset viewer.