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

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

References #721: Store data in files instead of in the database

Remember most recently used platform/variant when creating raw bioassays/array designs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 22.0 KB
Line 
1<%-- $Id: index.jsp 3909 2007-11-06 07:57:58Z 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    RawDataType rdt = RawDataTypes.getRawDataType(Values.getStringOrNull(request.getParameter("rawdatatype")));
231    if (platform != null) cc.setRecent(platform, maxRecent);
232    if (variant != null) cc.setRecent(variant, maxRecent);
233    if (rdt != null) cc.setRecent("RawDataType", rdt.getId(), maxRecent);
234
235    if (rba == null)
236    {
237      if (variant != null)
238      {
239        rba = RawBioAssay.getNew(dc, variant, rdt);
240      }
241      else
242      {
243        rba = RawBioAssay.getNew(dc, platform, rdt);
244      }
245      message = "Raw bioassay created";
246      dc.saveItem(rba);
247    }
248    else
249    {
250      dc.reattachItem(rba);
251      if (variant != null)
252      {
253        rba.setVariant(variant, rdt);
254      }
255      else if (platform != null)
256      {
257        rba.setPlatform(platform, rdt);
258      }
259      message = "Raw bioassay updated";
260    }
261    rba.setName(Values.getStringOrNull(request.getParameter("name")));
262    rba.setDescription(Values.getStringOrNull(request.getParameter("description")));
263    int protocolId = Values.getInt(request.getParameter("protocol_id"), -1);
264    if (protocolId >= 0)  // < 0 = denied or unchanged
265    {
266      Protocol pt = protocolId == 0 ? null : Protocol.getById(dc, protocolId);
267      rba.setProtocol(pt);
268      if (pt != null) cc.setRecent(pt, maxRecent);
269    }
270    int softwareId = Values.getInt(request.getParameter("software_id"), -1);
271    if (softwareId >= 0) // < 0 = denied or unchanged
272    {
273      Software sw = softwareId == 0 ? null : Software.getById(dc, softwareId);
274      rba.setSoftware(sw);
275      if (sw != null) cc.setRecent(sw, maxRecent);
276    }
277    int scanId = Values.getInt(request.getParameter("scan_id"), -1);
278    if (scanId >= 0) // < 0 = denied or unchanged
279    {
280      Scan scan = scanId == 0 ? null : Scan.getById(dc, scanId);
281      rba.setScan(scan);
282      if (scan != null) cc.setRecent(scan, maxRecent);
283    }
284    Job job = null;
285    ArrayDesign ad = null;
286    int arrayDesignId = Values.getInt(request.getParameter("arraydesign_id"), -1);
287    if (arrayDesignId >= 0) // < 0 = denied or unchanged
288    {
289      ad = arrayDesignId == 0 ? null : ArrayDesign.getById(dc, arrayDesignId);
290      if (rba.hasData())
291      {
292        if (rba.getRawDataType().isStoredInDb() && ad != null && ad.hasFeatures())
293        {
294          // Create job and assign it to another thread
295          job = Job.getNew(dc, null, null);
296          job.setName("Validating array design on " + rba.getName());
297          job.setPrepared(Application.getHostName());
298          job.setSendMessage(Values.getBoolean(sc.getUserClientSetting("plugins.sendmessage"), false));
299          dc.saveItem(job);
300        }
301        else
302        {
303          rba.updateArrayDesign(ad, null);
304        }
305      }
306      else
307      {
308        rba.setArrayDesign(ad);
309      }
310      if (ad != null) cc.setRecent(ad, maxRecent);
311    }
312
313    // Data files tab
314    boolean validate = Values.getBoolean(request.getParameter("datafiles.validate"));
315    boolean metadata = Values.getBoolean(request.getParameter("datafiles.metadata"));
316    Base.updateFiles(dc, rba, request, validate, metadata, cc, maxRecent);
317   
318    // Annotations tab
319    Base.updateAnnotations(dc, rba, rba, request);
320    dc.commit();
321    cc.removeObject("item");
322    if (job != null) 
323    {
324      redirect = "../jobs/index.jsp?ID="+ID+"&cmd=ViewItem&item_id="+job.getId();
325      Thread updateThread = new Thread(new UpdateArrayDesign(job, rba, ad));
326      updateThread.setPriority(Thread.currentThread().getPriority() - 1);
327      updateThread.start();
328    }
329  }
330  else if ("DeleteItem".equals(cmd))
331  {
332    // Delete a single item and then return to the view page
333    dc = sc.newDbControl();
334    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
335    RemovableUtil.setRemoved(dc, itemType, Collections.singleton(cc.getId()), true);
336    dc.commit();
337    redirect = viewPage;
338  }
339  else if ("DeleteItems".equals(cmd))
340  {
341    // Delete all selected items on the list page
342    dc = sc.newDbControl();
343    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
344    int numTotal = cc.getSelected().size();
345    int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), true);
346    dc.commit();
347    if (numTotal != numRemoved)
348    {
349      message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission";
350    }
351    redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
352  }
353  else if ("RestoreItem".equals(cmd))
354  {
355    // Restore a single item and then return to the view page
356    dc = sc.newDbControl();
357    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
358    RemovableUtil.setRemoved(dc, itemType, Collections.singleton(cc.getId()), false);
359    dc.commit();
360    redirect = viewPage;
361  }
362  else if ("RestoreItems".equals(cmd))
363  {
364    // Restore all selected items on the list page
365    dc = sc.newDbControl();
366    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
367    int numTotal = cc.getSelected().size();
368    int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), false);
369    dc.commit();
370    if (numTotal != numRemoved)
371    {
372      message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be restored, because you have no WRITE permission";
373    }
374    redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
375  }
376  else if ("ShareItem".equals(cmd))
377  {
378    // Display a popup window for sharing a single item
379    dc = sc.newDbControl();
380    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
381    MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, Collections.singleton(cc.getId()));
382    dc.close();
383    cc.setObject("MultiPermissions", permissions);
384    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
385  }
386  else if ("ShareItems".equals(cmd))
387  {
388    // Display a popup window for sharing all selected items on the list page
389    dc = sc.newDbControl();
390    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
391    MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, cc.getSelected());
392    dc.close();
393    cc.setObject("MultiPermissions", permissions);
394    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
395  }
396  else if ("TakeOwnershipOfItem".equals(cmd))
397  {
398    // Take ownership a single item and then return to the view page
399    dc = sc.newDbControl();
400    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
401    OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
402    dc.commit();
403    redirect = viewPage;
404  }
405  else if ("TakeOwnershipOfItems".equals(cmd))
406  {
407    // Take ownership all selected items on the list page
408    dc = sc.newDbControl();
409    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
410    int numTotal = cc.getSelected().size();
411    int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
412    dc.commit();
413    if (numTotal != numOwned)
414    {
415      message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
416    }
417    redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
418  }
419  else if ("ExportItems".equals(cmd))
420  {
421    // Run an export plugin in a list context
422    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
423    final ItemQuery<RawBioAssay> query = RawBioAssay.getQuery();
424    cc.configureQuery(query, true);
425    cc.setQuery(query);
426    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+raw+bioassays";
427  }
428  else if ("ExportItem".equals(cmd))
429  {
430    // Run an export plugin in single-item context
431    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
432    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+raw+bioassay";
433  }
434  else if ("ImportItems".equals(cmd))
435  {
436    // Run an import plugin in a list context
437    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
438    final ItemQuery<RawBioAssay> query = RawBioAssay.getQuery();
439    cc.configureQuery(query, true);
440    cc.setQuery(query);
441    redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Import+raw+bioassays";
442  }
443  else if ("ImportItem".equals(cmd))
444  {
445    // Run an import plugin in single-item context
446    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
447    // Set file type filter
448    ItemContext fileContext = sc.getCurrentContext(Item.FILE);
449    fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.RAW_DATA));
450    redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Import+raw+bioassay";
451  }
452  else if ("RunListPlugin".equals(cmd))
453  {
454    // Run another plugin in a list context
455    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
456    final ItemQuery<RawBioAssay> query = RawBioAssay.getQuery();
457    cc.configureQuery(query, true);
458    cc.setQuery(query);
459    redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&main_type=OTHER&title=Run+plugin";
460  }
461  else if ("RunPlugin".equals(cmd))
462  {
463    // Run another plugin in single-item context
464    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
465    redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=OTHER&title=Run+plugin";
466  }
467  else if ("CreateSpotImages".equals(cmd))
468  {
469    dc = sc.newDbControl();
470    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
471    RawBioAssay rba = RawBioAssay.getById(dc, cc.getId());
472   
473    int redFileId = Values.getInt(request.getParameter("redfile_id"));
474    File red = redFileId == 0 ? null : File.getById(dc, redFileId);
475    int greenFileId = Values.getInt(request.getParameter("greenfile_id"));
476    File green = greenFileId == 0 ? null : File.getById(dc, greenFileId);
477    int blueFileId = Values.getInt(request.getParameter("bluefile_id"));
478    File blue = blueFileId == 0 ? null : File.getById(dc, blueFileId);
479
480    String path = Values.getStringOrNull(request.getParameter("path"));
481    if (path.startsWith("~/"))
482    {
483      User user = User.getById(dc, sc.getLoggedInUserId());
484      path = "~"+user.getLogin()+path.substring(1);
485    }
486    Path p = new Path(path, Path.Type.FILE);
487    File saveAs = File.getByPath(dc, p, true);
488    if (saveAs.isInDatabase() && !Values.getBoolean(request.getParameter("overwrite")))
489    {
490      throw new ItemAlreadyExistsException("File[path="+path+"]");
491    }
492   
493    IntegerParameterType integerParameter = new IntegerParameterType();
494    FloatParameterType floatParameter = new FloatParameterType();
495    FileParameterType fileParameter = new FileParameterType();
496    ItemParameterType<RawBioAssay> itemParameter = new ItemParameterType(RawBioAssay.class, null);
497    StringParameterType stringParameter = new StringParameterType();
498    BooleanParameterType booleanParameter = new BooleanParameterType();
499   
500    PluginDefinition plugin = PluginDefinition.getByClassName(dc, "net.sf.basedb.plugins.SpotImageCreator");
501    Job job = Job.getNew(dc, plugin, null);
502    job.setName("Create spot images for raw bioassay: " + rba.getName());
503    job.setParameterValue("rawBioAssay", "Raw bioassay", 
504      "The raw bioassay to create spot images for", itemParameter, rba);
505    job.setParameterValue("xScale", "X scale factor", 
506      "The raw data X value will be divided by this value to get the pixel coordinate", 
507      integerParameter, Values.getInt(request.getParameter("x_scale")));
508    job.setParameterValue("yScale", "Y scale factor", 
509      "The raw data Y value will be divided by this value to get the pixel coordinate", 
510      integerParameter, Values.getInt(request.getParameter("y_scale")));
511    job.setParameterValue("xOffset", "X offset value",
512      "The offset is subtracted from the raw data X value",
513      integerParameter, Values.getInt(request.getParameter("x_offset")));
514    job.setParameterValue("yOffset", "Y offset value",
515      "The offset is subtracted from the raw data Y value",
516      integerParameter, Values.getInt(request.getParameter("y_offset")));
517    job.setParameterValue("spotsize", "Spot size", "The size of each spot in pixels",
518      integerParameter, Values.getInt(request.getParameter("spotsize")));
519    job.setParameterValue("gamma", "Gamma", "Gamma correction for display",
520      floatParameter, Values.getFloat(request.getParameter("gamma")));
521    job.setParameterValue("quality", "Quality", 
522      "The quality is a number between 0.0 and 1.0, with 1.0 indicating highest quality.", 
523      floatParameter, Values.getFloat(request.getParameter("quality")));
524    job.setParameterValue("redFile", "Red image", 
525      "The file containing the image to use for the red part", fileParameter, red);
526    job.setParameterValue("greenFile", "Green image", 
527      "The file containing the image to use for the green part", fileParameter, green);
528    job.setParameterValue("blueFile", "Blue image",
529      "The file containing the image to use for the red part", fileParameter, blue);
530    job.setParameterValue("path", "Save as", 
531      "The file name where the spot images should be saved", stringParameter, path);
532    job.setParameterValue("overwrite", "Overwrite", 
533      "If an existing file should be overwritten or not", booleanParameter, Values.getBoolean(request.getParameter("overwrite")));
534   
535    dc.saveItem(job);
536    dc.commit();
537
538    redirect = "../jobs/index.jsp?ID="+ID+"&cmd=ViewItem&item_id="+job.getId();
539  }
540  else
541  {
542    throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd);
543  }
544
545
546  /*
547  else if ("ImportRawData".equals(cmd))
548  {
549    RawBioAssay rba = (RawBioAssay)sc.getSessionSetting(itemType.name()+".item");
550    ItemContext context = sc.getCurrentContext(itemType);
551    context.setId(rba.getId());
552    redirect = "../../common/import/configure.jsp?ID="+ID+"&item_type="+itemType.name()+"&context_type=ITEM&title=Import+raw+data+for+"+HTML.urlEncode(rba.getName());
553
554  }
555  */
556}
557finally
558{
559  if (dc != null) dc.close();
560}
561
562if (forward != null)
563{
564  pageContext.forward(forward);
565}
566else if (redirect != null)
567{
568  response.sendRedirect(redirect);
569}
570else if (message == null)
571{
572  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0");
573}
574else
575{
576  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message));
577}
578%>
579
Note: See TracBrowser for help on using the repository browser.