1672 |
30 Nov 05 |
nicklas |
1 |
<%-- $Id$ |
1672 |
30 Nov 05 |
nicklas |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2007 Nicklas Nordborg |
1672 |
30 Nov 05 |
nicklas |
6 |
|
2304 |
22 May 06 |
jari |
7 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
8 |
Available at http://base.thep.lu.se/ |
1672 |
30 Nov 05 |
nicklas |
9 |
|
1672 |
30 Nov 05 |
nicklas |
10 |
BASE is free software; you can redistribute it and/or |
1672 |
30 Nov 05 |
nicklas |
11 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
12 |
as published by the Free Software Foundation; either version 3 |
1672 |
30 Nov 05 |
nicklas |
13 |
of the License, or (at your option) any later version. |
1672 |
30 Nov 05 |
nicklas |
14 |
|
1672 |
30 Nov 05 |
nicklas |
15 |
BASE is distributed in the hope that it will be useful, |
1672 |
30 Nov 05 |
nicklas |
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1672 |
30 Nov 05 |
nicklas |
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1672 |
30 Nov 05 |
nicklas |
18 |
GNU General Public License for more details. |
1672 |
30 Nov 05 |
nicklas |
19 |
|
1672 |
30 Nov 05 |
nicklas |
20 |
You should have received a copy of the GNU General Public License |
4511 |
11 Sep 08 |
jari |
21 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1672 |
30 Nov 05 |
nicklas |
22 |
------------------------------------------------------------------ |
1672 |
30 Nov 05 |
nicklas |
23 |
|
1672 |
30 Nov 05 |
nicklas |
24 |
@author Nicklas |
1672 |
30 Nov 05 |
nicklas |
25 |
@version 2.0 |
1672 |
30 Nov 05 |
nicklas |
26 |
--%> |
5426 |
24 Sep 10 |
nicklas |
27 |
<%@ page pageEncoding="UTF-8" session="false" |
3523 |
20 Jun 07 |
nicklas |
28 |
import="net.sf.basedb.core.Application" |
1672 |
30 Nov 05 |
nicklas |
29 |
import="net.sf.basedb.core.SessionControl" |
1672 |
30 Nov 05 |
nicklas |
30 |
import="net.sf.basedb.core.DbControl" |
1672 |
30 Nov 05 |
nicklas |
31 |
import="net.sf.basedb.core.Item" |
1713 |
14 Dec 05 |
nicklas |
32 |
import="net.sf.basedb.core.Include" |
1672 |
30 Nov 05 |
nicklas |
33 |
import="net.sf.basedb.core.RawBioAssay" |
5657 |
16 Jun 11 |
nicklas |
34 |
import="net.sf.basedb.core.FeatureIdentificationMethod" |
1713 |
14 Dec 05 |
nicklas |
35 |
import="net.sf.basedb.core.Protocol" |
1713 |
14 Dec 05 |
nicklas |
36 |
import="net.sf.basedb.core.Software" |
1713 |
14 Dec 05 |
nicklas |
37 |
import="net.sf.basedb.core.ArrayDesign" |
5685 |
04 Aug 11 |
nicklas |
38 |
import="net.sf.basedb.core.Extract" |
5685 |
04 Aug 11 |
nicklas |
39 |
import="net.sf.basedb.core.DerivedBioAssay" |
4901 |
23 Apr 09 |
martin |
40 |
import="net.sf.basedb.core.Experiment" |
1713 |
14 Dec 05 |
nicklas |
41 |
import="net.sf.basedb.core.File" |
1672 |
30 Nov 05 |
nicklas |
42 |
import="net.sf.basedb.core.RawDataType" |
1672 |
30 Nov 05 |
nicklas |
43 |
import="net.sf.basedb.core.RawDataTypes" |
3820 |
12 Oct 07 |
nicklas |
44 |
import="net.sf.basedb.core.Platform" |
3820 |
12 Oct 07 |
nicklas |
45 |
import="net.sf.basedb.core.PlatformVariant" |
1713 |
14 Dec 05 |
nicklas |
46 |
import="net.sf.basedb.core.User" |
1713 |
14 Dec 05 |
nicklas |
47 |
import="net.sf.basedb.core.Path" |
1672 |
30 Nov 05 |
nicklas |
48 |
import="net.sf.basedb.core.ItemQuery" |
1672 |
30 Nov 05 |
nicklas |
49 |
import="net.sf.basedb.core.ItemResultIterator" |
4587 |
15 Oct 08 |
martin |
50 |
import="net.sf.basedb.core.OwnedItem" |
6694 |
26 Jan 15 |
nicklas |
51 |
import="net.sf.basedb.core.AnnotatedItem" |
1713 |
14 Dec 05 |
nicklas |
52 |
import="net.sf.basedb.core.Permission" |
1708 |
13 Dec 05 |
nicklas |
53 |
import="net.sf.basedb.core.ItemContext" |
1713 |
14 Dec 05 |
nicklas |
54 |
import="net.sf.basedb.core.MultiPermissions" |
1713 |
14 Dec 05 |
nicklas |
55 |
import="net.sf.basedb.core.PermissionDeniedException" |
1713 |
14 Dec 05 |
nicklas |
56 |
import="net.sf.basedb.core.ItemAlreadyExistsException" |
1869 |
31 Jan 06 |
nicklas |
57 |
import="net.sf.basedb.core.PluginDefinition" |
1869 |
31 Jan 06 |
nicklas |
58 |
import="net.sf.basedb.core.Job" |
3523 |
20 Jun 07 |
nicklas |
59 |
import="net.sf.basedb.core.ProgressReporter" |
1869 |
31 Jan 06 |
nicklas |
60 |
import="net.sf.basedb.core.IntegerParameterType" |
1869 |
31 Jan 06 |
nicklas |
61 |
import="net.sf.basedb.core.FloatParameterType" |
1869 |
31 Jan 06 |
nicklas |
62 |
import="net.sf.basedb.core.StringParameterType" |
1869 |
31 Jan 06 |
nicklas |
63 |
import="net.sf.basedb.core.FileParameterType" |
1869 |
31 Jan 06 |
nicklas |
64 |
import="net.sf.basedb.core.ItemParameterType" |
1869 |
31 Jan 06 |
nicklas |
65 |
import="net.sf.basedb.core.BooleanParameterType" |
4901 |
23 Apr 09 |
martin |
66 |
import="net.sf.basedb.core.query.Hql" |
4901 |
23 Apr 09 |
martin |
67 |
import="net.sf.basedb.core.query.Orders" |
4901 |
23 Apr 09 |
martin |
68 |
import="net.sf.basedb.core.query.Restrictions" |
4901 |
23 Apr 09 |
martin |
69 |
import="net.sf.basedb.core.query.Expressions" |
1713 |
14 Dec 05 |
nicklas |
70 |
import="net.sf.basedb.util.RemovableUtil" |
1713 |
14 Dec 05 |
nicklas |
71 |
import="net.sf.basedb.util.ShareableUtil" |
2918 |
15 Nov 06 |
nicklas |
72 |
import="net.sf.basedb.util.OwnableUtil" |
1672 |
30 Nov 05 |
nicklas |
73 |
import="net.sf.basedb.clients.web.Base" |
1713 |
14 Dec 05 |
nicklas |
74 |
import="net.sf.basedb.clients.web.WebException" |
2753 |
20 Oct 06 |
nicklas |
75 |
import="net.sf.basedb.util.Values" |
4901 |
23 Apr 09 |
martin |
76 |
import="net.sf.basedb.util.formatter.NameableFormatter" |
5382 |
05 Aug 10 |
nicklas |
77 |
import="net.sf.basedb.util.formatter.FilePathFormatter" |
4901 |
23 Apr 09 |
martin |
78 |
import="net.sf.basedb.clients.web.plugins.ItemQueryLoader" |
5382 |
05 Aug 10 |
nicklas |
79 |
import="net.sf.basedb.clients.web.plugins.FileSetMemberLoader" |
4901 |
23 Apr 09 |
martin |
80 |
import="net.sf.basedb.clients.web.util.HTML" |
5501 |
18 Nov 10 |
nicklas |
81 |
import="net.sf.basedb.core.plugin.GuiContext" |
5501 |
18 Nov 10 |
nicklas |
82 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
5501 |
18 Nov 10 |
nicklas |
83 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5501 |
18 Nov 10 |
nicklas |
84 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5501 |
18 Nov 10 |
nicklas |
85 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
86 |
import="net.sf.basedb.clients.web.extensions.edit.OnSaveAction" |
5501 |
18 Nov 10 |
nicklas |
87 |
import="net.sf.basedb.clients.web.extensions.edit.OnSaveRenderer" |
6030 |
28 Mar 12 |
nicklas |
88 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnExportRenderer" |
7604 |
25 Feb 19 |
nicklas |
89 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnAction" |
6030 |
28 Mar 12 |
nicklas |
90 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
1713 |
14 Dec 05 |
nicklas |
91 |
import="java.util.Enumeration" |
1713 |
14 Dec 05 |
nicklas |
92 |
import="java.util.Set" |
1713 |
14 Dec 05 |
nicklas |
93 |
import="java.util.HashSet" |
1672 |
30 Nov 05 |
nicklas |
94 |
import="java.util.List" |
1713 |
14 Dec 05 |
nicklas |
95 |
import="java.util.ArrayList" |
3523 |
20 Jun 07 |
nicklas |
96 |
import="java.util.Arrays" |
1765 |
13 Jan 06 |
nicklas |
97 |
import="java.util.Collections" |
1672 |
30 Nov 05 |
nicklas |
98 |
%> |
1672 |
30 Nov 05 |
nicklas |
99 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1672 |
30 Nov 05 |
nicklas |
100 |
<%! |
3820 |
12 Oct 07 |
nicklas |
101 |
private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,platform,variant,hasData,description"); |
1765 |
13 Jan 06 |
nicklas |
102 |
private static final Item itemType = Item.RAWBIOASSAY; |
3523 |
20 Jun 07 |
nicklas |
103 |
|
4901 |
23 Apr 09 |
martin |
104 |
private static void registerExportUtils(ItemContext cc) |
4901 |
23 Apr 09 |
martin |
105 |
{ |
4901 |
23 Apr 09 |
martin |
106 |
// Register formatters |
4901 |
23 Apr 09 |
martin |
107 |
cc.setObject("export.formatter.&experiments(name)", new NameableFormatter()); |
5382 |
05 Aug 10 |
nicklas |
108 |
cc.setObject("export.formatter.&fileSet.members(file.name)", new FilePathFormatter()); |
4901 |
23 Apr 09 |
martin |
109 |
|
4901 |
23 Apr 09 |
martin |
110 |
// Register dataloaders |
4901 |
23 Apr 09 |
martin |
111 |
String rawParameter = "rawBioAssay"; |
4901 |
23 Apr 09 |
martin |
112 |
final ItemQuery<Experiment> experimentQuery = Experiment.getQuery(); |
4901 |
23 Apr 09 |
martin |
113 |
experimentQuery.include(cc.getInclude()); |
4901 |
23 Apr 09 |
martin |
114 |
experimentQuery.join(Hql.innerJoin("rawBioAssays", "rba")); |
4901 |
23 Apr 09 |
martin |
115 |
experimentQuery.restrict(Restrictions.eq(Hql.alias("rba"), Expressions.parameter(rawParameter))); |
4901 |
23 Apr 09 |
martin |
116 |
experimentQuery.order(Orders.asc(Hql.property("name"))); |
7604 |
25 Feb 19 |
nicklas |
117 |
cc.setObject("export.dataloader.&experiments(name)", new ItemQueryLoader<RawBioAssay>(experimentQuery, rawParameter)); |
5382 |
05 Aug 10 |
nicklas |
118 |
cc.setObject("export.dataloader.&fileSet.members(file.name)", new FileSetMemberLoader()); |
4901 |
23 Apr 09 |
martin |
119 |
} |
4901 |
23 Apr 09 |
martin |
120 |
|
3523 |
20 Jun 07 |
nicklas |
121 |
private static class UpdateArrayDesign |
3523 |
20 Jun 07 |
nicklas |
122 |
implements Runnable |
3523 |
20 Jun 07 |
nicklas |
123 |
{ |
3523 |
20 Jun 07 |
nicklas |
124 |
private final int jobId; |
3523 |
20 Jun 07 |
nicklas |
125 |
private final int rawBioAssayId; |
3523 |
20 Jun 07 |
nicklas |
126 |
private final int arrayDesignId; |
3523 |
20 Jun 07 |
nicklas |
127 |
private final SessionControl sc; |
4093 |
18 Jan 08 |
enell |
128 |
private final FeatureIdentificationMethod fiMethod; |
3523 |
20 Jun 07 |
nicklas |
129 |
|
4093 |
18 Jan 08 |
enell |
130 |
private UpdateArrayDesign(Job job, RawBioAssay rba, ArrayDesign design, FeatureIdentificationMethod fiMethod) |
3523 |
20 Jun 07 |
nicklas |
131 |
{ |
3523 |
20 Jun 07 |
nicklas |
132 |
this.jobId = job.getId(); |
3523 |
20 Jun 07 |
nicklas |
133 |
this.rawBioAssayId = rba.getId(); |
3523 |
20 Jun 07 |
nicklas |
134 |
this.arrayDesignId = design.getId(); |
3523 |
20 Jun 07 |
nicklas |
135 |
this.sc = job.getSessionControl(); |
4093 |
18 Jan 08 |
enell |
136 |
this.fiMethod = fiMethod; |
3523 |
20 Jun 07 |
nicklas |
137 |
} |
3523 |
20 Jun 07 |
nicklas |
138 |
|
3523 |
20 Jun 07 |
nicklas |
139 |
public void run() |
3523 |
20 Jun 07 |
nicklas |
140 |
{ |
7954 |
12 May 21 |
nicklas |
141 |
DbControl dc = sc.newDbControl(":Update array design on raw bioassay"); |
3523 |
20 Jun 07 |
nicklas |
142 |
try |
3523 |
20 Jun 07 |
nicklas |
143 |
{ |
3523 |
20 Jun 07 |
nicklas |
144 |
Job j = Job.getById(dc, jobId); |
5590 |
16 Mar 11 |
nicklas |
145 |
j.start("Initialising...", Application.getHostName(), null); |
3524 |
20 Jun 07 |
nicklas |
146 |
ProgressReporter progress = j.getProgressReporter(null); |
3523 |
20 Jun 07 |
nicklas |
147 |
dc.commit(); |
7954 |
12 May 21 |
nicklas |
148 |
dc = sc.newDbControl(":Update array design on raw bioassay"); |
3523 |
20 Jun 07 |
nicklas |
149 |
RawBioAssay rba = RawBioAssay.getById(dc, rawBioAssayId); |
3523 |
20 Jun 07 |
nicklas |
150 |
ArrayDesign design = ArrayDesign.getById(dc, arrayDesignId); |
3523 |
20 Jun 07 |
nicklas |
151 |
try |
3523 |
20 Jun 07 |
nicklas |
152 |
{ |
4093 |
18 Jan 08 |
enell |
153 |
rba.updateArrayDesign(design, fiMethod, progress); |
3523 |
20 Jun 07 |
nicklas |
154 |
progress.display(99, "Committing changes to database..."); |
3523 |
20 Jun 07 |
nicklas |
155 |
dc.commit(); |
7954 |
12 May 21 |
nicklas |
156 |
dc = sc.newDbControl(":Update array design on raw bioassay"); |
3523 |
20 Jun 07 |
nicklas |
157 |
j = Job.getById(dc, jobId); |
3523 |
20 Jun 07 |
nicklas |
158 |
j.doneOk("Array design updated successfully"); |
3523 |
20 Jun 07 |
nicklas |
159 |
j.setRemoved(true); |
3523 |
20 Jun 07 |
nicklas |
160 |
dc.commit(); |
3523 |
20 Jun 07 |
nicklas |
161 |
} |
3523 |
20 Jun 07 |
nicklas |
162 |
catch (Throwable t) |
3523 |
20 Jun 07 |
nicklas |
163 |
{ |
4093 |
18 Jan 08 |
enell |
164 |
if (dc != null) dc.close(); |
7954 |
12 May 21 |
nicklas |
165 |
dc = sc.newDbControl(":Update array design on raw bioassay"); |
3523 |
20 Jun 07 |
nicklas |
166 |
j = Job.getById(dc, jobId); |
3523 |
20 Jun 07 |
nicklas |
167 |
j.doneError(t.getMessage(), Arrays.asList(t)); |
3523 |
20 Jun 07 |
nicklas |
168 |
j.setRemoved(true); |
3523 |
20 Jun 07 |
nicklas |
169 |
dc.commit(); |
3523 |
20 Jun 07 |
nicklas |
170 |
} |
3523 |
20 Jun 07 |
nicklas |
171 |
} |
3523 |
20 Jun 07 |
nicklas |
172 |
finally |
3523 |
20 Jun 07 |
nicklas |
173 |
{ |
3523 |
20 Jun 07 |
nicklas |
174 |
if (dc != null) dc.close(); |
3523 |
20 Jun 07 |
nicklas |
175 |
} |
3523 |
20 Jun 07 |
nicklas |
176 |
} |
3523 |
20 Jun 07 |
nicklas |
177 |
} |
1672 |
30 Nov 05 |
nicklas |
178 |
%> |
1672 |
30 Nov 05 |
nicklas |
179 |
<% |
1713 |
14 Dec 05 |
nicklas |
180 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1713 |
14 Dec 05 |
nicklas |
181 |
final String ID = sc.getId(); |
1713 |
14 Dec 05 |
nicklas |
182 |
final String cmd = request.getParameter("cmd"); |
1713 |
14 Dec 05 |
nicklas |
183 |
final String root = request.getContextPath()+"/"; |
1775 |
16 Jan 06 |
nicklas |
184 |
final String mode = request.getParameter("mode"); |
1775 |
16 Jan 06 |
nicklas |
185 |
final String callback = request.getParameter("callback"); |
1775 |
16 Jan 06 |
nicklas |
186 |
final String itemId = request.getParameter("item_id"); |
1775 |
16 Jan 06 |
nicklas |
187 |
final String listPage = "list_rawbioassays.jsp?ID="+ID |
1775 |
16 Jan 06 |
nicklas |
188 |
+(mode == null ? "" : "&mode="+mode) |
1775 |
16 Jan 06 |
nicklas |
189 |
+(callback == null ? "" : "&callback="+callback) |
1775 |
16 Jan 06 |
nicklas |
190 |
+(itemId == null ? "" : "&item_id="+itemId); |
1765 |
13 Jan 06 |
nicklas |
191 |
final String viewPage = "view_rawbioassay.jsp?ID="+ID; |
1765 |
13 Jan 06 |
nicklas |
192 |
final String editPage = "edit_rawbioassay.jsp?ID="+ID; |
1672 |
30 Nov 05 |
nicklas |
193 |
|
1713 |
14 Dec 05 |
nicklas |
194 |
String forward = null; |
1713 |
14 Dec 05 |
nicklas |
195 |
String redirect = null; |
1713 |
14 Dec 05 |
nicklas |
196 |
String message = null; |
1713 |
14 Dec 05 |
nicklas |
197 |
DbControl dc = null; |
1708 |
13 Dec 05 |
nicklas |
198 |
|
1672 |
30 Nov 05 |
nicklas |
199 |
try |
1672 |
30 Nov 05 |
nicklas |
200 |
{ |
1713 |
14 Dec 05 |
nicklas |
201 |
if (cmd == null || "List".equals(cmd)) |
1672 |
30 Nov 05 |
nicklas |
202 |
{ |
1765 |
13 Jan 06 |
nicklas |
203 |
// Display the list page without updatinging the current context |
2811 |
26 Oct 06 |
nicklas |
204 |
Base.getAndSetCurrentContext(sc, itemType, null, defaultContext, true); |
1727 |
19 Dec 05 |
nicklas |
205 |
redirect = listPage; |
1672 |
30 Nov 05 |
nicklas |
206 |
} |
1713 |
14 Dec 05 |
nicklas |
207 |
else if ("UpdateContext".equals(cmd)) |
1672 |
30 Nov 05 |
nicklas |
208 |
{ |
1765 |
13 Jan 06 |
nicklas |
209 |
// Display the list page after updating the current context from the request parameters |
1713 |
14 Dec 05 |
nicklas |
210 |
Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1727 |
19 Dec 05 |
nicklas |
211 |
redirect = listPage; |
1672 |
30 Nov 05 |
nicklas |
212 |
} |
1713 |
14 Dec 05 |
nicklas |
213 |
else if ("LoadContext".equals(cmd)) |
1672 |
30 Nov 05 |
nicklas |
214 |
{ |
1765 |
13 Jan 06 |
nicklas |
215 |
// Display the list page after loading a saved context |
1726 |
19 Dec 05 |
nicklas |
216 |
int contextId = Values.getInt(request.getParameter("context")); |
1765 |
13 Jan 06 |
nicklas |
217 |
Base.loadContext(sc, contextId, defaultContext); |
1727 |
19 Dec 05 |
nicklas |
218 |
redirect = listPage; |
1672 |
30 Nov 05 |
nicklas |
219 |
} |
1769 |
13 Jan 06 |
nicklas |
220 |
|
1765 |
13 Jan 06 |
nicklas |
221 |
else if ("ViewItem".equals(cmd)) |
1672 |
30 Nov 05 |
nicklas |
222 |
{ |
1765 |
13 Jan 06 |
nicklas |
223 |
// Display the view page for a single item |
1713 |
14 Dec 05 |
nicklas |
224 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1765 |
13 Jan 06 |
nicklas |
225 |
forward = viewPage; |
1713 |
14 Dec 05 |
nicklas |
226 |
} |
1765 |
13 Jan 06 |
nicklas |
227 |
else if ("EditItem".equals(cmd)) |
1713 |
14 Dec 05 |
nicklas |
228 |
{ |
1765 |
13 Jan 06 |
nicklas |
229 |
// Display the edit page for a single item (should be opened in a popup) |
1713 |
14 Dec 05 |
nicklas |
230 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
3859 |
18 Oct 07 |
nicklas |
231 |
forward = editPage; |
1765 |
13 Jan 06 |
nicklas |
232 |
} |
1765 |
13 Jan 06 |
nicklas |
233 |
else if ("NewItem".equals(cmd)) |
1765 |
13 Jan 06 |
nicklas |
234 |
{ |
1765 |
13 Jan 06 |
nicklas |
235 |
// Display the edit page for a new item (should be opened in a popup) |
1765 |
13 Jan 06 |
nicklas |
236 |
if (!sc.hasPermission(Permission.CREATE, itemType)) |
1672 |
30 Nov 05 |
nicklas |
237 |
{ |
1765 |
13 Jan 06 |
nicklas |
238 |
throw new PermissionDeniedException(Permission.CREATE, itemType.toString()); |
1672 |
30 Nov 05 |
nicklas |
239 |
} |
1713 |
14 Dec 05 |
nicklas |
240 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1765 |
13 Jan 06 |
nicklas |
241 |
cc.setId(0); |
2413 |
22 Jun 06 |
nicklas |
242 |
forward = editPage; |
1713 |
14 Dec 05 |
nicklas |
243 |
} |
1765 |
13 Jan 06 |
nicklas |
244 |
else if ("UpdateItem".equals(cmd)) |
1713 |
14 Dec 05 |
nicklas |
245 |
{ |
1765 |
13 Jan 06 |
nicklas |
246 |
// Update the properties on an item (will close the popup) |
1765 |
13 Jan 06 |
nicklas |
247 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext); |
2597 |
25 Aug 06 |
nicklas |
248 |
final int maxRecent = Base.getMaxRecent(sc); |
7954 |
12 May 21 |
nicklas |
249 |
dc = sc.newDbControl(":Edit "+itemType); |
7605 |
26 Feb 19 |
nicklas |
250 |
RawBioAssay rba = cc.getObject("item"); |
3820 |
12 Oct 07 |
nicklas |
251 |
|
3820 |
12 Oct 07 |
nicklas |
252 |
Platform platform = null; |
3820 |
12 Oct 07 |
nicklas |
253 |
PlatformVariant variant = null; |
6413 |
05 Feb 14 |
nicklas |
254 |
String pf = request.getParameter("platform"); |
3820 |
12 Oct 07 |
nicklas |
255 |
|
6413 |
05 Feb 14 |
nicklas |
256 |
if (pf != null) |
3820 |
12 Oct 07 |
nicklas |
257 |
{ |
6413 |
05 Feb 14 |
nicklas |
258 |
if (pf.startsWith("PLATFORM:")) |
6413 |
05 Feb 14 |
nicklas |
259 |
{ |
6413 |
05 Feb 14 |
nicklas |
260 |
int platformId = Values.getInt(pf.substring(9), -1); |
6413 |
05 Feb 14 |
nicklas |
261 |
if (platformId > 0) platform = Platform.getById(dc, platformId); |
6413 |
05 Feb 14 |
nicklas |
262 |
} |
6413 |
05 Feb 14 |
nicklas |
263 |
else if (pf.startsWith("VARIANT:")) |
6413 |
05 Feb 14 |
nicklas |
264 |
{ |
6413 |
05 Feb 14 |
nicklas |
265 |
int variantId = Values.getInt(pf.substring(8), -1); |
6413 |
05 Feb 14 |
nicklas |
266 |
if (variantId > 0) |
6413 |
05 Feb 14 |
nicklas |
267 |
{ |
6413 |
05 Feb 14 |
nicklas |
268 |
variant = PlatformVariant.getById(dc, variantId); |
6413 |
05 Feb 14 |
nicklas |
269 |
platform = variant.getPlatform(); |
6413 |
05 Feb 14 |
nicklas |
270 |
} |
6413 |
05 Feb 14 |
nicklas |
271 |
} |
3820 |
12 Oct 07 |
nicklas |
272 |
} |
1713 |
14 Dec 05 |
nicklas |
273 |
RawDataType rdt = RawDataTypes.getRawDataType(Values.getStringOrNull(request.getParameter("rawdatatype"))); |
7703 |
11 Apr 19 |
nicklas |
274 |
cc.setRecent(Item.PLATFORM, platform, maxRecent); |
7703 |
11 Apr 19 |
nicklas |
275 |
cc.setRecent(Item.PLATFORMVARIANT, variant, maxRecent); |
2596 |
25 Aug 06 |
nicklas |
276 |
if (rdt != null) cc.setRecent("RawDataType", rdt.getId(), maxRecent); |
2596 |
25 Aug 06 |
nicklas |
277 |
|
1713 |
14 Dec 05 |
nicklas |
278 |
if (rba == null) |
1672 |
30 Nov 05 |
nicklas |
279 |
{ |
3820 |
12 Oct 07 |
nicklas |
280 |
if (variant != null) |
3820 |
12 Oct 07 |
nicklas |
281 |
{ |
3820 |
12 Oct 07 |
nicklas |
282 |
rba = RawBioAssay.getNew(dc, variant, rdt); |
3820 |
12 Oct 07 |
nicklas |
283 |
} |
3820 |
12 Oct 07 |
nicklas |
284 |
else |
3820 |
12 Oct 07 |
nicklas |
285 |
{ |
3820 |
12 Oct 07 |
nicklas |
286 |
rba = RawBioAssay.getNew(dc, platform, rdt); |
3820 |
12 Oct 07 |
nicklas |
287 |
} |
1713 |
14 Dec 05 |
nicklas |
288 |
message = "Raw bioassay created"; |
1713 |
14 Dec 05 |
nicklas |
289 |
dc.saveItem(rba); |
1672 |
30 Nov 05 |
nicklas |
290 |
} |
1713 |
14 Dec 05 |
nicklas |
291 |
else |
1672 |
30 Nov 05 |
nicklas |
292 |
{ |
5060 |
19 Aug 09 |
nicklas |
293 |
dc.reattachItem(rba, false); |
3820 |
12 Oct 07 |
nicklas |
294 |
if (variant != null) |
3820 |
12 Oct 07 |
nicklas |
295 |
{ |
3820 |
12 Oct 07 |
nicklas |
296 |
rba.setVariant(variant, rdt); |
3820 |
12 Oct 07 |
nicklas |
297 |
} |
3820 |
12 Oct 07 |
nicklas |
298 |
else if (platform != null) |
3820 |
12 Oct 07 |
nicklas |
299 |
{ |
3820 |
12 Oct 07 |
nicklas |
300 |
rba.setPlatform(platform, rdt); |
3820 |
12 Oct 07 |
nicklas |
301 |
} |
1713 |
14 Dec 05 |
nicklas |
302 |
message = "Raw bioassay updated"; |
1672 |
30 Nov 05 |
nicklas |
303 |
} |
5501 |
18 Nov 10 |
nicklas |
304 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(Item.RAWBIOASSAY), rba); |
7604 |
25 Feb 19 |
nicklas |
305 |
ExtensionsInvoker<OnSaveAction> invoker = EditUtil.useOnSaveExtensions(jspContext); |
5501 |
18 Nov 10 |
nicklas |
306 |
try |
1672 |
30 Nov 05 |
nicklas |
307 |
{ |
5501 |
18 Nov 10 |
nicklas |
308 |
rba.setName(Values.getStringOrNull(request.getParameter("name"))); |
5501 |
18 Nov 10 |
nicklas |
309 |
rba.setDescription(Values.getStringOrNull(request.getParameter("description"))); |
5501 |
18 Nov 10 |
nicklas |
310 |
int protocolId = Values.getInt(request.getParameter("protocol_id"), -1); |
5501 |
18 Nov 10 |
nicklas |
311 |
if (protocolId >= 0) // < 0 = denied or unchanged |
3523 |
20 Jun 07 |
nicklas |
312 |
{ |
5501 |
18 Nov 10 |
nicklas |
313 |
Protocol pt = protocolId == 0 ? null : Protocol.getById(dc, protocolId); |
5501 |
18 Nov 10 |
nicklas |
314 |
rba.setProtocol(pt); |
7703 |
11 Apr 19 |
nicklas |
315 |
cc.setRecent(Item.PROTOCOL, pt, maxRecent); |
5501 |
18 Nov 10 |
nicklas |
316 |
} |
5501 |
18 Nov 10 |
nicklas |
317 |
int softwareId = Values.getInt(request.getParameter("software_id"), -1); |
5501 |
18 Nov 10 |
nicklas |
318 |
if (softwareId >= 0) // < 0 = denied or unchanged |
5501 |
18 Nov 10 |
nicklas |
319 |
{ |
5501 |
18 Nov 10 |
nicklas |
320 |
Software sw = softwareId == 0 ? null : Software.getById(dc, softwareId); |
5501 |
18 Nov 10 |
nicklas |
321 |
rba.setSoftware(sw); |
7703 |
11 Apr 19 |
nicklas |
322 |
cc.setRecent(Item.SOFTWARE, sw, maxRecent); |
5501 |
18 Nov 10 |
nicklas |
323 |
} |
5685 |
04 Aug 11 |
nicklas |
324 |
int bioAssayId = Values.getInt(request.getParameter("bioassay_id"), -1); |
5685 |
04 Aug 11 |
nicklas |
325 |
if (bioAssayId >= 0) // < 0 = denied or unchanged |
5685 |
04 Aug 11 |
nicklas |
326 |
{ |
5685 |
04 Aug 11 |
nicklas |
327 |
DerivedBioAssay bioAssay = bioAssayId == 0 ? null : DerivedBioAssay.getById(dc, bioAssayId); |
5685 |
04 Aug 11 |
nicklas |
328 |
rba.setParentBioAssay(bioAssay); |
7703 |
11 Apr 19 |
nicklas |
329 |
cc.setRecent(Item.DERIVEDBIOASSAY, bioAssay, maxRecent); |
5685 |
04 Aug 11 |
nicklas |
330 |
} |
5685 |
04 Aug 11 |
nicklas |
331 |
int extractId = Values.getInt(request.getParameter("extract_id"), -1); |
5685 |
04 Aug 11 |
nicklas |
332 |
if (extractId >= 0) // < 0 = denied or unchanged |
5685 |
04 Aug 11 |
nicklas |
333 |
{ |
5685 |
04 Aug 11 |
nicklas |
334 |
Extract extract = extractId == 0 ? null : Extract.getById(dc, extractId); |
5685 |
04 Aug 11 |
nicklas |
335 |
rba.setParentExtract(extract); |
7703 |
11 Apr 19 |
nicklas |
336 |
cc.setRecent(Item.EXTRACT, extract, maxRecent); |
5685 |
04 Aug 11 |
nicklas |
337 |
} |
5657 |
16 Jun 11 |
nicklas |
338 |
|
5501 |
18 Nov 10 |
nicklas |
339 |
Job job = null; |
5501 |
18 Nov 10 |
nicklas |
340 |
ArrayDesign ad = null; |
5501 |
18 Nov 10 |
nicklas |
341 |
FeatureIdentificationMethod fiMethod = null; |
5501 |
18 Nov 10 |
nicklas |
342 |
int arrayDesignId = Values.getInt(request.getParameter("arraydesign_id"), -1); |
5501 |
18 Nov 10 |
nicklas |
343 |
if (arrayDesignId >= 0) // < 0 = denied or unchanged |
5501 |
18 Nov 10 |
nicklas |
344 |
{ |
5501 |
18 Nov 10 |
nicklas |
345 |
ad = arrayDesignId == 0 ? null : ArrayDesign.getById(dc, arrayDesignId); |
6600 |
17 Nov 14 |
nicklas |
346 |
if (!rba.isSameArrayDesign(ad) || !rba.isInDatabase()) |
4093 |
18 Jan 08 |
enell |
347 |
{ |
5807 |
14 Oct 11 |
nicklas |
348 |
if (rba.hasData()) |
5501 |
18 Nov 10 |
nicklas |
349 |
{ |
5807 |
14 Oct 11 |
nicklas |
350 |
try |
5807 |
14 Oct 11 |
nicklas |
351 |
{ |
5807 |
14 Oct 11 |
nicklas |
352 |
fiMethod = FeatureIdentificationMethod.valueOf(request.getParameter("fiMethod")); |
5807 |
14 Oct 11 |
nicklas |
353 |
} |
5807 |
14 Oct 11 |
nicklas |
354 |
catch (Exception ex) |
5807 |
14 Oct 11 |
nicklas |
355 |
{} |
5807 |
14 Oct 11 |
nicklas |
356 |
if (rba.getRawDataType().isStoredInDb() && ad != null && ad.hasFeatures()) |
5807 |
14 Oct 11 |
nicklas |
357 |
{ |
5807 |
14 Oct 11 |
nicklas |
358 |
// Create job and assign it to another thread |
5807 |
14 Oct 11 |
nicklas |
359 |
job = Job.getNew(dc, null, null, null); |
5807 |
14 Oct 11 |
nicklas |
360 |
job.setName("Validating array design on " + rba.getName()); |
5807 |
14 Oct 11 |
nicklas |
361 |
job.setPrepared(Application.getHostName(), null); |
5807 |
14 Oct 11 |
nicklas |
362 |
job.setSendMessage(Values.getBoolean(sc.getUserClientSetting("plugins.sendmessage"), false)); |
5807 |
14 Oct 11 |
nicklas |
363 |
dc.saveItem(job); |
5807 |
14 Oct 11 |
nicklas |
364 |
} |
5807 |
14 Oct 11 |
nicklas |
365 |
else |
5807 |
14 Oct 11 |
nicklas |
366 |
{ |
5807 |
14 Oct 11 |
nicklas |
367 |
rba.updateArrayDesign(ad, fiMethod, null); |
5807 |
14 Oct 11 |
nicklas |
368 |
} |
5501 |
18 Nov 10 |
nicklas |
369 |
} |
5501 |
18 Nov 10 |
nicklas |
370 |
else |
5501 |
18 Nov 10 |
nicklas |
371 |
{ |
5807 |
14 Oct 11 |
nicklas |
372 |
rba.setArrayDesign(ad); |
5501 |
18 Nov 10 |
nicklas |
373 |
} |
4093 |
18 Jan 08 |
enell |
374 |
} |
7703 |
11 Apr 19 |
nicklas |
375 |
cc.setRecent(Item.ARRAYDESIGN, ad, maxRecent); |
3523 |
20 Jun 07 |
nicklas |
376 |
} |
5501 |
18 Nov 10 |
nicklas |
377 |
|
5501 |
18 Nov 10 |
nicklas |
378 |
// Data files tab |
5501 |
18 Nov 10 |
nicklas |
379 |
boolean validate = Values.getBoolean(request.getParameter("datafiles.validate")); |
5623 |
06 May 11 |
nicklas |
380 |
Base.updateFiles(dc, rba, request, validate, cc, maxRecent); |
5501 |
18 Nov 10 |
nicklas |
381 |
|
5501 |
18 Nov 10 |
nicklas |
382 |
// Annotations tab |
5501 |
18 Nov 10 |
nicklas |
383 |
Base.updateAnnotations(dc, rba, rba, request); |
5501 |
18 Nov 10 |
nicklas |
384 |
|
5501 |
18 Nov 10 |
nicklas |
385 |
// OnSave extensions |
5501 |
18 Nov 10 |
nicklas |
386 |
invoker.render(OnSaveRenderer.ON_SAVE); |
5501 |
18 Nov 10 |
nicklas |
387 |
dc.commit(); |
5501 |
18 Nov 10 |
nicklas |
388 |
invoker.render(OnSaveRenderer.ON_COMMIT); |
5501 |
18 Nov 10 |
nicklas |
389 |
if (job != null) |
3523 |
20 Jun 07 |
nicklas |
390 |
{ |
5501 |
18 Nov 10 |
nicklas |
391 |
redirect = "../jobs/index.jsp?ID="+ID+"&cmd=ViewItem&item_id="+job.getId(); |
5501 |
18 Nov 10 |
nicklas |
392 |
Thread updateThread = new Thread(new UpdateArrayDesign(job, rba, ad, fiMethod)); |
5501 |
18 Nov 10 |
nicklas |
393 |
updateThread.setPriority(Thread.currentThread().getPriority() - 1); |
5501 |
18 Nov 10 |
nicklas |
394 |
updateThread.start(); |
3523 |
20 Jun 07 |
nicklas |
395 |
} |
1672 |
30 Nov 05 |
nicklas |
396 |
} |
5501 |
18 Nov 10 |
nicklas |
397 |
catch (Exception ex) |
3523 |
20 Jun 07 |
nicklas |
398 |
{ |
5501 |
18 Nov 10 |
nicklas |
399 |
invoker.render(OnSaveRenderer.onRollback(ex)); |
5501 |
18 Nov 10 |
nicklas |
400 |
throw ex; |
3523 |
20 Jun 07 |
nicklas |
401 |
} |
5501 |
18 Nov 10 |
nicklas |
402 |
finally |
5501 |
18 Nov 10 |
nicklas |
403 |
{ |
5501 |
18 Nov 10 |
nicklas |
404 |
cc.removeObject("item"); |
5501 |
18 Nov 10 |
nicklas |
405 |
} |
1713 |
14 Dec 05 |
nicklas |
406 |
} |
1765 |
13 Jan 06 |
nicklas |
407 |
else if ("DeleteItem".equals(cmd)) |
1713 |
14 Dec 05 |
nicklas |
408 |
{ |
1765 |
13 Jan 06 |
nicklas |
409 |
// Delete a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
410 |
dc = sc.newDbControl(":Delete "+itemType); |
1765 |
13 Jan 06 |
nicklas |
411 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1765 |
13 Jan 06 |
nicklas |
412 |
RemovableUtil.setRemoved(dc, itemType, Collections.singleton(cc.getId()), true); |
1765 |
13 Jan 06 |
nicklas |
413 |
dc.commit(); |
1765 |
13 Jan 06 |
nicklas |
414 |
redirect = viewPage; |
1765 |
13 Jan 06 |
nicklas |
415 |
} |
1765 |
13 Jan 06 |
nicklas |
416 |
else if ("DeleteItems".equals(cmd)) |
1765 |
13 Jan 06 |
nicklas |
417 |
{ |
1765 |
13 Jan 06 |
nicklas |
418 |
// Delete all selected items on the list page |
7954 |
12 May 21 |
nicklas |
419 |
dc = sc.newDbControl(":Delete "+itemType); |
1765 |
13 Jan 06 |
nicklas |
420 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1765 |
13 Jan 06 |
nicklas |
421 |
int numTotal = cc.getSelected().size(); |
1765 |
13 Jan 06 |
nicklas |
422 |
int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), true); |
1765 |
13 Jan 06 |
nicklas |
423 |
dc.commit(); |
1765 |
13 Jan 06 |
nicklas |
424 |
if (numTotal != numRemoved) |
1765 |
13 Jan 06 |
nicklas |
425 |
{ |
1765 |
13 Jan 06 |
nicklas |
426 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission"; |
1765 |
13 Jan 06 |
nicklas |
427 |
} |
6192 |
31 Oct 12 |
nicklas |
428 |
redirect = listPage; |
1765 |
13 Jan 06 |
nicklas |
429 |
} |
1765 |
13 Jan 06 |
nicklas |
430 |
else if ("RestoreItem".equals(cmd)) |
1765 |
13 Jan 06 |
nicklas |
431 |
{ |
1765 |
13 Jan 06 |
nicklas |
432 |
// Restore a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
433 |
dc = sc.newDbControl(":Restore "+itemType); |
1765 |
13 Jan 06 |
nicklas |
434 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1765 |
13 Jan 06 |
nicklas |
435 |
RemovableUtil.setRemoved(dc, itemType, Collections.singleton(cc.getId()), false); |
1765 |
13 Jan 06 |
nicklas |
436 |
dc.commit(); |
1765 |
13 Jan 06 |
nicklas |
437 |
redirect = viewPage; |
1765 |
13 Jan 06 |
nicklas |
438 |
} |
1765 |
13 Jan 06 |
nicklas |
439 |
else if ("RestoreItems".equals(cmd)) |
1765 |
13 Jan 06 |
nicklas |
440 |
{ |
1765 |
13 Jan 06 |
nicklas |
441 |
// Restore all selected items on the list page |
7954 |
12 May 21 |
nicklas |
442 |
dc = sc.newDbControl(":Restore "+itemType); |
1765 |
13 Jan 06 |
nicklas |
443 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1765 |
13 Jan 06 |
nicklas |
444 |
int numTotal = cc.getSelected().size(); |
1765 |
13 Jan 06 |
nicklas |
445 |
int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), false); |
1765 |
13 Jan 06 |
nicklas |
446 |
dc.commit(); |
1765 |
13 Jan 06 |
nicklas |
447 |
if (numTotal != numRemoved) |
1765 |
13 Jan 06 |
nicklas |
448 |
{ |
2528 |
15 Aug 06 |
martin |
449 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be restored, because you have no WRITE permission"; |
1765 |
13 Jan 06 |
nicklas |
450 |
} |
6192 |
31 Oct 12 |
nicklas |
451 |
redirect = listPage; |
1765 |
13 Jan 06 |
nicklas |
452 |
} |
1765 |
13 Jan 06 |
nicklas |
453 |
else if ("ShareItem".equals(cmd)) |
1765 |
13 Jan 06 |
nicklas |
454 |
{ |
1765 |
13 Jan 06 |
nicklas |
455 |
// Display a popup window for sharing a single item |
7954 |
12 May 21 |
nicklas |
456 |
dc = sc.newDbControl(":Share "+itemType); |
1765 |
13 Jan 06 |
nicklas |
457 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1765 |
13 Jan 06 |
nicklas |
458 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, Collections.singleton(cc.getId())); |
1765 |
13 Jan 06 |
nicklas |
459 |
dc.close(); |
1765 |
13 Jan 06 |
nicklas |
460 |
cc.setObject("MultiPermissions", permissions); |
1765 |
13 Jan 06 |
nicklas |
461 |
redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); |
1765 |
13 Jan 06 |
nicklas |
462 |
} |
1765 |
13 Jan 06 |
nicklas |
463 |
else if ("ShareItems".equals(cmd)) |
1765 |
13 Jan 06 |
nicklas |
464 |
{ |
1765 |
13 Jan 06 |
nicklas |
465 |
// Display a popup window for sharing all selected items on the list page |
7954 |
12 May 21 |
nicklas |
466 |
dc = sc.newDbControl(":Share "+itemType); |
1765 |
13 Jan 06 |
nicklas |
467 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1765 |
13 Jan 06 |
nicklas |
468 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, cc.getSelected()); |
1765 |
13 Jan 06 |
nicklas |
469 |
dc.close(); |
1765 |
13 Jan 06 |
nicklas |
470 |
cc.setObject("MultiPermissions", permissions); |
1765 |
13 Jan 06 |
nicklas |
471 |
redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); |
1765 |
13 Jan 06 |
nicklas |
472 |
} |
4573 |
10 Oct 08 |
martin |
473 |
else if ("SetOwnerOfItem".equals(cmd)) |
2918 |
15 Nov 06 |
nicklas |
474 |
{ |
4573 |
10 Oct 08 |
martin |
475 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
476 |
dc = sc.newDbControl(":Set owner of "+itemType); |
2918 |
15 Nov 06 |
nicklas |
477 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4587 |
15 Oct 08 |
martin |
478 |
OwnedItem item = (OwnedItem)itemType.getById(dc, cc.getId()); |
4587 |
15 Oct 08 |
martin |
479 |
cc.setObject("OwnedItems", Collections.singleton(item)); |
4573 |
10 Oct 08 |
martin |
480 |
redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name(); |
2918 |
15 Nov 06 |
nicklas |
481 |
} |
4573 |
10 Oct 08 |
martin |
482 |
else if ("SetOwnerOfItems".equals(cmd)) |
2918 |
15 Nov 06 |
nicklas |
483 |
{ |
4573 |
10 Oct 08 |
martin |
484 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
485 |
dc = sc.newDbControl(":Set owner of "+itemType); |
2918 |
15 Nov 06 |
nicklas |
486 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4587 |
15 Oct 08 |
martin |
487 |
Set<OwnedItem> items = new HashSet<OwnedItem>(); |
4587 |
15 Oct 08 |
martin |
488 |
for (Integer id : cc.getSelected()) |
4587 |
15 Oct 08 |
martin |
489 |
{ |
4587 |
15 Oct 08 |
martin |
490 |
if (id != null) items.add((OwnedItem)itemType.getById(dc, id)); |
4587 |
15 Oct 08 |
martin |
491 |
} |
4587 |
15 Oct 08 |
martin |
492 |
dc.close(); |
4587 |
15 Oct 08 |
martin |
493 |
cc.setObject("OwnedItems", items); |
4573 |
10 Oct 08 |
martin |
494 |
redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name(); |
2918 |
15 Nov 06 |
nicklas |
495 |
} |
6694 |
26 Jan 15 |
nicklas |
496 |
else if ("InheritAnnotations".equals(cmd)) |
6694 |
26 Jan 15 |
nicklas |
497 |
{ |
6694 |
26 Jan 15 |
nicklas |
498 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
499 |
dc = sc.newDbControl(":Inherit annotations "+itemType); |
6694 |
26 Jan 15 |
nicklas |
500 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
6694 |
26 Jan 15 |
nicklas |
501 |
Set<AnnotatedItem> items = new HashSet<AnnotatedItem>(); |
6694 |
26 Jan 15 |
nicklas |
502 |
for (Integer id : cc.getSelected()) |
6694 |
26 Jan 15 |
nicklas |
503 |
{ |
6694 |
26 Jan 15 |
nicklas |
504 |
if (id != null) items.add((AnnotatedItem)itemType.getById(dc, id)); |
6694 |
26 Jan 15 |
nicklas |
505 |
} |
6694 |
26 Jan 15 |
nicklas |
506 |
dc.close(); |
6694 |
26 Jan 15 |
nicklas |
507 |
cc.setObject("AnnotatedItems", items); |
6694 |
26 Jan 15 |
nicklas |
508 |
redirect = "../../common/annotations/batch_inherit.jsp?ID="+ID+"&item_type="+itemType.name(); |
6694 |
26 Jan 15 |
nicklas |
509 |
} |
1765 |
13 Jan 06 |
nicklas |
510 |
else if ("ExportItems".equals(cmd)) |
1765 |
13 Jan 06 |
nicklas |
511 |
{ |
1765 |
13 Jan 06 |
nicklas |
512 |
// Run an export plugin in a list context |
1765 |
13 Jan 06 |
nicklas |
513 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1713 |
14 Dec 05 |
nicklas |
514 |
final ItemQuery<RawBioAssay> query = RawBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
515 |
dc = sc.newDbControl(":Export "+itemType); |
7903 |
25 Jan 21 |
nicklas |
516 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
6030 |
28 Mar 12 |
nicklas |
517 |
cc.setQuery(query); |
7903 |
25 Jan 21 |
nicklas |
518 |
cc.configureQuery(dc, query, jspContext, true); |
6030 |
28 Mar 12 |
nicklas |
519 |
registerExportUtils(cc); |
7604 |
25 Feb 19 |
nicklas |
520 |
ExtensionsInvoker<ListColumnAction<RawBioAssay,?>> listInvoker = ListColumnUtil.useExtensions(jspContext); |
7604 |
25 Feb 19 |
nicklas |
521 |
listInvoker.render(new ListColumnExportRenderer<RawBioAssay>(cc)); |
5590 |
16 Mar 11 |
nicklas |
522 |
dc.close(); |
1765 |
13 Jan 06 |
nicklas |
523 |
redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+raw+bioassays"; |
1713 |
14 Dec 05 |
nicklas |
524 |
} |
1765 |
13 Jan 06 |
nicklas |
525 |
else if ("ExportItem".equals(cmd)) |
1765 |
13 Jan 06 |
nicklas |
526 |
{ |
1765 |
13 Jan 06 |
nicklas |
527 |
// Run an export plugin in single-item context |
1765 |
13 Jan 06 |
nicklas |
528 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4901 |
23 Apr 09 |
martin |
529 |
registerExportUtils(cc); |
1765 |
13 Jan 06 |
nicklas |
530 |
redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+raw+bioassay"; |
1765 |
13 Jan 06 |
nicklas |
531 |
} |
1765 |
13 Jan 06 |
nicklas |
532 |
else if ("ImportItems".equals(cmd)) |
1765 |
13 Jan 06 |
nicklas |
533 |
{ |
1765 |
13 Jan 06 |
nicklas |
534 |
// Run an import plugin in a list context |
1765 |
13 Jan 06 |
nicklas |
535 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1765 |
13 Jan 06 |
nicklas |
536 |
final ItemQuery<RawBioAssay> query = RawBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
537 |
dc = sc.newDbControl(":Import "+itemType); |
7903 |
25 Jan 21 |
nicklas |
538 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7903 |
25 Jan 21 |
nicklas |
539 |
cc.configureQuery(dc, query, jspContext, true); |
5590 |
16 Mar 11 |
nicklas |
540 |
dc.close(); |
1765 |
13 Jan 06 |
nicklas |
541 |
cc.setQuery(query); |
1765 |
13 Jan 06 |
nicklas |
542 |
redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Import+raw+bioassays"; |
1765 |
13 Jan 06 |
nicklas |
543 |
} |
1765 |
13 Jan 06 |
nicklas |
544 |
else if ("ImportItem".equals(cmd)) |
1765 |
13 Jan 06 |
nicklas |
545 |
{ |
1765 |
13 Jan 06 |
nicklas |
546 |
// Run an import plugin in single-item context |
1765 |
13 Jan 06 |
nicklas |
547 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1765 |
13 Jan 06 |
nicklas |
548 |
redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Import+raw+bioassay"; |
1765 |
13 Jan 06 |
nicklas |
549 |
} |
1765 |
13 Jan 06 |
nicklas |
550 |
else if ("RunListPlugin".equals(cmd)) |
1765 |
13 Jan 06 |
nicklas |
551 |
{ |
1765 |
13 Jan 06 |
nicklas |
552 |
// Run another plugin in a list context |
1765 |
13 Jan 06 |
nicklas |
553 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1765 |
13 Jan 06 |
nicklas |
554 |
final ItemQuery<RawBioAssay> query = RawBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
555 |
dc = sc.newDbControl(":Run plugin "+itemType); |
7903 |
25 Jan 21 |
nicklas |
556 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7903 |
25 Jan 21 |
nicklas |
557 |
cc.configureQuery(dc, query, jspContext, true); |
5590 |
16 Mar 11 |
nicklas |
558 |
dc.close(); |
1765 |
13 Jan 06 |
nicklas |
559 |
cc.setQuery(query); |
1787 |
18 Jan 06 |
nicklas |
560 |
redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&main_type=OTHER&title=Run+plugin"; |
1765 |
13 Jan 06 |
nicklas |
561 |
} |
1765 |
13 Jan 06 |
nicklas |
562 |
else if ("RunPlugin".equals(cmd)) |
1765 |
13 Jan 06 |
nicklas |
563 |
{ |
1765 |
13 Jan 06 |
nicklas |
564 |
// Run another plugin in single-item context |
1765 |
13 Jan 06 |
nicklas |
565 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
1787 |
18 Jan 06 |
nicklas |
566 |
redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=OTHER&title=Run+plugin"; |
1765 |
13 Jan 06 |
nicklas |
567 |
} |
6311 |
23 Aug 13 |
nicklas |
568 |
else if ("NewExperiment".equals(cmd)) |
6311 |
23 Aug 13 |
nicklas |
569 |
{ |
6311 |
23 Aug 13 |
nicklas |
570 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
6311 |
23 Aug 13 |
nicklas |
571 |
redirect = "../experiments/index.jsp?ID="+ID+"&cmd=NewItem&rawbioassays=1"; |
6311 |
23 Aug 13 |
nicklas |
572 |
} |
6813 |
31 Mar 15 |
nicklas |
573 |
else if ("CreateItemList".equals(cmd)) |
6813 |
31 Mar 15 |
nicklas |
574 |
{ |
6813 |
31 Mar 15 |
nicklas |
575 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
6813 |
31 Mar 15 |
nicklas |
576 |
final ItemQuery<RawBioAssay> query = RawBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
577 |
dc = sc.newDbControl(":Create "+itemType+" item list"); |
7914 |
23 Feb 21 |
nicklas |
578 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
579 |
cc.configureQuery(dc, query, jspContext, true); |
6813 |
31 Mar 15 |
nicklas |
580 |
dc.close(); |
6813 |
31 Mar 15 |
nicklas |
581 |
cc.setQuery(query); |
6813 |
31 Mar 15 |
nicklas |
582 |
redirect = "../../views/itemlists/index.jsp?ID="+ID+"&cmd=NewItem&addItems=1&memberType=RAWBIOASSAY&formId=rawbioassays"; |
6813 |
31 Mar 15 |
nicklas |
583 |
} |
7813 |
19 May 20 |
nicklas |
584 |
else if ("AddItemsToList".equals(cmd)) |
7813 |
19 May 20 |
nicklas |
585 |
{ |
7813 |
19 May 20 |
nicklas |
586 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
7813 |
19 May 20 |
nicklas |
587 |
final ItemQuery<RawBioAssay> query = RawBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
588 |
dc = sc.newDbControl(":Add items to "+itemType+" item list"); |
7914 |
23 Feb 21 |
nicklas |
589 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
590 |
cc.configureQuery(dc, query, jspContext, true); |
7813 |
19 May 20 |
nicklas |
591 |
dc.close(); |
7813 |
19 May 20 |
nicklas |
592 |
cc.setQuery(query); |
7813 |
19 May 20 |
nicklas |
593 |
redirect = "../../views/itemlists/add_items.jsp?ID="+ID+"&memberType=RAWBIOASSAY&formId=rawbioassays"; |
7813 |
19 May 20 |
nicklas |
594 |
} |
1765 |
13 Jan 06 |
nicklas |
595 |
else |
1765 |
13 Jan 06 |
nicklas |
596 |
{ |
1765 |
13 Jan 06 |
nicklas |
597 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
1765 |
13 Jan 06 |
nicklas |
598 |
} |
1765 |
13 Jan 06 |
nicklas |
599 |
|
1672 |
30 Nov 05 |
nicklas |
600 |
} |
1672 |
30 Nov 05 |
nicklas |
601 |
finally |
1672 |
30 Nov 05 |
nicklas |
602 |
{ |
1672 |
30 Nov 05 |
nicklas |
603 |
if (dc != null) dc.close(); |
1672 |
30 Nov 05 |
nicklas |
604 |
} |
1713 |
14 Dec 05 |
nicklas |
605 |
|
1713 |
14 Dec 05 |
nicklas |
606 |
if (forward != null) |
1713 |
14 Dec 05 |
nicklas |
607 |
{ |
6192 |
31 Oct 12 |
nicklas |
608 |
sc.setSessionSetting("alert-message", message); |
1713 |
14 Dec 05 |
nicklas |
609 |
pageContext.forward(forward); |
1713 |
14 Dec 05 |
nicklas |
610 |
} |
1713 |
14 Dec 05 |
nicklas |
611 |
else if (redirect != null) |
1713 |
14 Dec 05 |
nicklas |
612 |
{ |
6192 |
31 Oct 12 |
nicklas |
613 |
sc.setSessionSetting("alert-message", message); |
1713 |
14 Dec 05 |
nicklas |
614 |
response.sendRedirect(redirect); |
1713 |
14 Dec 05 |
nicklas |
615 |
} |
1713 |
14 Dec 05 |
nicklas |
616 |
else if (message == null) |
1713 |
14 Dec 05 |
nicklas |
617 |
{ |
1713 |
14 Dec 05 |
nicklas |
618 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
1713 |
14 Dec 05 |
nicklas |
619 |
} |
1713 |
14 Dec 05 |
nicklas |
620 |
else |
1713 |
14 Dec 05 |
nicklas |
621 |
{ |
1713 |
14 Dec 05 |
nicklas |
622 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
1713 |
14 Dec 05 |
nicklas |
623 |
} |
1713 |
14 Dec 05 |
nicklas |
624 |
%> |
1713 |
14 Dec 05 |
nicklas |
625 |
|