Changeset 3451


Ignore:
Timestamp:
Jun 5, 2007, 12:07:54 PM (14 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #588

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3.1/src/plugins/core/net/sf/basedb/plugins/BioAssaySetExporter.java

    r3441 r3451  
    206206          throw new BaseException("Unknown field in reporter fields: "+field);
    207207        }
    208         query.select(Selects.expression(BioAssaySetUtil.createJepExpression(dc, bas, qi.getJep(), true), field));
     208        query.select(Selects.expression(BioAssaySetUtil.createJepExpression(dc, bas, qi.getJep(), true), qi.getQueryAlias()));
    209209      }
    210210      for (String field : spotFields)
     
    215215          throw new BaseException("Unknown field in spot fields: "+field);
    216216        }
    217         query.select(Selects.expression(BioAssaySetUtil.createJepExpression(dc, bas, qi.getJep(), true), field));
     217        query.select(Selects.expression(BioAssaySetUtil.createJepExpression(dc, bas, qi.getJep(), true), qi.getQueryAlias()));
    218218      }
    219219      if (mergeReporters)
     
    221221        throw new BaseException("'Merge on reporter' not implemented");
    222222      }   
    223       exportBaseFileSectionSpots(out, dc, bas, query, reporterFields, spotFields, bas.getBioAssays().list(dc));
     223      exportBaseFileSectionSpots(out, dc, bas, query, reporterFields, spotFields, bas.getBioAssays().list(dc), qis);
    224224    }
    225225    finally
     
    293293          if (qi == null)
    294294            throw new BaseException("Unknown column: "+field+" (you can add this field using a formula)");
    295           query.select(Selects.expression(BioAssaySetUtil.createJepExpression(dc, bas, qi.getJep(), true), field));
     295          query.select(Selects.expression(BioAssaySetUtil.createJepExpression(dc, bas, qi.getJep(), true), qi.getQueryAlias()));
    296296        }
    297297        for (String field : spotFields)
     
    300300          if (qi == null)
    301301            throw new BaseException("Unknwon field: "+field+" (you can add this field using a formula)");
    302           query.select(Selects.expression(BioAssaySetUtil.createJepExpression(dc, bas, qi.getJep(), true), field));
     302          query.select(Selects.expression(BioAssaySetUtil.createJepExpression(dc, bas, qi.getJep(), true), qi.getQueryAlias()));
    303303        }
    304304        if (mergeReporters)
     
    307307        }
    308308 
    309         exportBaseFileSectionSpots(out, dc, bas, query, reporterFields, spotFields, Collections.singletonList(ba));
     309        exportBaseFileSectionSpots(out, dc, bas, query, reporterFields, spotFields, Collections.singletonList(ba), qis);
    310310       
    311311        out.println();
     
    320320
    321321  private void exportBaseFileSectionSpots(PrintWriter out, DbControl dc, BioAssaySet bas, DynamicSpotQuery query,
    322     List<String> reporterFields, List<String> spotFields, List<BioAssay> assays)
     322    List<String> reporterFields, List<String> spotFields, List<BioAssay> assays, Map<String, QueryItem> qi)
    323323    throws SQLException
    324324  {
     
    365365    for (String column : reporterFields)
    366366    {
    367       reporterIndex.add(iterator.getIndex(column));
     367      reporterIndex.add(iterator.getIndex(qi.get(column).getQueryAlias()));
    368368    }
    369369    for (String field : spotFields)
    370370    {
    371       spotIndex.add(iterator.getIndex(field));
     371      spotIndex.add(iterator.getIndex(qi.get(field).getQueryAlias()));
    372372    }
    373373    int posIndex = iterator.getIndex("_position");
     
    10241024   
    10251025    private String jep;
     1026
     1027    private String queryAlias;
    10261028   
    10271029    QueryItem(String name, String title, String jep)
     
    10301032      this.title = title;
    10311033      this.jep = jep;
    1032     }
     1034      this.queryAlias = "a" + Math.abs(System.identityHashCode(name));
     1035  }
    10331036
    10341037    public final String getJep()
     
    10451048    {
    10461049      return title;
     1050    }
     1051
     1052    public final String getQueryAlias()
     1053    {
     1054      return queryAlias;
    10471055    }
    10481056  }
Note: See TracChangeset for help on using the changeset viewer.