Changeset 6319


Ignore:
Timestamp:
Sep 9, 2013, 9:56:59 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

Merged patch release 3.2.3 to the trunk.

Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/credits.txt

    r6268 r6319  
    11$Id$
    22
    3 The current BASE team is (at BASE 3.2.2 release)
     3The current BASE team is (at BASE 3.2.3 release)
    44{{{
    55Jari Häkkinen
  • trunk/src/clients/web/net/sf/basedb/clients/web/extensions/plot/MAPlotFactory.java

    r5185 r6319  
    2222package net.sf.basedb.clients.web.extensions.plot;
    2323
     24import java.util.ArrayList;
    2425import java.util.List;
    2526
     
    3031import net.sf.basedb.core.BioAssaySet;
    3132import net.sf.basedb.core.DbControl;
     33import net.sf.basedb.core.ItemQuery;
     34import net.sf.basedb.core.query.Hql;
     35import net.sf.basedb.core.query.Orders;
    3236import net.sf.basedb.util.Values;
    3337import net.sf.basedb.util.extensions.InvokationContext;
     
    8690    DbControl dc = context.getClientContext().getDbControl();
    8791    BioAssaySet source = (BioAssaySet)context.getClientContext().getCurrentItem();
    88     boolean hasCfPlot = source.getTransformation().getSource() != null;
    89     List<BioAssay> bioAssays = source.getBioAssays().list(dc);
    90     OverviewPlotAction[] actions = new OverviewPlotAction[hasCfPlot ? 2 : 1];
     92    BioAssaySet parent = source.getTransformation().getSource();
     93    boolean hasCfPlot = parent != null && parent.getDataCubeNo() == source.getDataCubeNo();
     94    ItemQuery<BioAssay> baQuery = source.getBioAssays();
     95    baQuery.order(Orders.asc(Hql.property("name")));
     96    List<BioAssay> bioAssays = baQuery.list(dc);
    9197   
    92     // MA plot
    93     OverviewPlotBean maBean = new OverviewPlotBean();
    94     maBean.setTitle("MA plots");
    95     maBean.setDescription("MA plots for each bioassay in this bioassay set");
    96     maBean.setId("maplots");
    97     String M = HTML.urlEncode("log2(ch(1) / ch(2))");
    98     String A = HTML.urlEncode("log(ch(1) * ch(2)) / 2");
    99     String maFilter = HTML.urlEncode("ch(1) > 0 && ch(2) > 0");
     98    // Plot generators for each bioassay
    10099    PlotGenerator[] maGenerators = new PlotGenerator[bioAssays.size()];
    101     maBean.setPlotGenerators(maGenerators);
    102     actions[0] = maBean;
    103    
    104     // Correction factor plot
    105     PlotGenerator[] cfGenerators = null;
    106     if (hasCfPlot)
    107     {
    108       OverviewPlotBean cfBean = new OverviewPlotBean();
    109       cfBean.setTitle("Correction factor plots");
    110       cfBean.setDescription("MA-plot of the parent bioassays together " +
    111           "with a correction factor for each spot in the current bioassayset.");
    112       cfBean.setId("cfplots");
    113       cfGenerators = new PlotGenerator[bioAssays.size()];
    114       cfBean.setPlotGenerators(cfGenerators);
    115       actions[1] = cfBean;
    116     }
     100    List<PlotGenerator> cfGenerators = hasCfPlot ? new ArrayList<PlotGenerator>(bioAssays.size()) : null;
    117101   
    118102    // Generate plot url:s for each bioassay
    119103    String xLabel = HTML.urlEncode("A, log10(ch1 * ch2) / 2");
    120104    String yLabel = HTML.urlEncode("M, log2(ch1 / ch2)");
     105    String M = HTML.urlEncode("log2(ch(1) / ch(2))");
     106    String A = HTML.urlEncode("log(ch(1) * ch(2)) / 2");
     107    String maFilter = HTML.urlEncode("ch(1) > 0 && ch(2) > 0");
    121108    int index = 0;
    122109    for (BioAssay ba : bioAssays)
     
    143130      maGenerators[index] = maPlot;
    144131      // Correction factor plot
    145       if (hasCfPlot)
     132      if (hasCfPlot && ba.getParents().count(dc) == 1)
    146133      {
    147134        PlotGeneratorBean cfPlot = new PlotGeneratorBean();
     
    159146            "&title="+HTML.urlEncode(ba.getName())
    160147        );
    161         cfGenerators[index] = cfPlot;
     148        cfGenerators.add(cfPlot);
    162149      }
    163150      ++index;
    164151    }
     152
     153    // Main plot actions
     154    hasCfPlot = cfGenerators != null && cfGenerators.size() > 0;
     155    OverviewPlotAction[] actions = new OverviewPlotAction[hasCfPlot ? 2 : 1];
     156
     157    // MA plot
     158    OverviewPlotBean maBean = new OverviewPlotBean();
     159    maBean.setTitle("MA plots");
     160    maBean.setDescription("MA plots for each bioassay in this bioassay set");
     161    maBean.setId("maplots");
     162    maBean.setPlotGenerators(maGenerators);
     163    actions[0] = maBean;
     164   
     165    if (hasCfPlot)
     166    {
     167      OverviewPlotBean cfBean = new OverviewPlotBean();
     168      cfBean.setTitle("Correction factor plots");
     169      cfBean.setDescription("MA-plot of the parent bioassays together " +
     170          "with a correction factor for each spot in the current bioassayset.");
     171      cfBean.setId("cfplots");
     172      cfBean.setPlotGenerators(cfGenerators.toArray(new PlotGenerator[cfGenerators.size()]));
     173      actions[1] = cfBean;
     174    }
     175   
    165176    return actions;
    166177  }
  • trunk/src/clients/web/net/sf/basedb/clients/web/formatter/ColorFormatter.java

    r6127 r6319  
    6868    if (color != null)
    6969    {
    70       sb.append("class=\"colorbox\" style=\"background: #");
     70      sb.append("class=\"colorbox inline\" style=\"background: #");
    7171      sb.append(ColorGenerator.toHex(color));
    7272      sb.append(";\"");
     
    7474    else
    7575    {
    76       sb.append("class=\"colorbox nan\"");
     76      sb.append("class=\"colorbox inline nan\"");
    7777    }
    78     sb.append("></div>");
     78    sb.append("></div> ");
    7979    sb.append(numberFormatter.format(value));
    8080    return sb.toString();
  • trunk/src/clients/web/net/sf/basedb/clients/web/plugins/SimpleExport.java

    r6127 r6319  
    627627        if (progress != null)
    628628        {
    629           int percent = (int)(100L * numExported / totalItems);
     629          int percent = (int)(99L * numExported / totalItems);
    630630          progress.display(percent, numExported + " of " + totalItems + " done.");
    631631        }
     632      }
     633     
     634      if (progress != null)
     635      {
     636        progress.display(100, numExported + " of " + totalItems + " done.");
    632637      }
    633638     
  • trunk/src/core/net/sf/basedb/core/AnnotationSet.java

    r6127 r6319  
    399399  {
    400400    super.onBeforeCommit(action);
     401    if (action == Action.CREATE && item != null && item.getId() != 0)
     402    {
     403      getData().setItemId(item.getId());
     404    }
    401405    if ((snapshotIsInvalid && action == Action.UPDATE) || action == Action.DELETE)
    402406    {
  • trunk/src/core/net/sf/basedb/core/log/EntityDetails.java

    r6080 r6319  
    2929import org.hibernate.collection.PersistentCollection;
    3030import org.hibernate.type.Type;
    31 import org.hibernate.type.VersionType;
    3231
    3332/**
     
    6665    this.types = types;
    6766    this.dirty = new int[types.length]; // 0 = not known, -1 = not dirty, 1 = dirty
    68     findDirtyCollections();
     67    initializeDirtynessForSomeProperties();
    6968  }
    7069   
     
    124123    if (dirty[index] == 0)
    125124    {
     125      Type t = types[index];
    126126      Object c = state[index];
    127127      Object o = previousState[index];
    128       dirty[index] = types[index].isEqual(c, o, EntityMode.POJO) ? -1 : 1;
     128      dirty[index] = t.isEqual(c, o, EntityMode.POJO) ? -1 : 1;
    129129    }
    130130    return dirty[index];
     
    152152    for (int i = 0; i < types.length; ++i)
    153153    {
    154       if (dirty[i] == 0)
    155       {
    156         Type t = types[i];
    157         if (!t.isCollectionType() && !(t instanceof VersionType))
    158         {
    159           Object c = state[i];
    160           Object o = previousState[i];
    161           dirty[i] = t.isEqual(c, o, EntityMode.POJO) ? -1 : 1;
    162         }
    163       }
    164       if (dirty[i] == 1)
     154      if (getDirty(i) == 1)
    165155      {
    166156        modified.append(s).append(properties[i]);
     
    171161    if (suffix != null) modified.append(suffix);
    172162    return numModified == 0 ? null : modified.toString();
     163  }
     164 
     165  /**
     166    Checks if the given property is the only modified property.
     167    @param property
     168    @return TRUE if the given property (but no other) is dirty, FALSE in
     169      all other cases
     170    @since 3.2.3
     171  */
     172  public boolean isOnlyDirty(String property)
     173  {
     174    boolean propertyIsDirty = false;
     175    for (int i = 0; i < types.length; ++i)
     176    {
     177      if (getDirty(i) == 1)
     178      {
     179        if (property.equals(properties[i]))
     180        {
     181          propertyIsDirty = true;
     182        }
     183        else
     184        {
     185          // Found another dirty property
     186          return false;
     187        }
     188      }
     189    }
     190    return propertyIsDirty;
    173191  }
    174192 
     
    211229 
    212230  /**
    213     We must do this from the constructor since the "dirtyness" of a
     231    We must initialize "dirtyness" for collections and some other
     232    properties from the constructor. The "dirtyness" of a
    214233    collection is reset after flush the SQL to the database, which is
    215234    completed before the rest of the logging is done.
    216235  */
    217   private void findDirtyCollections()
     236  private void initializeDirtynessForSomeProperties()
    218237  {
    219238    for (int i = 0; i < types.length; ++i)
     
    227246          dirty[i] = ((PersistentCollection)c).isDirty() ? 1 : -1;
    228247        }
     248        else
     249        {
     250          dirty[i] = -1;
     251        }
     252      }
     253      else if ("version".equals(properties[i]))
     254      {
     255        // Always ignore changes to the "version" property
     256        dirty[i] = -1;
    229257      }
    230258    }
  • trunk/src/core/net/sf/basedb/core/log/LoggingInterceptor.java

    r6079 r6319  
    149149  public void afterTransactionCompletion(Transaction tx)
    150150  {
    151     if (logHandlers == null)
     151    if (logHandlers != null)
    152152    {
    153153      boolean rollback = tx.wasRolledBack();
  • trunk/src/core/net/sf/basedb/core/log/db/AnnotationSetLogger.java

    r6080 r6319  
    6666    if (details.getChangeType() != ChangeType.UPDATE) return;
    6767   
     68    // If the only modified property is the 'itemId' value, do not log it as a change
     69    if (details.isOnlyDirty("itemId")) return;
     70   
    6871    LogControl logControl = logManager.getLogControl();
    6972    AnnotationSetData as = (AnnotationSetData)details.getEntity();
  • trunk/www/admin/itemsubtypes/index.jsp

    r6300 r6319  
    6868  private static final Item itemType = Item.ITEMSUBTYPE;
    6969
     70  private static void registerExportUtils(ItemContext cc)
     71  {
     72    // Register formatters
     73    cc.setObject("export.formatter.&fileTypes(dataFileType.name)", new NameableFormatter());
     74   
     75    // Register dataloaders
     76    String subtypeParameter = "subtype";
     77    // File types
     78    final ItemQuery<DataFileType> fileTypesQuery = DataFileType.getQuery();
     79    fileTypesQuery.include(cc.getInclude());
     80    fileTypesQuery.join(Hql.innerJoin("itemSubtypes", "ist"));
     81    fileTypesQuery.join(Hql.innerJoin("ist", "itemSubtype", "ist2"));
     82    fileTypesQuery.restrict(Restrictions.eq(Hql.alias("ist2"), Expressions.parameter("subtype")));
     83    fileTypesQuery.order(Orders.asc(Hql.property("name")));
     84    cc.setObject("export.dataloader.&fileTypes(dataFileType.name)", new ItemQueryLoader(fileTypesQuery, subtypeParameter));
     85  }
     86
    7087%>
    7188<%
     
    273290    cc.configureQuery(dc, query, true);
    274291    cc.setQuery(query);
     292    registerExportUtils(cc);
    275293    JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null);
    276294    ExtensionsInvoker listInvoker = ListColumnUtil.useExtensions(jspContext);
     
    283301    // Run an export plugin in single-item context
    284302    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     303    registerExportUtils(cc);
    285304    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+item+subtype";
    286305  }
  • trunk/www/admin/itemsubtypes/list_subtypes.jsp

    r6289 r6319  
    103103  fileTypesQuery.include(cc.getInclude());
    104104  fileTypesQuery.join(Hql.innerJoin("itemSubtypes", "ist"));
    105   fileTypesQuery.restrict(Restrictions.eq(Hql.alias("ist"), Expressions.parameter("subtype")));
     105  fileTypesQuery.join(Hql.innerJoin("ist", "itemSubtype", "ist2"));
     106  fileTypesQuery.restrict(Restrictions.eq(Hql.alias("ist2"), Expressions.parameter("subtype")));
    106107  fileTypesQuery.order(Orders.asc(Hql.property("name")));
    107108
     
    220221        id="dataFileTypes"
    221222        title="File types"
    222         property="&dataFileTypes(name)"
     223        property="&fileTypes(dataFileType.name)"
    223224        datatype="string"
    224225        filterable="true"
  • trunk/www/biomaterials/extracts/list_extracts.jsp

    r6307 r6319  
    720720                    %>
    721721                    <base:propertyvalue item="<%=item%>" property="parent" />
    722                     <%=usedQuantity != null ? "(" + usedQuantity + "µg)" : ""%>
     722                    <%=usedQuantity != null ? "(" + numericFormatter.format(usedQuantity) + "µg)" : ""%>
    723723                    <%
    724724                  }
     
    741741                      if (usedQuantity != null)
    742742                      {
    743                         out.write(" (" + usedQuantity + "µg)");
     743                        out.write(" (" + numericFormatter.format(usedQuantity) + "µg)");
    744744                      }
    745745                      separator = ", ";
  • trunk/www/biomaterials/samples/list_samples.jsp

    r6268 r6319  
    720720                    %>
    721721                    <base:propertyvalue item="<%=item%>" property="parent"/>
    722                     <%=usedQuantity != null ? "(" + usedQuantity + "µg)" : ""%>
     722                    <%=usedQuantity != null ? "(" + numericFormatter.format(usedQuantity) + "µg)" : ""%>
    723723                    <%
    724724                  }
     
    741741                      if (usedQuantity != null)
    742742                      {
    743                         out.write(" (" + usedQuantity + "µg)");
     743                        out.write(" (" + numericFormatter.format(usedQuantity) + "µg)");
    744744                      }
    745745                      separator = ", ";
  • trunk/www/common/annotations/annotate.jsp

    r6246 r6319  
    3939  import="net.sf.basedb.core.Subtypable"
    4040  import="net.sf.basedb.core.ItemSubtype"
     41  import="net.sf.basedb.core.BioPlateType"
     42  import="net.sf.basedb.core.BioPlate"
    4143  import="net.sf.basedb.core.AnnotationSet"
    4244  import="net.sf.basedb.core.Annotation"
     
    142144  {
    143145    ItemSubtype subtype = null;
    144     if (subtypeId == -1 && item != null && item instanceof Subtypable)
     146    if (subtypeId > 0)
     147    {
     148      subtype = ItemSubtype.getById(dc, subtypeId);
     149    }
     150    else if (item instanceof Subtypable)
    145151    {
    146152      subtype = ((Subtypable)item).getItemSubtype();
    147153    }
    148     else if (subtypeId > 0)
    149     {
    150       subtype = ItemSubtype.getById(dc, subtypeId);
     154    else if (item instanceof BioPlate)
     155    {
     156      BioPlateType bpt = ((BioPlate)item).getBioPlateType();
     157      subtype = bpt.getItemSubtype();
     158      if (subtype == null) selectedCategoryName = bpt.getName();
    151159    }
    152160    if (subtype != null) selectedCategoryName = subtype.getName();
  • trunk/www/common/plugin/index.jsp

    r6192 r6319  
    589589  else if ("ExportImmediately".equals(cmd))
    590590  {
     591    out.clearBuffer();
    591592    PluginResponse pluginResponse = (PluginResponse)sc.getSessionSetting("plugin.configure.response");
    592593    ExportOutputStream exportStream = new ServletExportOutputStream(response);
  • trunk/www/filemanager/directories/list_directories.jsp

    r6308 r6319  
    280280      if (window.top.setSelected)
    281281      {
    282         //window.top.setSelected('', path);
     282        window.top.setSelected('', path);
    283283      }
    284284    }
  • trunk/www/include/styles/main.css

    r6286 r6319  
    691691}
    692692
    693 /* Otline for a colored box; background should be set on the element */
     693/* Outline for a colored box; background should be set on the element */
    694694.colorbox
    695695{
     
    697697  height: 1em;
    698698  border: 1px solid #A0A0A0;
     699}
     700
     701/* Color box inline with other text */
     702.colorbox.inline
     703{
     704  display: inline-block;
    699705}
    700706
  • trunk/www/plugins/net/sf/basedb/plugins/executor/external_plugin_parameters.jsp

    r6217 r6319  
    8181  {
    8282    externalParameters = ParameterDefinition.parseXml(xml, false);
    83     if (true) throw new RuntimeException("fff");
    8483  }
    8584  catch (Throwable ex)
  • trunk/www/views/physicalbioassays/list_bioassays.jsp

    r6311 r6319  
    131131  int numListed = 0;
    132132  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     133  Formatter<Number> numericFormatter = FormatterFactory.getNumberFormatter(sc);
    133134  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null);
    134135  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
     
    571572                        if (usedQuantity != null)
    572573                        {
    573                           out.write(usedQuantity + "µg");
     574                          out.write(numericFormatter.format(usedQuantity) + "µg");
    574575                          if (tag != null) out.write("; ");
    575576                        }
Note: See TracChangeset for help on using the changeset viewer.