source: trunk/www/views/rawbioassays/index.jsp @ 3859

Last change on this file since 3859 was 3859, checked in by Nicklas Nordborg, 14 years ago

References #789: Extend "Experiment overview" to check for problems related to platform and data files

  • The validation options and rules have been added. Need a bit more testing.
  • Fixes some other issues with FileSet? and validation of data files.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 21.9 KB
Line 
1<%-- $Id: index.jsp 3859 2007-10-18 10:03:33Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2005 Nicklas Nordborg
4  Copyright (C) 2006 Jari Hakkinen, Nicklas Nordborg, Martin Svensson
5  Copyright (C) 2007 Nicklas Nordborg
6
7  This file is part of BASE - BioArray Software Environment.
8  Available at http://base.thep.lu.se/
9
10  BASE is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License
12  as published by the Free Software Foundation; either version 2
13  of the License, or (at your option) any later version.
14
15  BASE is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  GNU General Public License for more details.
19
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place - Suite 330,
23  Boston, MA  02111-1307, USA.
24  ------------------------------------------------------------------
25
26  @author Nicklas
27  @version 2.0
28--%>
29<%@ page session="false"
30  import="net.sf.basedb.core.Application"
31  import="net.sf.basedb.core.SessionControl"
32  import="net.sf.basedb.core.DbControl"
33  import="net.sf.basedb.core.Item"
34  import="net.sf.basedb.core.Include"
35  import="net.sf.basedb.core.RawBioAssay"
36  import="net.sf.basedb.core.Affymetrix"
37  import="net.sf.basedb.core.Scan"
38  import="net.sf.basedb.core.Protocol"
39  import="net.sf.basedb.core.Software"
40  import="net.sf.basedb.core.ArrayDesign"
41  import="net.sf.basedb.core.File"
42  import="net.sf.basedb.core.FileType"
43  import="net.sf.basedb.core.RawDataType"
44  import="net.sf.basedb.core.RawDataTypes"
45  import="net.sf.basedb.core.Platform"
46  import="net.sf.basedb.core.PlatformVariant"
47  import="net.sf.basedb.core.User"
48  import="net.sf.basedb.core.Path"
49  import="net.sf.basedb.core.ItemQuery"
50  import="net.sf.basedb.core.ItemResultIterator"
51  import="net.sf.basedb.core.Permission"
52  import="net.sf.basedb.core.ItemContext"
53  import="net.sf.basedb.core.MultiPermissions"
54  import="net.sf.basedb.core.PermissionDeniedException"
55  import="net.sf.basedb.core.ItemAlreadyExistsException"
56  import="net.sf.basedb.core.PluginDefinition"
57  import="net.sf.basedb.core.Job"
58  import="net.sf.basedb.core.ProgressReporter"
59  import="net.sf.basedb.core.IntegerParameterType"
60  import="net.sf.basedb.core.FloatParameterType"
61  import="net.sf.basedb.core.StringParameterType"
62  import="net.sf.basedb.core.FileParameterType"
63  import="net.sf.basedb.core.ItemParameterType"
64  import="net.sf.basedb.core.BooleanParameterType"
65  import="net.sf.basedb.util.RemovableUtil"
66  import="net.sf.basedb.util.ShareableUtil"
67  import="net.sf.basedb.util.OwnableUtil"
68  import="net.sf.basedb.clients.web.Base"
69  import="net.sf.basedb.clients.web.WebException"
70  import="net.sf.basedb.util.Values"
71  import="net.sf.basedb.clients.web.util.HTML"
72  import="java.util.Enumeration"
73  import="java.util.Set"
74  import="java.util.HashSet"
75  import="java.util.List"
76  import="java.util.ArrayList"
77  import="java.util.Arrays"
78  import="java.util.Collections"
79%>
80<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
81<%!
82  private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,platform,variant,hasData,description");
83  private static final Item itemType = Item.RAWBIOASSAY;
84 
85  private static class UpdateArrayDesign
86    implements Runnable
87  {
88    private final int jobId;
89    private final int rawBioAssayId;
90    private final int arrayDesignId;
91    private final SessionControl sc;
92   
93    private UpdateArrayDesign(Job job, RawBioAssay rba, ArrayDesign design)
94    {
95      this.jobId = job.getId();
96      this.rawBioAssayId = rba.getId();
97      this.arrayDesignId = design.getId();
98      this.sc = job.getSessionControl();
99    }
100   
101    public void run()
102    {
103      DbControl dc = sc.newDbControl();
104      try
105      {
106        Job j = Job.getById(dc, jobId);
107        j.start("Initialising...", Application.getHostName());
108        ProgressReporter progress = j.getProgressReporter(null);
109        dc.commit();
110        dc = sc.newDbControl();
111        RawBioAssay rba = RawBioAssay.getById(dc, rawBioAssayId);
112        ArrayDesign design = ArrayDesign.getById(dc, arrayDesignId);
113        try
114        {
115          rba.updateArrayDesign(design, progress);
116          progress.display(99, "Committing changes to database...");
117          dc.commit();
118          dc = sc.newDbControl();
119          j = Job.getById(dc, jobId);
120          j.doneOk("Array design updated successfully");
121          j.setRemoved(true);
122          dc.commit();
123        }
124        catch (Throwable t)
125        {
126          dc = sc.newDbControl();
127          j = Job.getById(dc, jobId);
128          j.doneError(t.getMessage(), Arrays.asList(t));
129          j.setRemoved(true);
130          dc.commit();
131        }
132      }
133      finally
134      {
135        if (dc != null) dc.close();
136      }
137    }
138  }
139%>
140<%
141final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
142final String ID = sc.getId();
143final String cmd = request.getParameter("cmd");
144final String root = request.getContextPath()+"/";
145final String mode = request.getParameter("mode");
146final String callback = request.getParameter("callback");
147final String itemId = request.getParameter("item_id");
148final String listPage = "list_rawbioassays.jsp?ID="+ID
149  +(mode == null ? "" : "&mode="+mode)
150  +(callback == null ? "" : "&callback="+callback)
151  +(itemId == null ? "" : "&item_id="+itemId);
152final String viewPage = "view_rawbioassay.jsp?ID="+ID;
153final String editPage = "edit_rawbioassay.jsp?ID="+ID;
154
155String forward = null;
156String redirect = null;
157String message = null;
158DbControl dc = null;
159
160try
161{
162  if (cmd == null || "List".equals(cmd))
163  {
164    // Display the list page without updatinging the current context
165    Base.getAndSetCurrentContext(sc, itemType, null, defaultContext, true);
166    redirect = listPage;
167  }
168  else if ("UpdateContext".equals(cmd))
169  {
170    // Display the list page after updating the current context from the request parameters
171    Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
172    redirect = listPage;
173  }
174  else if ("LoadContext".equals(cmd))
175  {
176    // Display the list page after loading a saved context
177    int contextId = Values.getInt(request.getParameter("context"));
178    Base.loadContext(sc, contextId, defaultContext);
179    redirect = listPage;
180  }
181
182  else if ("ViewItem".equals(cmd))
183  {
184    // Display the view page for a single item
185    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
186    forward = viewPage;
187  }
188  else if ("EditItem".equals(cmd))
189  {
190    // Display the edit page for a single item (should be opened in a popup)
191    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
192    forward = editPage;
193  }
194  else if ("EditSpotImages".equals(cmd))
195  {
196    // Display the spot images edit page for a single item (should be opened in a popup)
197    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
198    redirect = "edit_spotimages.jsp?ID="+ID;
199  }
200  else if ("NewItem".equals(cmd))
201  {
202    // Display the edit page for a new item (should be opened in a popup)
203    if (!sc.hasPermission(Permission.CREATE, itemType))
204    {
205      throw new PermissionDeniedException(Permission.CREATE, itemType.toString());
206    }
207    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
208    cc.setId(0);
209    forward = editPage;
210  }
211  else if ("UpdateItem".equals(cmd))
212  {
213    // Update the properties on an item (will close the popup)
214    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext);
215    final int maxRecent = Base.getMaxRecent(sc);
216    dc = sc.newDbControl();
217    RawBioAssay rba = (RawBioAssay)cc.getObject("item");
218   
219    Platform platform = null;
220    PlatformVariant variant = null;
221
222    if (request.getParameter("platform") != null)
223    {
224      String[] pv = request.getParameter("platform").split(":");
225      int platformId = Values.getInt(pv[0], -1);
226      int variantId = pv.length > 1 ? Values.getInt(pv[1], -1) : -1;
227      if (platformId > 0) platform =  Platform.getById(dc, platformId);
228      if (variantId > 0) variant = PlatformVariant.getById(dc, variantId);
229    }
230   
231    RawDataType rdt = RawDataTypes.getRawDataType(Values.getStringOrNull(request.getParameter("rawdatatype")));
232    if (rdt != null) cc.setRecent("RawDataType", rdt.getId(), maxRecent);
233
234    if (rba == null)
235    {
236      if (variant != null)
237      {
238        rba = RawBioAssay.getNew(dc, variant, rdt);
239      }
240      else
241      {
242        rba = RawBioAssay.getNew(dc, platform, rdt);
243      }
244      message = "Raw bioassay created";
245      dc.saveItem(rba);
246    }
247    else
248    {
249      dc.reattachItem(rba);
250      if (variant != null)
251      {
252        rba.setVariant(variant, rdt);
253      }
254      else if (platform != null)
255      {
256        rba.setPlatform(platform, rdt);
257      }
258      message = "Raw bioassay updated";
259    }
260    rba.setName(Values.getStringOrNull(request.getParameter("name")));
261    rba.setDescription(Values.getStringOrNull(request.getParameter("description")));
262    int protocolId = Values.getInt(request.getParameter("protocol_id"), -1);
263    if (protocolId >= 0)  // < 0 = denied or unchanged
264    {
265      Protocol pt = protocolId == 0 ? null : Protocol.getById(dc, protocolId);
266      rba.setProtocol(pt);
267      if (pt != null) cc.setRecent(pt, maxRecent);
268    }
269    int softwareId = Values.getInt(request.getParameter("software_id"), -1);
270    if (softwareId >= 0) // < 0 = denied or unchanged
271    {
272      Software sw = softwareId == 0 ? null : Software.getById(dc, softwareId);
273      rba.setSoftware(sw);
274      if (sw != null) cc.setRecent(sw, maxRecent);
275    }
276    int scanId = Values.getInt(request.getParameter("scan_id"), -1);
277    if (scanId >= 0) // < 0 = denied or unchanged
278    {
279      Scan scan = scanId == 0 ? null : Scan.getById(dc, scanId);
280      rba.setScan(scan);
281      if (scan != null) cc.setRecent(scan, maxRecent);
282    }
283    Job job = null;
284    ArrayDesign ad = null;
285    int arrayDesignId = Values.getInt(request.getParameter("arraydesign_id"), -1);
286    if (arrayDesignId >= 0) // < 0 = denied or unchanged
287    {
288      ad = arrayDesignId == 0 ? null : ArrayDesign.getById(dc, arrayDesignId);
289      if (rba.hasData())
290      {
291        if (rba.getRawDataType().isStoredInDb() && ad != null && ad.hasFeatures())
292        {
293          // Create job and assign it to another thread
294          job = Job.getNew(dc, null, null);
295          job.setName("Validating array design on " + rba.getName());
296          job.setPrepared(Application.getHostName());
297          job.setSendMessage(Values.getBoolean(sc.getUserClientSetting("plugins.sendmessage"), false));
298          dc.saveItem(job);
299        }
300        else
301        {
302          rba.updateArrayDesign(ad, null);
303        }
304      }
305      else
306      {
307        rba.setArrayDesign(ad);
308      }
309      if (ad != null) cc.setRecent(ad, maxRecent);
310    }
311
312    // Data files tab
313    boolean validate = Values.getBoolean(request.getParameter("datafiles.validate"));
314    boolean metadata = Values.getBoolean(request.getParameter("datafiles.metadata"));
315    Base.updateFiles(dc, rba, request, validate, metadata, cc, maxRecent);
316   
317    // Annotations tab
318    Base.updateAnnotations(dc, rba, rba, request);
319    dc.commit();
320    cc.removeObject("item");
321    if (job != null) 
322    {
323      redirect = "../jobs/index.jsp?ID="+ID+"&cmd=ViewItem&item_id="+job.getId();
324      Thread updateThread = new Thread(new UpdateArrayDesign(job, rba, ad));
325      updateThread.setPriority(Thread.currentThread().getPriority() - 1);
326      updateThread.start();
327    }
328  }
329  else if ("DeleteItem".equals(cmd))
330  {
331    // Delete a single item and then return to the view page
332    dc = sc.newDbControl();
333    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
334    RemovableUtil.setRemoved(dc, itemType, Collections.singleton(cc.getId()), true);
335    dc.commit();
336    redirect = viewPage;
337  }
338  else if ("DeleteItems".equals(cmd))
339  {
340    // Delete all selected items on the list page
341    dc = sc.newDbControl();
342    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
343    int numTotal = cc.getSelected().size();
344    int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), true);
345    dc.commit();
346    if (numTotal != numRemoved)
347    {
348      message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission";
349    }
350    redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
351  }
352  else if ("RestoreItem".equals(cmd))
353  {
354    // Restore a single item and then return to the view page
355    dc = sc.newDbControl();
356    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
357    RemovableUtil.setRemoved(dc, itemType, Collections.singleton(cc.getId()), false);
358    dc.commit();
359    redirect = viewPage;
360  }
361  else if ("RestoreItems".equals(cmd))
362  {
363    // Restore all selected items on the list page
364    dc = sc.newDbControl();
365    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
366    int numTotal = cc.getSelected().size();
367    int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), false);
368    dc.commit();
369    if (numTotal != numRemoved)
370    {
371      message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be restored, because you have no WRITE permission";
372    }
373    redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
374  }
375  else if ("ShareItem".equals(cmd))
376  {
377    // Display a popup window for sharing a single item
378    dc = sc.newDbControl();
379    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
380    MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, Collections.singleton(cc.getId()));
381    dc.close();
382    cc.setObject("MultiPermissions", permissions);
383    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
384  }
385  else if ("ShareItems".equals(cmd))
386  {
387    // Display a popup window for sharing all selected items on the list page
388    dc = sc.newDbControl();
389    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
390    MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, cc.getSelected());
391    dc.close();
392    cc.setObject("MultiPermissions", permissions);
393    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
394  }
395  else if ("TakeOwnershipOfItem".equals(cmd))
396  {
397    // Take ownership a single item and then return to the view page
398    dc = sc.newDbControl();
399    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
400    OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
401    dc.commit();
402    redirect = viewPage;
403  }
404  else if ("TakeOwnershipOfItems".equals(cmd))
405  {
406    // Take ownership all selected items on the list page
407    dc = sc.newDbControl();
408    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
409    int numTotal = cc.getSelected().size();
410    int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
411    dc.commit();
412    if (numTotal != numOwned)
413    {
414      message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
415    }
416    redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
417  }
418  else if ("ExportItems".equals(cmd))
419  {
420    // Run an export plugin in a list context
421    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
422    final ItemQuery<RawBioAssay> query = RawBioAssay.getQuery();
423    cc.configureQuery(query, true);
424    cc.setQuery(query);
425    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+raw+bioassays";
426  }
427  else if ("ExportItem".equals(cmd))
428  {
429    // Run an export plugin in single-item context
430    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
431    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+raw+bioassay";
432  }
433  else if ("ImportItems".equals(cmd))
434  {
435    // Run an import plugin in a list context
436    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
437    final ItemQuery<RawBioAssay> query = RawBioAssay.getQuery();
438    cc.configureQuery(query, true);
439    cc.setQuery(query);
440    redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Import+raw+bioassays";
441  }
442  else if ("ImportItem".equals(cmd))
443  {
444    // Run an import plugin in single-item context
445    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
446    // Set file type filter
447    ItemContext fileContext = sc.getCurrentContext(Item.FILE);
448    fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.RAW_DATA));
449    redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Import+raw+bioassay";
450  }
451  else if ("RunListPlugin".equals(cmd))
452  {
453    // Run another plugin in a list context
454    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
455    final ItemQuery<RawBioAssay> query = RawBioAssay.getQuery();
456    cc.configureQuery(query, true);
457    cc.setQuery(query);
458    redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&main_type=OTHER&title=Run+plugin";
459  }
460  else if ("RunPlugin".equals(cmd))
461  {
462    // Run another plugin in single-item context
463    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
464    redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=OTHER&title=Run+plugin";
465  }
466  else if ("CreateSpotImages".equals(cmd))
467  {
468    dc = sc.newDbControl();
469    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
470    RawBioAssay rba = RawBioAssay.getById(dc, cc.getId());
471   
472    int redFileId = Values.getInt(request.getParameter("redfile_id"));
473    File red = redFileId == 0 ? null : File.getById(dc, redFileId);
474    int greenFileId = Values.getInt(request.getParameter("greenfile_id"));
475    File green = greenFileId == 0 ? null : File.getById(dc, greenFileId);
476    int blueFileId = Values.getInt(request.getParameter("bluefile_id"));
477    File blue = blueFileId == 0 ? null : File.getById(dc, blueFileId);
478
479    String path = Values.getStringOrNull(request.getParameter("path"));
480    if (path.startsWith("~/"))
481    {
482      User user = User.getById(dc, sc.getLoggedInUserId());
483      path = "~"+user.getLogin()+path.substring(1);
484    }
485    Path p = new Path(path, Path.Type.FILE);
486    File saveAs = File.getByPath(dc, p, true);
487    if (saveAs.isInDatabase() && !Values.getBoolean(request.getParameter("overwrite")))
488    {
489      throw new ItemAlreadyExistsException("File[path="+path+"]");
490    }
491   
492    IntegerParameterType integerParameter = new IntegerParameterType();
493    FloatParameterType floatParameter = new FloatParameterType();
494    FileParameterType fileParameter = new FileParameterType();
495    ItemParameterType<RawBioAssay> itemParameter = new ItemParameterType(RawBioAssay.class, null);
496    StringParameterType stringParameter = new StringParameterType();
497    BooleanParameterType booleanParameter = new BooleanParameterType();
498   
499    PluginDefinition plugin = PluginDefinition.getByClassName(dc, "net.sf.basedb.plugins.SpotImageCreator");
500    Job job = Job.getNew(dc, plugin, null);
501    job.setName("Create spot images for raw bioassay: " + rba.getName());
502    job.setParameterValue("rawBioAssay", "Raw bioassay", 
503      "The raw bioassay to create spot images for", itemParameter, rba);
504    job.setParameterValue("xScale", "X scale factor", 
505      "The raw data X value will be divided by this value to get the pixel coordinate", 
506      integerParameter, Values.getInt(request.getParameter("x_scale")));
507    job.setParameterValue("yScale", "Y scale factor", 
508      "The raw data Y value will be divided by this value to get the pixel coordinate", 
509      integerParameter, Values.getInt(request.getParameter("y_scale")));
510    job.setParameterValue("xOffset", "X offset value",
511      "The offset is subtracted from the raw data X value",
512      integerParameter, Values.getInt(request.getParameter("x_offset")));
513    job.setParameterValue("yOffset", "Y offset value",
514      "The offset is subtracted from the raw data Y value",
515      integerParameter, Values.getInt(request.getParameter("y_offset")));
516    job.setParameterValue("spotsize", "Spot size", "The size of each spot in pixels",
517      integerParameter, Values.getInt(request.getParameter("spotsize")));
518    job.setParameterValue("gamma", "Gamma", "Gamma correction for display",
519      floatParameter, Values.getFloat(request.getParameter("gamma")));
520    job.setParameterValue("quality", "Quality", 
521      "The quality is a number between 0.0 and 1.0, with 1.0 indicating highest quality.", 
522      floatParameter, Values.getFloat(request.getParameter("quality")));
523    job.setParameterValue("redFile", "Red image", 
524      "The file containing the image to use for the red part", fileParameter, red);
525    job.setParameterValue("greenFile", "Green image", 
526      "The file containing the image to use for the green part", fileParameter, green);
527    job.setParameterValue("blueFile", "Blue image",
528      "The file containing the image to use for the red part", fileParameter, blue);
529    job.setParameterValue("path", "Save as", 
530      "The file name where the spot images should be saved", stringParameter, path);
531    job.setParameterValue("overwrite", "Overwrite", 
532      "If an existing file should be overwritten or not", booleanParameter, Values.getBoolean(request.getParameter("overwrite")));
533   
534    dc.saveItem(job);
535    dc.commit();
536
537    redirect = "../jobs/index.jsp?ID="+ID+"&cmd=ViewItem&item_id="+job.getId();
538  }
539  else
540  {
541    throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd);
542  }
543
544
545  /*
546  else if ("ImportRawData".equals(cmd))
547  {
548    RawBioAssay rba = (RawBioAssay)sc.getSessionSetting(itemType.name()+".item");
549    ItemContext context = sc.getCurrentContext(itemType);
550    context.setId(rba.getId());
551    redirect = "../../common/import/configure.jsp?ID="+ID+"&item_type="+itemType.name()+"&context_type=ITEM&title=Import+raw+data+for+"+HTML.urlEncode(rba.getName());
552
553  }
554  */
555}
556finally
557{
558  if (dc != null) dc.close();
559}
560
561if (forward != null)
562{
563  pageContext.forward(forward);
564}
565else if (redirect != null)
566{
567  response.sendRedirect(redirect);
568}
569else if (message == null)
570{
571  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0");
572}
573else
574{
575  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message));
576}
577%>
578
Note: See TracBrowser for help on using the repository browser.