source: trunk/www/views/rawbioassays/rawdata/view_rawdata.jsp @ 7605

Last change on this file since 7605 was 7605, checked in by Nicklas Nordborg, 3 years ago

References #2151: Pre-compile all JSP pages before releases

Getting rid of a lot of unchecked warnings. Most of them are solved by changed the API in several BASE core clases to use implict casting of return types instead of explicit (this moved the 'unchecked' warning to the API method from the caller). Example:

// Before
ItemContext cc = ...
Hardware hardware = (Hardware)cc.getObject("item");
// After
Hardware hardware = cc.getObject("item");

In most cases both the old and new version of the code will work, but if the returned object is using a "type" parameter it will not compile:

// This will not compile!
Set<AnnotatedItem> items = (Set<AnnotatedItem>)cc.getObject("AnnotatedItems");
// But this will!
Set<AnnotatedItem> items = cc.getObject("AnnotatedItems");

Note that existing compiled code will still work, but that some changes may be needed when compiling agains BASE 3.15. The issues should be easy to solve (eg. remove an explict cast).

Extensions that uses JSP files that works in BASE 3.14 may stop working in BASE 3.15 since the compilation of the JSP files happens on the BASE server as they are accessed.

Another issues is that there are still a lot of unchecked warnings related to the JSON library. This build on regular Map and List API:s but has not specified generic type parameters so there is no way to get rid of those warnings without fixing the JSON library source code. The latest released version is from 2012 so it is not likely that this should happen unless we do it ourselves (the warnings are really annoying so maybe we should!).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 12.5 KB
Line 
1<%-- $Id: view_rawdata.jsp 7605 2019-02-26 10:10:15Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Johan Enell, Jari Häkkinen, Nicklas Nordborg
4  Copyright (C) 2007 Nicklas Nordborg
5
6  This file is part of BASE - BioArray Software Environment.
7  Available at http://base.thep.lu.se/
8
9  BASE is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License
11  as published by the Free Software Foundation; either version 3
12  of the License, or (at your option) any later version.
13
14  BASE is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  GNU General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with BASE. If not, see <http://www.gnu.org/licenses/>.
21  ------------------------------------------------------------------
22
23  @author Nicklas
24  @version 2.0
25--%>
26<%@ page pageEncoding="UTF-8" session="false"
27  import="net.sf.basedb.core.SessionControl"
28  import="net.sf.basedb.core.DbControl"
29  import="net.sf.basedb.core.SystemItems"
30  import="net.sf.basedb.core.Item"
31  import="net.sf.basedb.core.ItemContext"
32  import="net.sf.basedb.core.Permission"
33  import="net.sf.basedb.core.ExtendedProperties"
34  import="net.sf.basedb.core.ExtendedProperty"
35  import="net.sf.basedb.core.RawDataProperty"
36  import="net.sf.basedb.core.RawBioAssay"
37  import="net.sf.basedb.core.RawDataType"
38  import="net.sf.basedb.core.ReporterType"
39  import="net.sf.basedb.core.Reporter"
40  import="net.sf.basedb.core.Feature"
41  import="net.sf.basedb.core.Well"
42  import="net.sf.basedb.core.Plate"
43  import="net.sf.basedb.core.ArrayDesignBlock"
44  import="net.sf.basedb.core.PermissionDeniedException"
45  import="net.sf.basedb.core.PluginDefinition"
46  import="net.sf.basedb.core.data.RawData"
47  import="net.sf.basedb.core.data.ReporterData"
48  import="net.sf.basedb.core.data.FeatureData"
49  import="net.sf.basedb.core.plugin.GuiContext"
50  import="net.sf.basedb.core.plugin.Plugin"
51  import="net.sf.basedb.clients.web.Base"
52  import="net.sf.basedb.clients.web.util.HTML"
53  import="net.sf.basedb.util.Values"
54  import="net.sf.basedb.util.formatter.Formatter"
55  import="net.sf.basedb.util.formatter.WellCoordinateFormatter"
56  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
57  import="java.util.Date"
58  import="java.util.Map"
59  import="java.util.Set"
60  import="java.util.List"
61%>
62<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
63<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
64<%!
65  private static final Item itemType = Item.RAWDATA;
66  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
67%>
68<%
69final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
70final String ID = sc.getId();
71final int rawBioAssayId = Values.getInt(request.getParameter("rawbioassay_id"));
72final float scale = Base.getScale(sc);
73final DbControl dc = sc.newDbControl();
74try
75{
76  final boolean readReporter = !sc.hasPermission(Permission.DENIED, Item.REPORTER);
77  final RawBioAssay rawBioAssay = RawBioAssay.getById(dc, rawBioAssayId);
78  final RawDataType rawDataType = rawBioAssay.getRawDataType();
79  final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, rawDataType.getId(), null, null);
80  final int itemId = cc.getId();
81  final boolean hasSpotImages = rawBioAssay.hasSpotImages(); 
82 
83  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
84
85  final RawData rawData = rawBioAssay.getRawDataById(itemId, true);
86  String title = "Raw data of "+HTML.encodeTags(rawBioAssay.getName()) + " at position " + rawData.getPosition();
87 
88  final ReporterData reporter = readReporter ? rawData.getReporter() : null;
89  final FeatureData feature = rawData.getFeature();
90  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
91  WellCoordinateFormatter rowFormatter = new WellCoordinateFormatter(true);
92  WellCoordinateFormatter columnFormatter = new WellCoordinateFormatter(false);
93  %>
94  <base:page title="<%=title%>" type="popup" id="view-page">
95  <base:head scripts="tabcontrol-2.js,~rawdata.js" styles="tabcontrol.css" />
96  <base:body data-read-only="1">
97    <h1><%=title%></h1>
98 
99    <t:tabcontrol id="rawdata" 
100      subclass="content dialogtabcontrol"
101      position="bottom">
102    <t:tab id="raw" title="Raw data">
103   
104      <table class="fullform outlined larger">
105      <tbody class="sectionheader">
106        <tr>
107          <th colspan="4">Common rawdata properties</th>
108        </tr>
109      </tbody>
110      <tbody>
111      <tr>
112        <th>Position</th>
113        <td><%=rawData.getPosition()%></td>
114        <th class="leftborder">Block</th>
115        <td><%=rawData.getBlock()%></td>
116      </tr>
117      <tr>
118        <th>Row</th>
119        <td><%=rawData.getRow()%></td>
120        <th class="leftborder">Column</th>
121        <td><%=rawData.getColumn()%></td>
122      </tr>
123      <tr>
124        <th>Meta grid X</th>
125        <td><%=rawData.getMetaGridX()%></td>
126        <th class="leftborder">Meta grid Y</th>
127        <td><%=rawData.getMetaGridY()%></td>
128      </tr>
129      <tr>
130        <th>X</th>
131        <td><%=rawData.getX()%></td>
132        <th class="leftborder">Y</th>
133        <td><%=rawData.getY()%></td>
134      </tr>
135      <tr>
136        <th>Reporter</th>
137        <td><%=reporter == null ? "<i>- none -</i>" : HTML.encodeTags(reporter.getName())%></td>
138        <th class="leftborder">Feature</th>
139        <td><%=feature == null ? "<i>- none -</i>" : feature.getId()%></td>
140      </tr>
141      <tr>
142        <th>Spot image</th>
143        <td>
144          <%
145          if (hasSpotImages)
146          {
147            %>
148            <img class="spotimage" src="spotimage/<%=ID%>/<%=rawBioAssay.getId()%>/<%=itemId%>/spot<%=rawData.getPosition()%>.png">
149            <%
150          }
151          else
152          {
153            %>
154            <i>- none -</i>
155            <%
156          }
157          %>
158        </td>
159        <th class="leftborder"></th>
160        <td></td>
161      </tr>
162      </tbody>
163     
164      <tbody class="sectionheader">
165        <tr>
166          <th colspan="4"><%=rawDataType.getName()%> properties</th>
167        </tr>
168      </tbody>
169     
170      <tbody>
171          <%
172          boolean needsTr = true;
173          for (RawDataProperty rawProperty : rawDataType.getProperties())
174          {
175            String name = rawProperty.getName();
176            Formatter<Object> f = FormatterFactory.getExtendedPropertyFormatter(sc, rawProperty);
177            String value = f.format(rawData.getExtended(name));
178            title = Values.trimString(rawProperty.getTitle(), 25);
179            %>
180              <%=needsTr ? "<tr><th>" : "<th class=\"leftborder\">" %>
181              <span 
182                title="<%=HTML.encodeTags(rawProperty.getDescription())%>"><%=HTML.encodeTags(title)%></span>
183              </th>
184              <td><%=value%></td>
185              <%=needsTr ? "" : "</tr>"%>
186            <%
187            needsTr = !needsTr;
188          }
189          %>
190          <%=needsTr ? "" : "<th class=\"leftborder\"></th><td></td></tr>"%>
191        <tr class="dynamic">
192          <th></th>
193          <td></td>
194          <th class="leftborder"></th>
195          <td></td>
196        </tr>
197      </tbody>     
198      </table>
199   
200    </t:tab>
201    <t:tab id="reporter" title="Reporter" >
202      <%
203      if (reporter == null)
204      {
205        %>
206        <table class="fullcc bg-filled-50"><tr><td>
207        <b><%=readReporter ? "No reporter" : "Denied" %></b>
208        </td></tr></table>
209        <%
210      }
211      else
212      {
213        boolean readCurrentReporterType = true;
214        ReporterType currentReporterType = null;
215        try
216        {
217          currentReporterType = Reporter.getReporterType(dc, reporter);
218        }
219        catch (PermissionDeniedException ex)
220        {
221          readCurrentReporterType = false;
222        }
223        %>
224        <table class="fullform outlined">
225        <tbody class="sectionheader">
226          <tr>
227            <th colspan="4">Common reporter properties</th>
228          </tr>
229        </tbody>
230        <tbody>
231       
232        <tr>
233          <th>Name</th>
234          <td><%=HTML.encodeTags(reporter.getName())%></td>
235          <th class="leftborder">External ID</th>
236          <td><%=HTML.encodeTags(reporter.getExternalId())%></td>
237        </tr>
238        <tr>
239          <th>Gene symbol</th>
240          <td><%=HTML.encodeTags(reporter.getSymbol())%></td>
241          <th class="leftborder">Type</th>
242          <td><%=Base.getEncodedName(currentReporterType, !readCurrentReporterType)%></td>
243        </tr>
244        <tr>
245          <th>Last update</th>
246          <td><%=dateFormatter.format(reporter.getLastUpdate())%></td>
247          <th class="leftborder">from/by</th>
248          <td><%=reporter.getLastSource() %></td>
249        </tr>
250        <tr>
251          <th>Description</th>
252          <td colspan="3"><%=HTML.niceFormat(reporter.getDescription())%></td>
253        </tr>
254        </tbody>
255       
256        <tbody class="sectionheader">
257          <tr>
258            <th colspan="4">Extended reporter properties</th>
259          </tr>
260        </tbody>
261        <tbody>
262            <%
263            List<ExtendedProperty> reporterProperties = ExtendedProperties.getProperties("ReporterData");
264            if (reporterProperties != null)
265            {
266              boolean needsTr = true;
267              for (ExtendedProperty ep : reporterProperties)
268              {
269                String name = ep.getName();
270                Formatter<Object> f = FormatterFactory.getExtendedPropertyFormatter(sc, ep);
271                String value = f.format(reporter.getExtended(name));
272                %>
273                  <%=needsTr ? "<tr><th>" : "<th class=\"leftborder\">" %>
274                  <%=HTML.encodeTags(ep.getTitle())%></th>
275                  <td><%=value%></td>
276                  <%=needsTr ? "" : "</tr>"%>
277                <%
278                needsTr = !needsTr;
279              }
280              %>
281              <%=needsTr ? "" : "<th class=\"leftborder\"></th><td></td></tr>"%>
282              <%
283            }
284            %>
285          <tr class="dynamic">
286            <th></th>
287            <td></td>
288            <th class="leftborder"></th>
289            <td></td>
290          </tr>
291        </tbody>
292        </table>
293        <%
294      }
295      %>
296    </t:tab>
297    <%
298    if (feature != null)
299    {
300      ArrayDesignBlock block = null;
301      boolean readBlock = true;
302      try
303      {
304        block = Feature.getArrayDesignBlock(dc, feature);
305      }
306      catch (PermissionDeniedException ex)
307      {
308        readBlock = false;
309      }
310     
311      Well well = null;
312      boolean readWell = true;
313      try
314      {
315        well = Feature.getWell(dc, feature);
316      }
317      catch (PermissionDeniedException ex)
318      {
319        readWell = false;
320      }
321      %>
322      <t:tab id="feature" title="Feature / well" >
323      <table class="fullform outlined">
324        <tbody class="sectionheader">
325          <tr>
326            <th colspan="6">Feature</th>
327          </tr>
328        </tbody>
329        <tbody>
330          <tr>
331            <th>Position</th>
332            <td><%=feature.getPosition()%></td>
333            <th class="leftborder">Meta grid X</th>
334            <td><%=readBlock ? Integer.toString(block.getMetaGridX()) : "<i>- denied -</i>"%></td>
335            <th class="leftborder">Meta grid Y</th>
336            <td><%=readBlock ? Integer.toString(block.getMetaGridY()) : "<i>- denied -</i>"%></td>
337          </tr>
338          <tr>
339            <th>Feature ID</th>
340            <td><%=feature.getExternalId() %></td>
341            <th class="leftborder">Block size X</th>
342            <td><%=readBlock ? Integer.toString(block.getBlockSizeX()) : "<i>- denied -</i>"%></td>
343            <th class="leftborder">Block size Y</th>
344            <td><%=readBlock ? Integer.toString(block.getBlockSizeY()) : "<i>- denied -</i>"%></td>
345          </tr>
346          <tr>
347            <th>Block number</th>
348            <td><%=block.getBlockNumber()%></td>
349            <th class="leftborder">Origin X</th>
350            <td><%=readBlock ? Integer.toString(block.getOriginX()) : "<i>- denied -</i>"%></td>
351            <th class="leftborder">Origin Y</th>
352            <td><%=readBlock ? Integer.toString(block.getOriginY()) : "<i>- denied -</i>"%></td>
353          </tr>
354          <tr>
355            <th>Row</th>
356            <td><%=feature.getRow()%></td>
357            <th class="leftborder">Spacing X</th>
358            <td><%=readBlock ? Integer.toString(block.getSpacingX()) : "<i>- denied -</i>"%></td>
359            <th class="leftborder">Spacing Y</th>
360            <td><%=readBlock ? Integer.toString(block.getSpacingY()) : "<i>- denied -</i>"%></td>
361          </tr>
362          <tr>
363            <th>Column</th>
364            <td><%=feature.getColumn()%></td>
365            <th class="leftborder"></th>
366            <td></td>
367            <th class="leftborder"></th>
368            <td></td>
369          </tr>
370        </tbody>
371       
372        <tbody class="sectionheader">
373          <tr>
374            <th colspan="6">Plate position</th>
375          </tr>
376        </tbody>
377       
378        <tbody>
379          <%
380          if (!readWell)
381          {
382            %>
383            <tr>
384              <th>Plate</th>
385              <td colspan="5"><i>- denied -</i></td>
386            </tr>
387            <%
388          }
389          else if (well == null)
390          {
391            %>
392            <tr>
393              <th>Plate</th>
394              <td colspan="5"><i>- none -</i></td>
395            </tr>
396            <%
397          }
398          else
399          {
400            Plate plate = well.getPlate();
401            %>
402            <tr>
403              <th>Plate</th>
404              <td colspan="5"><%=HTML.encodeTags(plate.getName())%></td>
405            </tr>
406            <tr>
407              <th>Well</th>
408              <td colspan="5"><%=rowFormatter.format(well.getRow())%><%=columnFormatter.format(well.getColumn())%></td>
409            </tr>
410            <%
411          }
412          %>
413          <tr class="dynamic">
414            <th></th>
415            <td colspan="5"></td>
416          </tr>
417        </tbody>
418      </table>
419      </t:tab>
420      <%
421    }
422    %>
423    </t:tabcontrol>
424
425    <base:buttongroup subclass="dialogbuttons">
426      <base:button id="close" title="Close" />
427    </base:buttongroup>
428   
429  </base:body>
430  </base:page>
431  <%
432}
433finally
434{
435  if (dc != null) dc.close();
436}
437
438%>
Note: See TracBrowser for help on using the repository browser.