4910 |
29 Apr 09 |
nicklas |
1 |
|
4910 |
29 Apr 09 |
nicklas |
2 |
<%@page import="net.sf.basedb.core.IntensityTransform"%><%-- $Id$ |
2097 |
21 Mar 06 |
nicklas |
3 |
------------------------------------------------------------------ |
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 |
2097 |
21 Mar 06 |
nicklas |
6 |
|
2200 |
27 Apr 06 |
jari |
7 |
This file is part of BASE - BioArray Software Environment. |
2200 |
27 Apr 06 |
jari |
8 |
Available at http://base.thep.lu.se/ |
2200 |
27 Apr 06 |
jari |
9 |
|
2097 |
21 Mar 06 |
nicklas |
10 |
This file is part of BASE. |
2097 |
21 Mar 06 |
nicklas |
11 |
|
2097 |
21 Mar 06 |
nicklas |
12 |
BASE is free software; you can redistribute it and/or |
2097 |
21 Mar 06 |
nicklas |
13 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
14 |
as published by the Free Software Foundation; either version 3 |
2097 |
21 Mar 06 |
nicklas |
15 |
of the License, or (at your option) any later version. |
2097 |
21 Mar 06 |
nicklas |
16 |
|
2097 |
21 Mar 06 |
nicklas |
17 |
BASE is distributed in the hope that it will be useful, |
2097 |
21 Mar 06 |
nicklas |
18 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2097 |
21 Mar 06 |
nicklas |
19 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2097 |
21 Mar 06 |
nicklas |
20 |
GNU General Public License for more details. |
2097 |
21 Mar 06 |
nicklas |
21 |
|
2097 |
21 Mar 06 |
nicklas |
22 |
You should have received a copy of the GNU General Public License |
4511 |
11 Sep 08 |
jari |
23 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
2097 |
21 Mar 06 |
nicklas |
24 |
------------------------------------------------------------------ |
2097 |
21 Mar 06 |
nicklas |
25 |
|
2097 |
21 Mar 06 |
nicklas |
26 |
@author Nicklas |
2097 |
21 Mar 06 |
nicklas |
27 |
@version 2.0 |
2097 |
21 Mar 06 |
nicklas |
28 |
--%> |
5426 |
24 Sep 10 |
nicklas |
29 |
<%@ page pageEncoding="UTF-8" session="false" |
2097 |
21 Mar 06 |
nicklas |
30 |
import="net.sf.basedb.core.SessionControl" |
2097 |
21 Mar 06 |
nicklas |
31 |
import="net.sf.basedb.core.DbControl" |
2097 |
21 Mar 06 |
nicklas |
32 |
import="net.sf.basedb.core.Item" |
2097 |
21 Mar 06 |
nicklas |
33 |
import="net.sf.basedb.core.Include" |
2097 |
21 Mar 06 |
nicklas |
34 |
import="net.sf.basedb.core.Experiment" |
2097 |
21 Mar 06 |
nicklas |
35 |
import="net.sf.basedb.core.BioAssaySet" |
2097 |
21 Mar 06 |
nicklas |
36 |
import="net.sf.basedb.core.Job" |
2097 |
21 Mar 06 |
nicklas |
37 |
import="net.sf.basedb.core.RawBioAssay" |
2097 |
21 Mar 06 |
nicklas |
38 |
import="net.sf.basedb.core.StringParameterType" |
2097 |
21 Mar 06 |
nicklas |
39 |
import="net.sf.basedb.core.IntegerParameterType" |
2097 |
21 Mar 06 |
nicklas |
40 |
import="net.sf.basedb.core.ItemParameterType" |
2097 |
21 Mar 06 |
nicklas |
41 |
import="net.sf.basedb.core.User" |
2097 |
21 Mar 06 |
nicklas |
42 |
import="net.sf.basedb.core.Path" |
2097 |
21 Mar 06 |
nicklas |
43 |
import="net.sf.basedb.core.ItemQuery" |
2097 |
21 Mar 06 |
nicklas |
44 |
import="net.sf.basedb.core.ItemResultIterator" |
2097 |
21 Mar 06 |
nicklas |
45 |
import="net.sf.basedb.core.Permission" |
2097 |
21 Mar 06 |
nicklas |
46 |
import="net.sf.basedb.core.PluginDefinition" |
2097 |
21 Mar 06 |
nicklas |
47 |
import="net.sf.basedb.core.ItemContext" |
2097 |
21 Mar 06 |
nicklas |
48 |
import="net.sf.basedb.core.MultiPermissions" |
2097 |
21 Mar 06 |
nicklas |
49 |
import="net.sf.basedb.core.PermissionDeniedException" |
2097 |
21 Mar 06 |
nicklas |
50 |
import="net.sf.basedb.core.ItemAlreadyExistsException" |
2183 |
24 Apr 06 |
nicklas |
51 |
import="net.sf.basedb.core.query.Restriction" |
2097 |
21 Mar 06 |
nicklas |
52 |
import="net.sf.basedb.util.RemovableUtil" |
2097 |
21 Mar 06 |
nicklas |
53 |
import="net.sf.basedb.util.ShareableUtil" |
2669 |
27 Sep 06 |
nicklas |
54 |
import="net.sf.basedb.util.BioAssaySetUtil" |
2183 |
24 Apr 06 |
nicklas |
55 |
import="net.sf.basedb.util.DynamicFilter" |
2183 |
24 Apr 06 |
nicklas |
56 |
import="net.sf.basedb.util.IncludeExcludeFilter" |
2097 |
21 Mar 06 |
nicklas |
57 |
import="net.sf.basedb.clients.web.Base" |
2097 |
21 Mar 06 |
nicklas |
58 |
import="net.sf.basedb.clients.web.WebException" |
2753 |
20 Oct 06 |
nicklas |
59 |
import="net.sf.basedb.util.Values" |
2097 |
21 Mar 06 |
nicklas |
60 |
import="net.sf.basedb.clients.web.util.HTML" |
5503 |
18 Nov 10 |
nicklas |
61 |
import="net.sf.basedb.core.plugin.GuiContext" |
5503 |
18 Nov 10 |
nicklas |
62 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
5503 |
18 Nov 10 |
nicklas |
63 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5503 |
18 Nov 10 |
nicklas |
64 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5503 |
18 Nov 10 |
nicklas |
65 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
66 |
import="net.sf.basedb.clients.web.extensions.edit.OnSaveAction" |
5503 |
18 Nov 10 |
nicklas |
67 |
import="net.sf.basedb.clients.web.extensions.edit.OnSaveRenderer" |
6040 |
30 Mar 12 |
nicklas |
68 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnExportRenderer" |
7604 |
25 Feb 19 |
nicklas |
69 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnAction" |
6040 |
30 Mar 12 |
nicklas |
70 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
2097 |
21 Mar 06 |
nicklas |
71 |
import="java.util.Enumeration" |
2097 |
21 Mar 06 |
nicklas |
72 |
import="java.util.Set" |
2097 |
21 Mar 06 |
nicklas |
73 |
import="java.util.HashSet" |
2097 |
21 Mar 06 |
nicklas |
74 |
import="java.util.List" |
2097 |
21 Mar 06 |
nicklas |
75 |
import="java.util.LinkedList" |
2097 |
21 Mar 06 |
nicklas |
76 |
import="java.util.Collections" |
2097 |
21 Mar 06 |
nicklas |
77 |
import="java.util.Arrays" |
2097 |
21 Mar 06 |
nicklas |
78 |
%> |
2097 |
21 Mar 06 |
nicklas |
79 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
2097 |
21 Mar 06 |
nicklas |
80 |
<%! |
2993 |
01 Dec 06 |
nicklas |
81 |
private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,spots,reporters,date,tools"); |
2097 |
21 Mar 06 |
nicklas |
82 |
private static final Item itemType = Item.BIOASSAYSET; |
2210 |
03 May 06 |
nicklas |
83 |
|
2210 |
03 May 06 |
nicklas |
84 |
|
2210 |
03 May 06 |
nicklas |
85 |
private void setClosed(HttpServletRequest request, ItemContext cc) |
2210 |
03 May 06 |
nicklas |
86 |
{ |
2210 |
03 May 06 |
nicklas |
87 |
String closed = request.getParameter("closed"); |
4374 |
04 Jul 08 |
nicklas |
88 |
if (closed == null && cc.getSetting("closed") != null && cc.getObject("closed") == null) |
4374 |
04 Jul 08 |
nicklas |
89 |
{ |
7601 |
22 Feb 19 |
nicklas |
90 |
closed = cc.getSetting("closed"); |
4374 |
04 Jul 08 |
nicklas |
91 |
} |
2210 |
03 May 06 |
nicklas |
92 |
if (closed != null) |
2210 |
03 May 06 |
nicklas |
93 |
{ |
4374 |
04 Jul 08 |
nicklas |
94 |
cc.setSetting("closed", closed); |
2210 |
03 May 06 |
nicklas |
95 |
cc.setObject("closed", new HashSet<String>(Arrays.asList(closed.split(",")))); |
2210 |
03 May 06 |
nicklas |
96 |
} |
2210 |
03 May 06 |
nicklas |
97 |
} |
2097 |
21 Mar 06 |
nicklas |
98 |
%> |
2097 |
21 Mar 06 |
nicklas |
99 |
<% |
2097 |
21 Mar 06 |
nicklas |
100 |
final int experimentId = Values.getInt(request.getParameter("experiment_id")); |
2298 |
19 May 06 |
nicklas |
101 |
final String transformationId = request.getParameter("transformation_id"); |
2097 |
21 Mar 06 |
nicklas |
102 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
2097 |
21 Mar 06 |
nicklas |
103 |
final String ID = sc.getId(); |
2097 |
21 Mar 06 |
nicklas |
104 |
final String cmd = request.getParameter("cmd"); |
2097 |
21 Mar 06 |
nicklas |
105 |
final String root = request.getContextPath()+"/"; |
2097 |
21 Mar 06 |
nicklas |
106 |
final String mode = request.getParameter("mode"); |
2097 |
21 Mar 06 |
nicklas |
107 |
final String callback = request.getParameter("callback"); |
2097 |
21 Mar 06 |
nicklas |
108 |
final String itemId = request.getParameter("item_id"); |
2097 |
21 Mar 06 |
nicklas |
109 |
final String listPage = "list_bioassaysets.jsp?ID="+ID+"&experiment_id="+experimentId |
2097 |
21 Mar 06 |
nicklas |
110 |
+(mode == null ? "" : "&mode="+mode) |
2097 |
21 Mar 06 |
nicklas |
111 |
+(callback == null ? "" : "&callback="+callback) |
2097 |
21 Mar 06 |
nicklas |
112 |
+(itemId == null ? "" : "&item_id="+itemId); |
2097 |
21 Mar 06 |
nicklas |
113 |
final String viewPage = "view_bioassayset.jsp?ID="+ID+"&experiment_id="+experimentId; |
2097 |
21 Mar 06 |
nicklas |
114 |
final String editPage = "edit_bioassayset.jsp?ID="+ID+"&experiment_id="+experimentId; |
2298 |
19 May 06 |
nicklas |
115 |
final String viewTransformationPage = "../transformations/view_transformation.jsp?ID="+ID+ |
2298 |
19 May 06 |
nicklas |
116 |
"&experiment_id="+experimentId; |
2126 |
29 Mar 06 |
nicklas |
117 |
final String newPage = "../../../common/plugin/index.jsp?ID="+ID |
2126 |
29 Mar 06 |
nicklas |
118 |
+"&cmd=SelectPlugin&main_type=INTENSITY&item_type=BIOASSAYSET&context_type=LIST&title=Create+root+bioassay+set"; |
2126 |
29 Mar 06 |
nicklas |
119 |
|
2907 |
14 Nov 06 |
nicklas |
120 |
if (experimentId != 0) sc.getCurrentContext(Item.EXPERIMENT).setId(experimentId); |
2097 |
21 Mar 06 |
nicklas |
121 |
|
2097 |
21 Mar 06 |
nicklas |
122 |
String forward = null; |
2097 |
21 Mar 06 |
nicklas |
123 |
String redirect = null; |
2097 |
21 Mar 06 |
nicklas |
124 |
String message = null; |
2097 |
21 Mar 06 |
nicklas |
125 |
DbControl dc = null; |
2097 |
21 Mar 06 |
nicklas |
126 |
|
2097 |
21 Mar 06 |
nicklas |
127 |
try |
2097 |
21 Mar 06 |
nicklas |
128 |
{ |
2097 |
21 Mar 06 |
nicklas |
129 |
if (cmd == null || "List".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
130 |
{ |
2097 |
21 Mar 06 |
nicklas |
131 |
// Display the list page without updatinging the current context |
2811 |
26 Oct 06 |
nicklas |
132 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext, true); |
4374 |
04 Jul 08 |
nicklas |
133 |
setClosed(request, cc); |
2298 |
19 May 06 |
nicklas |
134 |
if (transformationId != null) |
2298 |
19 May 06 |
nicklas |
135 |
{ |
2298 |
19 May 06 |
nicklas |
136 |
forward = viewTransformationPage; |
2298 |
19 May 06 |
nicklas |
137 |
} |
2298 |
19 May 06 |
nicklas |
138 |
else if (itemId != null) |
2298 |
19 May 06 |
nicklas |
139 |
{ |
2298 |
19 May 06 |
nicklas |
140 |
forward = viewPage; |
2298 |
19 May 06 |
nicklas |
141 |
} |
2298 |
19 May 06 |
nicklas |
142 |
else |
2298 |
19 May 06 |
nicklas |
143 |
{ |
2298 |
19 May 06 |
nicklas |
144 |
redirect = listPage; |
2298 |
19 May 06 |
nicklas |
145 |
} |
2097 |
21 Mar 06 |
nicklas |
146 |
} |
2097 |
21 Mar 06 |
nicklas |
147 |
else if ("UpdateContext".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
148 |
{ |
2097 |
21 Mar 06 |
nicklas |
149 |
// Display the list page after updating the current context from the request parameters |
2097 |
21 Mar 06 |
nicklas |
150 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2210 |
03 May 06 |
nicklas |
151 |
setClosed(request, cc); |
2298 |
19 May 06 |
nicklas |
152 |
if (transformationId != null) |
2298 |
19 May 06 |
nicklas |
153 |
{ |
2298 |
19 May 06 |
nicklas |
154 |
forward = viewTransformationPage; |
2298 |
19 May 06 |
nicklas |
155 |
} |
2298 |
19 May 06 |
nicklas |
156 |
else if (itemId != null) |
2298 |
19 May 06 |
nicklas |
157 |
{ |
2298 |
19 May 06 |
nicklas |
158 |
forward = viewPage; |
2298 |
19 May 06 |
nicklas |
159 |
} |
2298 |
19 May 06 |
nicklas |
160 |
else |
2298 |
19 May 06 |
nicklas |
161 |
{ |
2298 |
19 May 06 |
nicklas |
162 |
redirect = listPage; |
2298 |
19 May 06 |
nicklas |
163 |
} |
2097 |
21 Mar 06 |
nicklas |
164 |
} |
2097 |
21 Mar 06 |
nicklas |
165 |
else if ("LoadContext".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
166 |
{ |
2097 |
21 Mar 06 |
nicklas |
167 |
// Display the list page after loading a saved context |
2097 |
21 Mar 06 |
nicklas |
168 |
int contextId = Values.getInt(request.getParameter("context")); |
2097 |
21 Mar 06 |
nicklas |
169 |
Base.loadContext(sc, contextId, defaultContext); |
2298 |
19 May 06 |
nicklas |
170 |
if (transformationId != null) |
2298 |
19 May 06 |
nicklas |
171 |
{ |
2298 |
19 May 06 |
nicklas |
172 |
forward = viewTransformationPage; |
2298 |
19 May 06 |
nicklas |
173 |
} |
2298 |
19 May 06 |
nicklas |
174 |
else if (itemId != null) |
2298 |
19 May 06 |
nicklas |
175 |
{ |
2298 |
19 May 06 |
nicklas |
176 |
forward = viewPage; |
2298 |
19 May 06 |
nicklas |
177 |
} |
2298 |
19 May 06 |
nicklas |
178 |
else |
2298 |
19 May 06 |
nicklas |
179 |
{ |
2298 |
19 May 06 |
nicklas |
180 |
redirect = listPage; |
2298 |
19 May 06 |
nicklas |
181 |
} |
2097 |
21 Mar 06 |
nicklas |
182 |
} |
2097 |
21 Mar 06 |
nicklas |
183 |
|
2097 |
21 Mar 06 |
nicklas |
184 |
else if ("ViewItem".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
185 |
{ |
2097 |
21 Mar 06 |
nicklas |
186 |
// Display the view page for a single item |
2097 |
21 Mar 06 |
nicklas |
187 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2097 |
21 Mar 06 |
nicklas |
188 |
forward = viewPage; |
2097 |
21 Mar 06 |
nicklas |
189 |
} |
2097 |
21 Mar 06 |
nicklas |
190 |
else if ("EditItem".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
191 |
{ |
2097 |
21 Mar 06 |
nicklas |
192 |
// Display the edit page for a single item (should be opened in a popup) |
2097 |
21 Mar 06 |
nicklas |
193 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2097 |
21 Mar 06 |
nicklas |
194 |
redirect = editPage; |
2097 |
21 Mar 06 |
nicklas |
195 |
} |
2097 |
21 Mar 06 |
nicklas |
196 |
else if ("NewItem".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
197 |
{ |
2097 |
21 Mar 06 |
nicklas |
198 |
// Display the edit page for a new item (should be opened in a popup) |
2097 |
21 Mar 06 |
nicklas |
199 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2097 |
21 Mar 06 |
nicklas |
200 |
cc.setId(0); |
2097 |
21 Mar 06 |
nicklas |
201 |
redirect = newPage; |
2097 |
21 Mar 06 |
nicklas |
202 |
} |
2097 |
21 Mar 06 |
nicklas |
203 |
else if ("UpdateItem".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
204 |
{ |
2097 |
21 Mar 06 |
nicklas |
205 |
// Update the properties on an item (will close the popup) |
2097 |
21 Mar 06 |
nicklas |
206 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext); |
2097 |
21 Mar 06 |
nicklas |
207 |
|
7605 |
26 Feb 19 |
nicklas |
208 |
BioAssaySet bas = cc.getObject("item"); |
2097 |
21 Mar 06 |
nicklas |
209 |
if (bas != null) |
2097 |
21 Mar 06 |
nicklas |
210 |
{ |
7954 |
12 May 21 |
nicklas |
211 |
dc = sc.newDbControl(":Edit "+itemType); |
5060 |
19 Aug 09 |
nicklas |
212 |
dc.reattachItem(bas, false); |
2097 |
21 Mar 06 |
nicklas |
213 |
message = "Bioassay set updated"; |
2892 |
10 Nov 06 |
nicklas |
214 |
|
5503 |
18 Nov 10 |
nicklas |
215 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(Item.BIOASSAYSET), bas); |
7604 |
25 Feb 19 |
nicklas |
216 |
ExtensionsInvoker<OnSaveAction> invoker = EditUtil.useOnSaveExtensions(jspContext); |
5503 |
18 Nov 10 |
nicklas |
217 |
try |
5503 |
18 Nov 10 |
nicklas |
218 |
{ |
5503 |
18 Nov 10 |
nicklas |
219 |
bas.setName(Values.getStringOrNull(request.getParameter("name"))); |
5503 |
18 Nov 10 |
nicklas |
220 |
bas.setDescription(Values.getStringOrNull(request.getParameter("description"))); |
5503 |
18 Nov 10 |
nicklas |
221 |
bas.setIntensityTransform(IntensityTransform.valueOf(request.getParameter("intensityTransform"))); |
5503 |
18 Nov 10 |
nicklas |
222 |
|
5503 |
18 Nov 10 |
nicklas |
223 |
// Annotations tab |
5503 |
18 Nov 10 |
nicklas |
224 |
Base.updateAnnotations(dc, bas, bas, request); |
5503 |
18 Nov 10 |
nicklas |
225 |
|
5503 |
18 Nov 10 |
nicklas |
226 |
// OnSave extensions |
5503 |
18 Nov 10 |
nicklas |
227 |
invoker.render(OnSaveRenderer.ON_SAVE); |
5503 |
18 Nov 10 |
nicklas |
228 |
dc.commit(); |
5503 |
18 Nov 10 |
nicklas |
229 |
invoker.render(OnSaveRenderer.ON_COMMIT); |
5503 |
18 Nov 10 |
nicklas |
230 |
} |
5503 |
18 Nov 10 |
nicklas |
231 |
catch (Exception ex) |
5503 |
18 Nov 10 |
nicklas |
232 |
{ |
5503 |
18 Nov 10 |
nicklas |
233 |
invoker.render(OnSaveRenderer.onRollback(ex)); |
5503 |
18 Nov 10 |
nicklas |
234 |
throw ex; |
5503 |
18 Nov 10 |
nicklas |
235 |
} |
5503 |
18 Nov 10 |
nicklas |
236 |
finally |
5503 |
18 Nov 10 |
nicklas |
237 |
{ |
5503 |
18 Nov 10 |
nicklas |
238 |
cc.removeObject("item"); |
5503 |
18 Nov 10 |
nicklas |
239 |
} |
2097 |
21 Mar 06 |
nicklas |
240 |
} |
2097 |
21 Mar 06 |
nicklas |
241 |
} |
2097 |
21 Mar 06 |
nicklas |
242 |
else if ("DeleteItem".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
243 |
{ |
2097 |
21 Mar 06 |
nicklas |
244 |
// Delete a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
245 |
dc = sc.newDbControl(":Delete "+itemType); |
2097 |
21 Mar 06 |
nicklas |
246 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2526 |
15 Aug 06 |
martin |
247 |
RemovableUtil.removeRecursively(dc, itemType, Collections.singleton(cc.getId()), true); |
2097 |
21 Mar 06 |
nicklas |
248 |
dc.commit(); |
2097 |
21 Mar 06 |
nicklas |
249 |
redirect = viewPage; |
2097 |
21 Mar 06 |
nicklas |
250 |
} |
2097 |
21 Mar 06 |
nicklas |
251 |
else if ("DeleteItems".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
252 |
{ |
2097 |
21 Mar 06 |
nicklas |
253 |
// Delete all selected items on the list page |
7954 |
12 May 21 |
nicklas |
254 |
dc = sc.newDbControl(":Delete "+itemType); |
2097 |
21 Mar 06 |
nicklas |
255 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2210 |
03 May 06 |
nicklas |
256 |
ItemContext tc = sc.getCurrentContext(Item.TRANSFORMATION); |
2664 |
26 Sep 06 |
nicklas |
257 |
ItemContext xc = sc.getCurrentContext(Item.EXTRAVALUE); |
2210 |
03 May 06 |
nicklas |
258 |
setClosed(request, cc); |
2210 |
03 May 06 |
nicklas |
259 |
|
2210 |
03 May 06 |
nicklas |
260 |
int numTotal = cc.getSelected().size()+tc.getSelected().size(); |
2526 |
15 Aug 06 |
martin |
261 |
int numRemoved = 0; |
2526 |
15 Aug 06 |
martin |
262 |
int[] numTransformationRemoved = RemovableUtil.removeRecursively(dc, Item.TRANSFORMATION, tc.getSelected(), true); |
2526 |
15 Aug 06 |
martin |
263 |
int[] numBioAssaySetRemoved = RemovableUtil.removeRecursively(dc, itemType, cc.getSelected(), true); |
2664 |
26 Sep 06 |
nicklas |
264 |
int numXV = RemovableUtil.delete(dc, Item.EXTRAVALUE, xc.getSelected()); |
2526 |
15 Aug 06 |
martin |
265 |
numTotal += numTransformationRemoved[1] + numBioAssaySetRemoved[1]; |
2526 |
15 Aug 06 |
martin |
266 |
numRemoved += numTransformationRemoved[0] + numBioAssaySetRemoved[0]; |
2664 |
26 Sep 06 |
nicklas |
267 |
|
2097 |
21 Mar 06 |
nicklas |
268 |
dc.commit(); |
2097 |
21 Mar 06 |
nicklas |
269 |
if (numTotal != numRemoved) |
2097 |
21 Mar 06 |
nicklas |
270 |
{ |
2097 |
21 Mar 06 |
nicklas |
271 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission"; |
2097 |
21 Mar 06 |
nicklas |
272 |
} |
2298 |
19 May 06 |
nicklas |
273 |
if (transformationId != null) |
2298 |
19 May 06 |
nicklas |
274 |
{ |
6192 |
31 Oct 12 |
nicklas |
275 |
forward = viewTransformationPage; |
2298 |
19 May 06 |
nicklas |
276 |
} |
2298 |
19 May 06 |
nicklas |
277 |
else if (itemId != null) |
2298 |
19 May 06 |
nicklas |
278 |
{ |
6192 |
31 Oct 12 |
nicklas |
279 |
forward = viewPage; |
2298 |
19 May 06 |
nicklas |
280 |
} |
2298 |
19 May 06 |
nicklas |
281 |
else |
2298 |
19 May 06 |
nicklas |
282 |
{ |
6192 |
31 Oct 12 |
nicklas |
283 |
redirect = listPage; |
2298 |
19 May 06 |
nicklas |
284 |
} |
2097 |
21 Mar 06 |
nicklas |
285 |
} |
2097 |
21 Mar 06 |
nicklas |
286 |
else if ("RestoreItem".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
287 |
{ |
2097 |
21 Mar 06 |
nicklas |
288 |
// Restore a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
289 |
dc = sc.newDbControl(":Restore "+itemType); |
2097 |
21 Mar 06 |
nicklas |
290 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2526 |
15 Aug 06 |
martin |
291 |
RemovableUtil.removeRecursively(dc, itemType, Collections.singleton(cc.getId()), false); |
2097 |
21 Mar 06 |
nicklas |
292 |
dc.commit(); |
2097 |
21 Mar 06 |
nicklas |
293 |
redirect = viewPage; |
2097 |
21 Mar 06 |
nicklas |
294 |
} |
2097 |
21 Mar 06 |
nicklas |
295 |
else if ("RestoreItems".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
296 |
{ |
2097 |
21 Mar 06 |
nicklas |
297 |
// Restore all selected items on the list page |
7954 |
12 May 21 |
nicklas |
298 |
dc = sc.newDbControl(":Restore "+itemType); |
2097 |
21 Mar 06 |
nicklas |
299 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2210 |
03 May 06 |
nicklas |
300 |
ItemContext tc = sc.getCurrentContext(Item.TRANSFORMATION); |
2210 |
03 May 06 |
nicklas |
301 |
setClosed(request, cc); |
2210 |
03 May 06 |
nicklas |
302 |
|
2210 |
03 May 06 |
nicklas |
303 |
int numTotal = cc.getSelected().size()+tc.getSelected().size(); |
2526 |
15 Aug 06 |
martin |
304 |
int numRemoved = 0; |
2526 |
15 Aug 06 |
martin |
305 |
int[] numTransformationRemoved = RemovableUtil.removeRecursively(dc, Item.TRANSFORMATION, tc.getSelected(), false); |
2526 |
15 Aug 06 |
martin |
306 |
int[] numBioAssaySetRemoved = RemovableUtil.removeRecursively(dc, itemType, cc.getSelected(), false); |
2526 |
15 Aug 06 |
martin |
307 |
numTotal += numTransformationRemoved[1] + numBioAssaySetRemoved[1]; |
2526 |
15 Aug 06 |
martin |
308 |
numRemoved += numTransformationRemoved[0] + numBioAssaySetRemoved[0]; |
2526 |
15 Aug 06 |
martin |
309 |
|
2097 |
21 Mar 06 |
nicklas |
310 |
dc.commit(); |
2097 |
21 Mar 06 |
nicklas |
311 |
if (numTotal != numRemoved) |
2097 |
21 Mar 06 |
nicklas |
312 |
{ |
2526 |
15 Aug 06 |
martin |
313 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be restored, because you have no WRITE permission"; |
2097 |
21 Mar 06 |
nicklas |
314 |
} |
2298 |
19 May 06 |
nicklas |
315 |
if (transformationId != null) |
2298 |
19 May 06 |
nicklas |
316 |
{ |
6192 |
31 Oct 12 |
nicklas |
317 |
forward = viewTransformationPage; |
2298 |
19 May 06 |
nicklas |
318 |
} |
2298 |
19 May 06 |
nicklas |
319 |
else if (itemId != null) |
2298 |
19 May 06 |
nicklas |
320 |
{ |
6192 |
31 Oct 12 |
nicklas |
321 |
forward = viewPage; |
2298 |
19 May 06 |
nicklas |
322 |
} |
2298 |
19 May 06 |
nicklas |
323 |
else |
2298 |
19 May 06 |
nicklas |
324 |
{ |
6192 |
31 Oct 12 |
nicklas |
325 |
redirect = listPage; |
2298 |
19 May 06 |
nicklas |
326 |
} |
2097 |
21 Mar 06 |
nicklas |
327 |
} |
2097 |
21 Mar 06 |
nicklas |
328 |
else if ("ExportItems".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
329 |
{ |
2097 |
21 Mar 06 |
nicklas |
330 |
// Run an export plugin in a list context |
2097 |
21 Mar 06 |
nicklas |
331 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2210 |
03 May 06 |
nicklas |
332 |
setClosed(request, cc); |
7954 |
12 May 21 |
nicklas |
333 |
dc = sc.newDbControl(":Export "+itemType); |
2097 |
21 Mar 06 |
nicklas |
334 |
final Experiment experiment = Experiment.getById(dc, experimentId); |
5590 |
16 Mar 11 |
nicklas |
335 |
final ItemQuery<BioAssaySet> query = experiment.getBioAssaySets(); |
7914 |
23 Feb 21 |
nicklas |
336 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
337 |
cc.configureQuery(dc, query, jspContext, true); |
6040 |
30 Mar 12 |
nicklas |
338 |
cc.setQuery(query); |
7604 |
25 Feb 19 |
nicklas |
339 |
ExtensionsInvoker<ListColumnAction<BioAssaySet,?>> listInvoker = ListColumnUtil.useExtensions(jspContext); |
7604 |
25 Feb 19 |
nicklas |
340 |
listInvoker.render(new ListColumnExportRenderer<BioAssaySet>(cc)); |
2097 |
21 Mar 06 |
nicklas |
341 |
dc.close(); |
2097 |
21 Mar 06 |
nicklas |
342 |
redirect = "../../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+bioassay+sets"; |
2097 |
21 Mar 06 |
nicklas |
343 |
} |
2097 |
21 Mar 06 |
nicklas |
344 |
else if ("ExportItem".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
345 |
{ |
2097 |
21 Mar 06 |
nicklas |
346 |
// Run an export plugin in single-item context |
2097 |
21 Mar 06 |
nicklas |
347 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2097 |
21 Mar 06 |
nicklas |
348 |
redirect = "../../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+bioassay+set"; |
2097 |
21 Mar 06 |
nicklas |
349 |
} |
2097 |
21 Mar 06 |
nicklas |
350 |
else if ("ImportItems".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
351 |
{ |
2097 |
21 Mar 06 |
nicklas |
352 |
// Run an import plugin in a list context |
2097 |
21 Mar 06 |
nicklas |
353 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2210 |
03 May 06 |
nicklas |
354 |
setClosed(request, cc); |
7954 |
12 May 21 |
nicklas |
355 |
dc = sc.newDbControl(":Import "+itemType); |
2097 |
21 Mar 06 |
nicklas |
356 |
final Experiment experiment = Experiment.getById(dc, experimentId); |
5590 |
16 Mar 11 |
nicklas |
357 |
final ItemQuery<BioAssaySet> query = experiment.getBioAssaySets(); |
7914 |
23 Feb 21 |
nicklas |
358 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
359 |
cc.configureQuery(dc, query, jspContext, true); |
2097 |
21 Mar 06 |
nicklas |
360 |
dc.close(); |
2097 |
21 Mar 06 |
nicklas |
361 |
cc.setQuery(query); |
2097 |
21 Mar 06 |
nicklas |
362 |
redirect = "../../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Import+bioassay+sets"; |
2097 |
21 Mar 06 |
nicklas |
363 |
} |
2097 |
21 Mar 06 |
nicklas |
364 |
else if ("ImportItem".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
365 |
{ |
2097 |
21 Mar 06 |
nicklas |
366 |
// Run an import plugin in single-item context |
2097 |
21 Mar 06 |
nicklas |
367 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2097 |
21 Mar 06 |
nicklas |
368 |
redirect = "../../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Import+bioassay+set"; |
2097 |
21 Mar 06 |
nicklas |
369 |
} |
2097 |
21 Mar 06 |
nicklas |
370 |
else if ("RunListPlugin".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
371 |
{ |
2097 |
21 Mar 06 |
nicklas |
372 |
// Run another plugin in a list context |
2097 |
21 Mar 06 |
nicklas |
373 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2210 |
03 May 06 |
nicklas |
374 |
setClosed(request, cc); |
7954 |
12 May 21 |
nicklas |
375 |
dc = sc.newDbControl(":Run plugin "+itemType); |
2097 |
21 Mar 06 |
nicklas |
376 |
final Experiment experiment = Experiment.getById(dc, experimentId); |
5590 |
16 Mar 11 |
nicklas |
377 |
final ItemQuery<BioAssaySet> query = experiment.getBioAssaySets(); |
7914 |
23 Feb 21 |
nicklas |
378 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
379 |
cc.configureQuery(dc, query, jspContext, true); |
2097 |
21 Mar 06 |
nicklas |
380 |
dc.close(); |
2097 |
21 Mar 06 |
nicklas |
381 |
cc.setQuery(query); |
2097 |
21 Mar 06 |
nicklas |
382 |
redirect = "../../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&main_type=OTHER&title=Run+plugin"; |
2097 |
21 Mar 06 |
nicklas |
383 |
} |
2097 |
21 Mar 06 |
nicklas |
384 |
else if ("RunPlugin".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
385 |
{ |
2097 |
21 Mar 06 |
nicklas |
386 |
// Run a plugin in single-item context |
2097 |
21 Mar 06 |
nicklas |
387 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2097 |
21 Mar 06 |
nicklas |
388 |
redirect = "../../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=OTHER&title=Run+plugin"; |
2097 |
21 Mar 06 |
nicklas |
389 |
} |
2097 |
21 Mar 06 |
nicklas |
390 |
else if ("RunAnalysisPlugin".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
391 |
{ |
2097 |
21 Mar 06 |
nicklas |
392 |
// Run an analysis plugin in single-item context |
2097 |
21 Mar 06 |
nicklas |
393 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2200 |
27 Apr 06 |
jari |
394 |
redirect = "../../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=ANALYZE&title=Run+analysis+plugin"; |
2097 |
21 Mar 06 |
nicklas |
395 |
} |
2183 |
24 Apr 06 |
nicklas |
396 |
else if ("NewFilteredBioAssaySet".equals(cmd)) |
2097 |
21 Mar 06 |
nicklas |
397 |
{ |
2183 |
24 Apr 06 |
nicklas |
398 |
// Display the edit page for for filtering a bioassay set (should be opened in a popup) |
2183 |
24 Apr 06 |
nicklas |
399 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
3592 |
23 Jul 07 |
nicklas |
400 |
redirect = "../../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=ANALYZE&title=Filter+bioassay+set&plugin_type=net.sf.basedb.core.plugin.AnalysisFilterPlugin"; |
2183 |
24 Apr 06 |
nicklas |
401 |
} |
4374 |
04 Jul 08 |
nicklas |
402 |
else if ("SetClosedWithAjax".equals(cmd)) |
4374 |
04 Jul 08 |
nicklas |
403 |
{ |
4374 |
04 Jul 08 |
nicklas |
404 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4374 |
04 Jul 08 |
nicklas |
405 |
setClosed(request, cc); |
4374 |
04 Jul 08 |
nicklas |
406 |
return; |
4374 |
04 Jul 08 |
nicklas |
407 |
} |
2097 |
21 Mar 06 |
nicklas |
408 |
else |
2097 |
21 Mar 06 |
nicklas |
409 |
{ |
2097 |
21 Mar 06 |
nicklas |
410 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
2097 |
21 Mar 06 |
nicklas |
411 |
} |
2097 |
21 Mar 06 |
nicklas |
412 |
} |
2097 |
21 Mar 06 |
nicklas |
413 |
finally |
2097 |
21 Mar 06 |
nicklas |
414 |
{ |
2097 |
21 Mar 06 |
nicklas |
415 |
if (dc != null) dc.close(); |
2097 |
21 Mar 06 |
nicklas |
416 |
} |
2097 |
21 Mar 06 |
nicklas |
417 |
|
2097 |
21 Mar 06 |
nicklas |
418 |
if (forward != null) |
2097 |
21 Mar 06 |
nicklas |
419 |
{ |
6192 |
31 Oct 12 |
nicklas |
420 |
sc.setSessionSetting("alert-message", message); |
2097 |
21 Mar 06 |
nicklas |
421 |
pageContext.forward(forward); |
2097 |
21 Mar 06 |
nicklas |
422 |
} |
2097 |
21 Mar 06 |
nicklas |
423 |
else if (redirect != null) |
2097 |
21 Mar 06 |
nicklas |
424 |
{ |
6192 |
31 Oct 12 |
nicklas |
425 |
sc.setSessionSetting("alert-message", message); |
2097 |
21 Mar 06 |
nicklas |
426 |
response.sendRedirect(redirect); |
2097 |
21 Mar 06 |
nicklas |
427 |
} |
2097 |
21 Mar 06 |
nicklas |
428 |
else if (message == null) |
2097 |
21 Mar 06 |
nicklas |
429 |
{ |
2097 |
21 Mar 06 |
nicklas |
430 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
2097 |
21 Mar 06 |
nicklas |
431 |
} |
2097 |
21 Mar 06 |
nicklas |
432 |
else |
2097 |
21 Mar 06 |
nicklas |
433 |
{ |
2097 |
21 Mar 06 |
nicklas |
434 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
2097 |
21 Mar 06 |
nicklas |
435 |
} |
2097 |
21 Mar 06 |
nicklas |
436 |
%> |
2097 |
21 Mar 06 |
nicklas |
437 |
|