Changeset 5897
- Timestamp:
- Dec 2, 2011, 12:09:46 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/DynamicUtil.java
r5887 r5897 139 139 List<ClonableProperty> properties = template == null ? 140 140 ClonableProperty.getAll() : template.getClonableProperties(); 141 141 String jepFunction = propertyPrefix != null && propertyPrefix.startsWith("@@") ? "mrep": "rep"; 142 142 SessionControl sc = dc.getSessionControl(); 143 143 for (ClonableProperty cp : properties) 144 144 { 145 145 String name = cp.getName(); 146 TableColumn tc = new TableColumn(idPrefix + name, propertyPrefix + name, "rep('"+name+"')",146 TableColumn tc = new TableColumn(idPrefix + name, propertyPrefix + name, jepFunction + "('"+name+"')", 147 147 cp.getType(), titlePrefix + cp.getTitle(), cp.getDescription(), "auto", true, true, true, 148 148 cp.getAverageMethod(), FormatterFactory.getExtendedPropertyFormatter(sc, cp)); -
trunk/src/clients/web/net/sf/basedb/clients/web/ExperimentExplorer.java
r5892 r5897 79 79 import net.sf.basedb.core.query.Select; 80 80 import net.sf.basedb.core.query.Selects; 81 import net.sf.basedb.core.query.SqlQuery; 81 82 import net.sf.basedb.core.query.SqlResult; 82 83 import net.sf.basedb.core.snapshot.SnapshotManager; … … 663 664 {@link net.sf.basedb.core.DataQuery}. This means that we don't get 664 665 {@link ReporterData} objects as a result and that we must specify the 665 properties to select (see {@link ItemContext#configureQuery(DbControl, net.sf.basedb.core.AbstractSqlQuery, List)}).666 properties to select (see {@link ItemContext#configureQuery(DbControl, SqlQuery, List)}). 666 667 <p> 667 668 The reporter id is always included as the first selected property so it … … 683 684 @param selectionList The properties that the query should select 684 685 @return A query 685 @see ItemContext#configureQuery(DbControl, net.sf.basedb.core.AbstractSqlQuery, List)686 @see ItemContext#configureQuery(DbControl, SqlQuery, List) 686 687 */ 687 688 public DynamicReporterQuery getReporterQuery(DbControl dc, List<String> selectionList) … … 718 719 719 720 reporterQuery.select(Selects.expression(Dynamic.reporter("id"), "id", true)); 720 cc.configureQuery(dc, reporterQuery, selectionList);721 cc.configureQuery(dc, (SqlQuery)reporterQuery, selectionList); 721 722 722 723 // Do not return the total count. Do not set paging options. … … 949 950 cc.setPropertyInspector(null); 950 951 } 951 cc.configureQuery(dc, reporterQuery, null);952 cc.configureQuery(dc, (SqlQuery)reporterQuery, null); 952 953 reporterQuery.order(Orders.asc(Expressions.selected(position))); 953 954 reporterQuery.setDistinct(true); -
trunk/src/clients/web/net/sf/basedb/clients/web/plugins/DynamicQueryWrapper.java
r4512 r5897 27 27 import net.sf.basedb.core.DynamicQuery; 28 28 import net.sf.basedb.core.query.ResultIterator; 29 import net.sf.basedb.core.query.SqlQuery; 29 30 import net.sf.basedb.core.query.SqlResult; 30 31 … … 39 40 implements QueryWrapper<SqlResult> 40 41 { 41 private final DynamicQuery query;42 private final SqlQuery query; 42 43 private final DbControl dc; 43 44 private int counter = 0; … … 49 50 @param query The query 50 51 */ 51 public DynamicQueryWrapper(DbControl dc, DynamicQuery query)52 public DynamicQueryWrapper(DbControl dc, SqlQuery query) 52 53 { 53 54 this.dc = dc; -
trunk/src/clients/web/net/sf/basedb/clients/web/plugins/SimpleExport.java
r5843 r5897 29 29 import net.sf.basedb.core.DataQuery; 30 30 import net.sf.basedb.core.DbControl; 31 import net.sf.basedb.core.DynamicQuery;32 31 import net.sf.basedb.core.InvalidUseOfNullException; 33 32 import net.sf.basedb.core.Item; … … 63 62 import net.sf.basedb.core.query.Restrictions; 64 63 import net.sf.basedb.core.query.ResultIterator; 64 import net.sf.basedb.core.query.SqlQuery; 65 65 import net.sf.basedb.core.signal.SignalHandler; 66 66 import net.sf.basedb.core.signal.SignalTarget; … … 225 225 ItemContext cc = sc.getCurrentContext(itemType, subContext); 226 226 227 // 227 Query query = cc.getQuery(); 228 boolean isSqlQuery = query instanceof SqlQuery; 229 228 230 String entityName = null; 229 231 Class entityClass = null; 230 232 Metadata metadata = null; 231 if (itemType == Item.RAWDATA) 232 { 233 RawBioAssay rba = RawBioAssay.getById(dc, sc.getCurrentContext(Item.RAWBIOASSAY).getId()); 234 entityName = rba.getRawDataType().getEntityName(); 235 entityClass = RawData.class; 236 } 237 else if (itemType == Item.REPORTERSCORE) 238 { 239 entityClass = ReporterScore.class; 240 entityName = ReporterListScoreData.class.getName(); 241 } 242 else if (itemType.getItemClass() != null) 243 { 244 entityClass = itemType.getItemClass(); 245 } 246 else 247 { 248 entityClass = itemType.getDataClass(); 249 } 250 if (entityName != null) 251 { 252 metadata = Metadata.getInstance(entityClass, entityName); 253 } 254 else if (entityClass != null) 255 { 256 metadata = Metadata.getInstance(entityClass); 233 if (!isSqlQuery) 234 { 235 if (itemType == Item.RAWDATA) 236 { 237 RawBioAssay rba = RawBioAssay.getById(dc, sc.getCurrentContext(Item.RAWBIOASSAY).getId()); 238 entityName = rba.getRawDataType().getEntityName(); 239 entityClass = RawData.class; 240 } 241 else if (itemType == Item.REPORTERSCORE) 242 { 243 entityClass = ReporterScore.class; 244 entityName = ReporterListScoreData.class.getName(); 245 } 246 else if (itemType.getItemClass() != null) 247 { 248 entityClass = itemType.getItemClass(); 249 } 250 else 251 { 252 entityClass = itemType.getDataClass(); 253 } 254 if (entityName != null) 255 { 256 metadata = Metadata.getInstance(entityClass, entityName); 257 } 258 else if (entityClass != null) 259 { 260 metadata = Metadata.getInstance(entityClass); 261 } 257 262 } 258 263 … … 291 296 292 297 // Get the query from the current context 293 Query query = cc.getQuery();294 298 Set<Integer>selectedItems = cc.getSelected(); 295 if ( query instanceof DynamicQuery)296 { 297 cc.configureQuery(dc, ( DynamicQuery)query, properties);299 if (isSqlQuery) 300 { 301 cc.configureQuery(dc, (SqlQuery)query, properties); 298 302 } 299 303 … … 517 521 queryWrapper = new ReporterScoreQueryWrapper(dc, (ReporterScoreQuery)query); 518 522 } 519 else if (query instanceof DynamicQuery)520 { 521 DynamicQuery dynamicQuery = (DynamicQuery)query;523 else if (query instanceof SqlQuery) 524 { 525 SqlQuery dynamicQuery = (SqlQuery)query; 522 526 queryWrapper = new DynamicQueryWrapper(dc, dynamicQuery); 523 527 } -
trunk/src/core/net/sf/basedb/core/AbstractSqlQuery.java
r5885 r5897 52 52 @base.modified $Date$ 53 53 */ 54 abstract class AbstractSqlQuery54 public abstract class AbstractSqlQuery 55 55 extends AbstractQuery 56 56 implements SqlQuery … … 143 143 @throws BaseException If there is an error 144 144 */ 145 @Override 145 146 public DynamicResultIterator iterate(DbControl dc) 146 147 throws BaseException -
trunk/src/core/net/sf/basedb/core/DynamicQuery.java
r5879 r5897 50 50 public abstract class DynamicQuery 51 51 extends AbstractSqlQuery 52 implements ClonableReporterQuery 52 53 { 53 54 … … 109 110 // ------------------------------------------- 110 111 112 /* 113 From the ClonableReporterQuery interface 114 ---------------------------------------- 115 */ 111 116 /** 112 117 Check if the virtual database that this query is using has … … 114 119 @since 3.1 115 120 */ 121 @Override 116 122 public boolean hasClonedReporters() 117 123 { … … 127 133 @since 3.1 128 134 */ 135 @Override 129 136 public boolean useClonedReporters() 130 137 { … … 138 145 @since 3.1 139 146 */ 147 @Override 140 148 public void setUseClonedReporters(boolean useClonedReporters) 141 149 { 142 150 this.useClonedReporters = hasClonedReporters && useClonedReporters; 143 151 } 152 153 /** 154 Get the virtual database that this query is using. 155 @return A virtual database item 156 @since 3.1 157 */ 158 @Override 159 public VirtualDb getVirtualDb() 160 { 161 return virtualDb; 162 } 163 // ------------------------------------------- 144 164 145 165 /** … … 159 179 return cube; 160 180 } 161 /** 162 Get the virtual database that this query is using. 163 @return A virtual database item 164 @since 3.1 165 */ 166 public VirtualDb getVirtualDb() 167 { 168 return virtualDb; 169 } 181 170 182 VirtualTable getRootTable() 171 183 { -
trunk/src/core/net/sf/basedb/core/DynamicReporterQuery.java
r5885 r5897 43 43 public class DynamicReporterQuery 44 44 extends AbstractSqlQuery 45 implements ClonableReporterQuery 45 46 { 46 47 47 private final RealTable rootTable; 48 private final String rootAlias; 49 private final VirtualDb virtualDb; 50 private final boolean hasClonedReporters; 51 private boolean useClonedReporters; 48 52 private Set<Object> joinedItems; 49 53 … … 54 58 { 55 59 super(RealTable.REPORTERS.getQualifiedTableName()); 56 this.root Table = RealTable.REPORTERS;60 this.rootAlias = RealTable.REPORTERS.getAlias(); 57 61 joinedItems = new HashSet<Object>(); 62 this.virtualDb = null; 63 this.hasClonedReporters = false; 58 64 setAutoJoinType(JoinType.LEFT); 59 65 } 60 66 67 /** 68 Create a new dynamic query for reporter data using cloned 69 reporter information. 70 @since 3.1 71 */ 61 72 DynamicReporterQuery(VirtualDb vdb) 62 73 { 63 74 super(VirtualTable.CLONED_REPORTERS.getQualifiedTableName(vdb)); 64 this.rootTable = RealTable.REPORTERS; 75 this.rootAlias = VirtualTable.CLONED_REPORTERS.getAlias(); 76 this.virtualDb = vdb; 77 this.hasClonedReporters = virtualDb.hasClonedReporters(); 78 this.useClonedReporters = hasClonedReporters; 65 79 joinedItems = new HashSet<Object>(); 66 80 setAutoJoinType(JoinType.LEFT); … … 77 91 public String getRootAlias() 78 92 { 79 return HibernateUtil.quote(root Table.getAlias());93 return HibernateUtil.quote(rootAlias); 80 94 } 81 95 public boolean isReadonly() … … 98 112 // ------------------------------------------- 99 113 100 /* 101 RealTable getRootTable() 102 { 103 return rootTable; 104 } 105 */ 106 114 /** 115 Check if the virtual database that this query is using has 116 cloned reporter annotations or not. 117 @since 3.1 118 */ 119 @Override 120 public boolean hasClonedReporters() 121 { 122 return hasClonedReporters; 123 } 124 125 /** 126 Checks if this query is using cloned reporter or not by default. 127 The default setting is to use cloned reporters if they are available 128 in the experiment. 129 130 @return TRUE if this query is using cloned reporters, FALSE if not 131 @since 3.1 132 */ 133 @Override 134 public boolean useClonedReporters() 135 { 136 return useClonedReporters; 137 } 138 139 /** 140 Set if cloned reporters should be used by default or not. 141 @param useClonedReporters TRUE to use cloned reporters by default, FALSE 142 to use the master reporters 143 @since 3.1 144 */ 145 @Override 146 public void setUseClonedReporters(boolean useClonedReporters) 147 { 148 this.useClonedReporters = hasClonedReporters && useClonedReporters; 149 } 150 151 /** 152 Get the virtual database that this query is using. 153 @return A virtual database item (can be null if hasClonedReporter is false) 154 @since 3.1 155 */ 156 @Override 157 public VirtualDb getVirtualDb() 158 { 159 return virtualDb; 160 } 161 // ------------------------------------------- 162 107 163 /** 108 164 Makes a join with a <code>ReporterList</code> 109 165 @param reporterList To do the join on. 110 166 @param joinType The join type to use. 111 112 167 @see net.sf.basedb.core.query.JoinType 168 @since 3.0 113 169 */ 114 170 public void joinReporterList(ReporterList reporterList, JoinType joinType) … … 118 174 if (!joinedItems.contains(reporterList)) 119 175 { 120 join(new ReporterListJoin(reporterList, joinType, RealTable.REPORTERS, "id")); 176 if (useClonedReporters()) 177 { 178 join(new ReporterListJoin(reporterList, joinType, VirtualTable.CLONED_REPORTERS, VirtualColumn.REPORTER_ID_PK)); 179 } 180 else 181 { 182 join(new ReporterListJoin(reporterList, joinType, RealTable.REPORTERS, "id")); 183 } 121 184 joinedItems.add(reporterList); 185 } 186 } 187 188 /** 189 Join the master reporter table into this query. This is ignored unless the 190 query rooted at the cloned reporters table. 191 @param joinType The join type to use 192 @since 3.1 193 */ 194 public void joinMasterReporters(JoinType joinType) 195 { 196 if (joinType == null) throw new InvalidUseOfNullException("joinType"); 197 if (hasClonedReporters() && !joinedItems.contains(RealTable.REPORTERS)) 198 { 199 join(new RealJoin(joinType, VirtualTable.CLONED_REPORTERS, RealTable.REPORTERS, VirtualColumn.REPORTER_ID_PK)); 200 joinedItems.add(RealTable.REPORTERS); 122 201 } 123 202 } … … 133 212 { 134 213 addAutoJoiner(getReporterListJoiner(joinType)); 214 addAutoJoiner(getMasterReporterJoiner(joinType)); 135 215 } 136 216 … … 146 226 147 227 /** 228 Get a joiner instance for joining the master reporter table 229 when the root query is against the cloned reporters table. 230 @param joinType The type of join 231 @since 3.1 232 */ 233 public static MasterReporterJoiner getMasterReporterJoiner(JoinType joinType) 234 { 235 return new MasterReporterJoiner(joinType); 236 } 237 238 /** 148 239 Auto joiner for reporter lists. 149 240 @since 3.0 150 241 */ 151 privatestatic class ReporterListJoiner242 static class ReporterListJoiner 152 243 implements AutoJoiner<DynamicReporterQuery, ReporterListExpression> 153 244 { … … 182 273 } 183 274 275 /** 276 Auto joiner for master reporter table. 277 @since 3.1 278 */ 279 static class MasterReporterJoiner 280 implements AutoJoiner<DynamicReporterQuery, ReporterPropertyExpression> 281 { 282 private final JoinType joinType; 283 284 private MasterReporterJoiner(JoinType joinType) 285 { 286 this.joinType = joinType; 287 } 288 289 /* 290 From the AutoJoiner interface 291 ------------------------------------------- 292 */ 293 @Override 294 public Class<DynamicReporterQuery> getQueryClass() 295 { 296 return DynamicReporterQuery.class; 297 } 298 @Override 299 public Class<ReporterPropertyExpression> getElementClass() 300 { 301 return ReporterPropertyExpression.class; 302 } 303 @Override 304 public void joinIfNeeded(DynamicReporterQuery query, ReporterPropertyExpression element) 305 { 306 query.joinMasterReporters(joinType); 307 } 308 // ------------------------------------------- 309 } 310 184 311 } -
trunk/src/core/net/sf/basedb/core/ItemContext.java
r5892 r5897 36 36 import net.sf.basedb.core.query.Select; 37 37 import net.sf.basedb.core.query.Selects; 38 import net.sf.basedb.core.query.SqlQuery; 38 39 import net.sf.basedb.core.data.ContextData; 39 40 import net.sf.basedb.core.data.PropertyFilterData; … … 165 166 private static final JepFunction rawCh = new RawChannelFunction(); 166 167 private static final JepFunction raw = new RawFunction(true); 167 private static final JepFunction rep = new ReporterFunction(); 168 private static final JepFunction rep = new ReporterFunction(false); 169 private static final JepFunction mrep = new ReporterFunction(true); 168 170 169 171 private final String name; … … 1151 1153 that are allowed to be used in queries. If a filter has been set the 1152 1154 {@link #configureQuery(DbControl, EntityQuery, boolean)} and 1153 {@link #configureQuery(DbControl, AbstractSqlQuery, List)} methods will1155 {@link #configureQuery(DbControl, SqlQuery, List)} methods will 1154 1156 check each property before it is used for sorting, filtering, etc. 1155 1157 … … 1398 1400 1399 1401 /** 1402 @deprecated In 3.1, use {@link #configureQuery(DbControl, SqlQuery, List)} instead 1403 */ 1404 @Deprecated 1405 public void configureQuery(DbControl dc, AbstractSqlQuery query, List<String> selectionList) 1406 { 1407 configureQuery(dc, (SqlQuery)query, selectionList); 1408 } 1409 1410 /** 1400 1411 Use the settings in this context to configure a dynamic query. 1401 1412 <ul> … … 1409 1420 @param selectionList A list of expression that we want to select 1410 1421 from the query 1411 @throws BaseException If the configuring the query fails. 1412 */ 1413 public void configureQuery(DbControl dc, AbstractSqlQuery query, List<String> selectionList) 1422 @throws BaseException If the configuring the query fails. 1423 @since 3.1 1424 */ 1425 public void configureQuery(DbControl dc, SqlQuery query, List<String> selectionList) 1414 1426 throws BaseException 1415 1427 { … … 1486 1498 { 1487 1499 setMessage(ex.getClass().getSimpleName() + ": " + ex.getMessage()); 1500 ex.printStackTrace(); 1488 1501 } 1489 1502 } … … 1508 1521 <li>$: The rest of the string is a raw data property name. We use 1509 1522 the {@link Dynamic#rawData(String)} to create the expression. 1510 1523 1524 <li>@@: The rest of the string is a reporter property name. We use 1525 the {@link Dynamic#reporter(String, Boolean)} with to create the 1526 expression. The second parameter is FALSE to force using the master 1527 reporter table. 1528 1511 1529 <li>@: The rest of the string is a reporter property name. We use 1512 the {@link Dynamic#reporter(String)} to create the expression. 1530 the {@link Dynamic#reporter(String)} to create the expression 1531 and let the query decide if it should use the cloned or master 1532 reporter table. 1513 1533 1514 1534 <li>#: The rest of the string is the id of an extra value. … … 1547 1567 e = Dynamic.rawData(propertyDef.substring(1)); 1548 1568 } 1569 else if (propertyDef.startsWith("@@")) 1570 { 1571 // propertyDef is @@reporterPropertyName (from master table) 1572 e = Dynamic.reporter(propertyDef.substring(2), false); 1573 } 1549 1574 else if (propertyDef.startsWith("@")) 1550 1575 { … … 1567 1592 { 1568 1593 // propertyDef is JEP expression 1569 e = Jep.formulaToExpression(propertyDef.substring(1), ch, rawCh, raw, rep );1594 e = Jep.formulaToExpression(propertyDef.substring(1), ch, rawCh, raw, rep, mrep); 1570 1595 } 1571 1596 else … … 1607 1632 s = Dynamic.selectRawData(propertyDef.substring(1)); 1608 1633 } 1634 else if (propertyDef.startsWith("@@")) 1635 { 1636 // propertyDef is @@reporterPropertyName (from master table) 1637 s = Dynamic.selectReporter(propertyDef.substring(2), false); 1638 } 1609 1639 else if (propertyDef.startsWith("@")) 1610 1640 { … … 1627 1657 { 1628 1658 // propertyDef is JEP expression 1629 Expression e = Jep.formulaToExpression(propertyDef.substring(1), ch, rawCh, raw, rep );1659 Expression e = Jep.formulaToExpression(propertyDef.substring(1), ch, rawCh, raw, rep, mrep); 1630 1660 s = Selects.expression(e, "jep" + System.identityHashCode(e)); 1631 1661 } -
trunk/src/core/net/sf/basedb/core/ReporterCloneBatcher.java
r5886 r5897 283 283 284 284 PreparedStatement insertSql = buildInsertSql(); 285 286 System.out.println("sql: " + (query != null ? query.toQl(dc) : rawQuery.toQl(dc)));287 285 288 286 DynamicResultIterator it = query != null ? query.iterate(dc) : rawQuery.iterate(dc); -
trunk/src/core/net/sf/basedb/core/ReporterPropertyExpression.java
r5881 r5897 96 96 String joinAlias = RealTable.REPORTERS.getAlias(); 97 97 98 if (query instanceof DynamicQuery)98 if (query instanceof ClonableReporterQuery) 99 99 { 100 DynamicQuery dynamicQuery = (DynamicQuery)query;101 if (useCloned( dynamicQuery))100 ClonableReporterQuery clonableQuery = (ClonableReporterQuery)query; 101 if (useCloned(clonableQuery)) 102 102 { 103 if (!dc.loadItem( dynamicQuery.getVirtualDb()).hasClonedReporterProperty(property))103 if (!dc.loadItem(clonableQuery.getVirtualDb()).hasClonedReporterProperty(property)) 104 104 { 105 105 throw new InvalidDataException("Reporter property is not cloned: " + property); … … 164 164 @since 3.1 165 165 */ 166 public boolean useCloned( DynamicQuery query)166 public boolean useCloned(ClonableReporterQuery query) 167 167 { 168 168 // Check if the virtual database has cloned reporters -
trunk/src/core/net/sf/basedb/core/query/Expressions.java
r5429 r5897 152 152 if (value == null) throw new InvalidUseOfNullException("value"); 153 153 return parameter("P" + MD5.getHashString(value), value); 154 } 155 156 /** 157 Create a constant expression from a boolean. 158 @param value The value to create an expression for 159 @return The expression 160 @since 3.1 161 */ 162 public static Expression bool(boolean value) 163 { 164 return new BooleanExpression(value); 165 } 166 167 /** 168 Create a boolean expression view of a restriction. 169 @param restriction The restriction 170 @return The expression 171 @since 3.1 172 */ 173 public static Expression bool(Restriction restriction) 174 { 175 if (restriction == null) throw new InvalidUseOfNullException("restriction"); 176 return new BooleanExpression(restriction); 154 177 } 155 178 -
trunk/src/core/net/sf/basedb/core/query/SqlQuery.java
r4889 r5897 23 23 package net.sf.basedb.core.query; 24 24 25 import net.sf.basedb.core.DbControl; 26 import net.sf.basedb.core.DynamicResultIterator; 27 25 28 /** 26 29 This is a query that is using SQL as the query language. All … … 34 37 public interface SqlQuery 35 38 extends Query 36 {} 39 { 40 public DynamicResultIterator iterate(DbControl dc); 41 } -
trunk/src/core/net/sf/basedb/util/jep/ReporterFunction.java
r5319 r5897 39 39 40 40 /** 41 A JEP function class that adds a <code>rep(string)</code> function to a42 JEP expression parser. The function will look up the value of the reporter41 A JEP function class that adds a <code>rep(string)</code> or <code>mrep(string)</code> 42 function to a JEP expression parser. The function will look up the value of the reporter 43 43 property with the given name. For example: 44 44 <code>rep('sequence')</code> 45 <p> 46 If the <code>mrep</code> variant is used, the master reporter table is used, 47 otherwise the actual query can decide if it should use cloned reporter information 48 or not. 45 49 <p> 46 50 To be able to use this function it must be registered with the JEP … … 77 81 private final Metadata<ReporterData> metaData; 78 82 private final DbControl dc; 83 private final boolean master; 79 84 private int numParameters; 80 85 private ReporterData reporter; … … 88 93 public ReporterFunction() 89 94 { 95 this(false); 96 } 97 98 /** 99 Create a new instance of this function. The new instance cannot be used 100 to dynamically evaluate expressions. It should only be used for converting 101 JEP formulas to {@link Expression}:s. If 102 103 @since 3.1 104 @param master TRUE to force using the master reporter table, FALSE to let 105 the query decide 106 */ 107 public ReporterFunction(boolean master) 108 { 90 109 this.dc = null; 91 110 this.metaData = null; 111 this.master = master; 92 112 } 93 113 … … 99 119 this.dc = dc; 100 120 this.metaData = Metadata.getInstance(ReporterData.class); 121 this.master = false; 101 122 } 102 123 … … 106 127 */ 107 128 /** 108 @return The string "rep" 129 @return The string "rep" or "mrep" 109 130 */ 110 131 public String getFunctionName() 111 132 { 112 return "rep";133 return master ? "mrep" : "rep"; 113 134 } 114 135 // ------------------------------------------- … … 128 149 throw new BaseException("Invalid number of expressions for 'rep' function: " + numChildren); 129 150 } 130 return Dynamic.reporter(Jep.nodeToString(node.jjtGetChild(0)) );151 return Dynamic.reporter(Jep.nodeToString(node.jjtGetChild(0)), master ? false : null); 131 152 } 132 153 // ------------------------------------------- -
trunk/src/core/net/sf/basedb/util/jep/convert/AbstractJepConversionFunction.java
r4515 r5897 23 23 24 24 import net.sf.basedb.core.query.Expression; 25 import net.sf.basedb.core.query.Expressions; 25 26 import net.sf.basedb.core.query.Restriction; 26 27 … … 76 77 } 77 78 /** 78 @throws UnsupportedOperationException Always 79 Convert to a restriction and then use {@link Expressions#bool(Restriction)} 80 to create a boolean expression. 79 81 */ 80 82 public Expression toExpression(T node) 81 83 { 82 throw new UnsupportedOperationException("toExpression");84 return Expressions.bool(toRestriction(node)); 83 85 } 84 86 … … 88 90 public Restriction toRestriction(T node) 89 91 { 90 throw new UnsupportedOperationException( "toRestriction");92 throw new UnsupportedOperationException(getClass() + ".toRestriction()"); 91 93 } 92 94 // ------------------------------------------- -
trunk/www/views/experiments/bioassaysets/list_bioassaysets.jsp
r5590 r5897 210 210 location.href = '../index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id=<%=experimentId%>&tab='+tabId; 211 211 } 212 else if (tabId == 'clonedreporters') 213 { 214 viewClonedReporters(); 215 } 212 216 else 213 217 { 214 218 TabControl.setActiveTab(tabControlId, tabId); 215 219 } 220 } 221 function viewClonedReporters() 222 { 223 location.href = '../reporters/index.jsp?ID=<%=ID%>&experiment_id=<%=experimentId%>'; 216 224 } 217 225 </script> … … 241 249 </base:buttongroup> 242 250 </t:tab> 251 252 <t:tab id="clonedreporters" title="Cloned reporters" 253 visible="<%=experiment.getVirtualDb().hasClonedReporters() %>"/> 254 243 255 <t:tab id="overview" title="Overview" 244 256 tooltip="Display a tree overview of related items" /> -
trunk/www/views/experiments/index.jsp
r5886 r5897 24 24 @version 2.0 25 25 --%> 26 <%@page import="net.sf.basedb.core.StringParameterType"%>27 26 <%@ page pageEncoding="UTF-8" session="false" 28 27 import="net.sf.basedb.core.SessionControl" … … 42 41 import="net.sf.basedb.core.Job" 43 42 import="net.sf.basedb.core.ItemParameterType" 43 import="net.sf.basedb.core.StringParameterType" 44 44 import="net.sf.basedb.core.ItemQuery" 45 45 import="net.sf.basedb.core.ItemResultIterator" -
trunk/www/views/experiments/view_experiment.jsp
r5886 r5897 171 171 location.href = 'bioassaysets/index.jsp?ID=<%=ID%>&experiment_id=<%=itemId%>'; 172 172 } 173 function viewClonedReporters() 174 { 175 location.href = 'reporters/index.jsp?ID=<%=ID%>&experiment_id=<%=itemId%>'; 176 } 173 177 function switchTab(tabControlId, tabId) 174 178 { … … 177 181 { 178 182 location.href = 'index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id=<%=itemId%>&tab='+tabId; 183 } 184 else if (tabId == 'clonedreporters') 185 { 186 viewClonedReporters(); 179 187 } 180 188 else if (tabId == 'bioassaysets') … … 885 893 886 894 <t:tab id="bioassaysets" title="Bioassay sets" /> 895 <t:tab id="clonedreporters" 896 title="Cloned reporters" 897 visible="<%=virtualDb.hasClonedReporters() %>" 898 tooltip="Show information about cloned reporters" 899 /> 887 900 <t:tab id="overview" title="Overview" 888 901 tooltip="Display a tree overview of related items"> -
trunk/www/views/reporterlists/index.jsp
r5757 r5897 35 35 import="net.sf.basedb.core.DataQuery" 36 36 import="net.sf.basedb.core.ItemQuery" 37 import="net.sf.basedb.core. DynamicQuery"37 import="net.sf.basedb.core.query.SqlQuery" 38 38 import="net.sf.basedb.core.DataResultIterator" 39 39 import="net.sf.basedb.core.DynamicResultIterator" … … 191 191 } 192 192 } 193 else if (query instanceof DynamicQuery)194 { 195 DynamicResultIterator result = (( DynamicQuery)query).iterate(dc);193 else if (query instanceof SqlQuery) 194 { 195 DynamicResultIterator result = ((SqlQuery)query).iterate(dc); 196 196 while (result.hasNext()) 197 197 {
Note: See TracChangeset
for help on using the changeset viewer.