Changeset 4306
- Timestamp:
- May 21, 2008, 3:39:59 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/Reporter.java
r4020 r4306 121 121 return rd; 122 122 } 123 124 /** 125 Get a proxy reporter object. This method is usefult when linking 126 reporters to other items, and you are sure that a reporter with the given ID 127 exists. Since this method doesn't hit the database, there are some things to 128 be aware of: 129 <ul> 130 <li>There is no check to see if a reporter with the given ID exists or 131 not 132 <li>The returned object doesn't contain any reporter information 133 except the ID. 134 </ul> 135 136 @param reporterId The ID of the reporter 137 @return A reporter object 138 @since 2.8 139 */ 140 public static ReporterData getProxy(int reporterId) 141 { 142 return new ReporterData(reporterId); 143 } 123 144 124 145 /** -
trunk/src/core/net/sf/basedb/core/data/ReporterData.java
r4082 r4306 60 60 61 61 /** 62 Create a reporter object with a given ID. 63 @param id The reporter ID 64 @since 2.8 65 */ 66 public ReporterData(int id) 67 { 68 setId(id); 69 } 70 71 /** 62 72 The maximum length of the external ID that can be stored in the database. 63 73 @see #setExternalId(String) -
trunk/www/views/experiments/explorer/search/index.jsp
r2978 r4306 33 33 import="net.sf.basedb.core.ItemContext" 34 34 import="net.sf.basedb.core.BioAssaySet" 35 import="net.sf.basedb.core.DynamicSpotQuery" 35 36 import="net.sf.basedb.clients.web.Base" 36 37 import="net.sf.basedb.clients.web.ExperimentExplorer" … … 38 39 import="net.sf.basedb.util.Values" 39 40 import="net.sf.basedb.clients.web.util.HTML" 41 import="java.util.Collections" 40 42 %> 41 43 <% … … 68 70 redirect = listPage; 69 71 } 72 else if ("CreateReporterList".equals(cmd)) 73 { 74 ItemContext cc = explorer.getAndSetReporterContext(sc, pageContext); 75 DynamicSpotQuery query = explorer.getReporterQuery(dc, Collections.singletonList("@id")); 76 cc.setQuery(query); 77 redirect = "../../../reporterlists/index.jsp?ID="+ID+ 78 "&cmd=NewItem&addReporters=1&formId=&fromContext=" + cc.getItemType().name() + 79 "&subContext="+cc.getSubContext() + "&name=" + HTML.urlEncode(bioAssaySet.getName()); 80 } 81 70 82 else 71 83 { -
trunk/www/views/experiments/explorer/search/list.jsp
r4302 r4306 31 31 import="net.sf.basedb.core.Item" 32 32 import="net.sf.basedb.core.ItemContext" 33 import="net.sf.basedb.core.Permission" 33 34 import="net.sf.basedb.core.BioAssaySet" 34 35 import="net.sf.basedb.core.Experiment" … … 157 158 } 158 159 } 160 function newReporterList() 161 { 162 Table.submitToPopup(formId, 'CreateReporterList', 540, 400); 163 } 159 164 </script> 160 165 </base:head> … … 231 236 title="Columns…" 232 237 tooltip="Show, hide and re-order columns" 238 /> 239 <tbl:button 240 image="add.png" 241 onclick="newReporterList()" 242 title="New reporter list…" 243 tooltip="Create a new reporter list from matching reporters" 244 visible="<%=sc.hasPermission(Permission.CREATE, Item.REPORTERLIST)%>" 233 245 /> 234 246 </tbl:toolbar> -
trunk/www/views/experiments/spotdata/index.jsp
r3679 r4306 41 41 import="java.util.Map" 42 42 import="java.util.HashMap" 43 import="java.util.Collections" 43 44 %> 44 45 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> … … 127 128 redirect = "../../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+spot+data"; 128 129 } 130 else if ("CreateReporterList".equals(cmd)) 131 { 132 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext); 133 dc = sc.newDbControl(); 134 if (bas != null) dc.reattachItem(bas); 135 if (ba != null) dc.reattachItem(ba); 136 final DynamicSpotQuery query = ba != null ? ba.getSpotData() : bas.getSpotData(); 137 cc.configureQuery(dc, query, Collections.singletonList("@id")); 138 cc.setQuery(query); 139 redirect = "../../../views/reporterlists/index.jsp?ID="+ID+ 140 "&cmd=NewItem&addReporters=1&formId=&fromContext=SPOTDATA&subContext=" + subContext + 141 "&name=" + HTML.urlEncode(ba != null ? ba.getName() : bas.getName()); 142 } 143 129 144 else 130 145 { -
trunk/www/views/experiments/spotdata/list_spotdata.jsp
r4302 r4306 169 169 } 170 170 } 171 function newReporterList() 172 { 173 Table.submitToPopup(formId, 'CreateReporterList', 540, 400); 174 } 171 175 </script> 172 176 </base:head> … … 306 310 title="Columns…" 307 311 tooltip="Show, hide and re-order columns" 312 /> 313 <tbl:button 314 image="add.png" 315 onclick="newReporterList()" 316 title="New reporter list…" 317 tooltip="Create a new reporter list from matching spots" 318 visible="<%=sc.hasPermission(Permission.CREATE, Item.REPORTERLIST)%>" 308 319 /> 309 320 <tbl:button -
trunk/www/views/reporterlists/edit_reporterlist.jsp
r4305 r4306 56 56 boolean mergeReporterLists = false; 57 57 int numSelectedLists = cc.getSelected().size(); 58 String formId = Values.getString(request.getParameter("formId"), "reporters");58 String formId = request.getParameter("formId"); 59 59 String fromContext = Values.getString(request.getParameter("fromContext"), "REPORTER"); 60 60 String subContext = request.getParameter("subContext"); … … 154 154 } 155 155 // Get the ID:s of all selected reorters 156 var selectedItems ;156 var selectedItems = new Array(); 157 157 function getSelectedItems() 158 158 { 159 if (!selectedItems) 160 { 161 selectedItems = window.opener.Table.getSelected('<%=formId%>'); 162 } 159 <% 160 if (formId != null) 161 { 162 %> 163 if (!selectedItems) 164 { 165 selectedItems = window.opener.Table.getSelected('<%=formId%>'); 166 } 167 <% 168 } 169 %> 163 170 return selectedItems; 164 171 } -
trunk/www/views/reporterlists/index.jsp
r4305 r4306 32 32 import="net.sf.basedb.core.ReporterList" 33 33 import="net.sf.basedb.core.FileType" 34 import="net.sf.basedb.core.Reporter" 34 35 import="net.sf.basedb.core.Permission" 35 36 import="net.sf.basedb.core.Type" … … 37 38 import="net.sf.basedb.core.DataQuery" 38 39 import="net.sf.basedb.core.ItemQuery" 40 import="net.sf.basedb.core.DynamicQuery" 39 41 import="net.sf.basedb.core.DataResultIterator" 42 import="net.sf.basedb.core.DynamicResultIterator" 40 43 import="net.sf.basedb.core.MultiPermissions" 41 44 import="net.sf.basedb.core.PermissionDeniedException" 42 45 import="net.sf.basedb.core.ItemAlreadyExistsException" 43 46 import="net.sf.basedb.core.data.ReporterData" 47 import="net.sf.basedb.core.query.Query" 44 48 import="net.sf.basedb.core.query.Restrictions" 45 49 import="net.sf.basedb.core.query.Expressions" 46 50 import="net.sf.basedb.core.query.Hql" 51 import="net.sf.basedb.core.query.SqlResult" 47 52 import="net.sf.basedb.util.RemovableUtil" 48 53 import="net.sf.basedb.util.ShareableUtil" … … 147 152 Item fromContext = Item.valueOf(request.getParameter("fromContext")); 148 153 String subContext = Values.getString(request.getParameter("subContext"), ""); 149 DataQuery<ReporterData> query = 150 (DataQuery<ReporterData>)sc.getCurrentContext(fromContext, subContext).getQuery(); 154 Query query = sc.getCurrentContext(fromContext, subContext).getQuery(); 151 155 if ("all".equals(which)) 152 156 { … … 169 173 // else -- no modifications to the query mean that we only get the current page 170 174 171 DataResultIterator<ReporterData> result = query.iterate(dc); 172 while (result.hasNext()) 173 { 174 ReporterData reporter = result.next(); 175 if (reporter != null) rl.addReporter(reporter, null); 175 if (query instanceof DataQuery) 176 { 177 DataResultIterator<ReporterData> result = ((DataQuery<ReporterData>)query).iterate(dc); 178 while (result.hasNext()) 179 { 180 ReporterData reporter = result.next(); 181 if (reporter != null) rl.addReporter(reporter, null); 182 } 183 } 184 else if (query instanceof DynamicQuery) 185 { 186 DynamicResultIterator result = ((DynamicQuery)query).iterate(dc); 187 while (result.hasNext()) 188 { 189 SqlResult i = result.next(); 190 int reporterId = i.getInt(1); 191 if (reporterId != 0) 192 { 193 rl.addReporter(Reporter.getProxy(reporterId), null); 194 } 195 } 176 196 } 177 197 }
Note: See TracChangeset
for help on using the changeset viewer.