5657 |
16 Jun 11 |
nicklas |
1 |
<%-- $Id $ |
5657 |
16 Jun 11 |
nicklas |
2 |
------------------------------------------------------------------ |
5657 |
16 Jun 11 |
nicklas |
Copyright (C) 2011 Nicklas Nordborg |
5657 |
16 Jun 11 |
nicklas |
4 |
|
5657 |
16 Jun 11 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
5657 |
16 Jun 11 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
5657 |
16 Jun 11 |
nicklas |
7 |
|
5657 |
16 Jun 11 |
nicklas |
8 |
This file is part of BASE. |
5657 |
16 Jun 11 |
nicklas |
9 |
|
5657 |
16 Jun 11 |
nicklas |
10 |
BASE is free software; you can redistribute it and/or |
5657 |
16 Jun 11 |
nicklas |
11 |
modify it under the terms of the GNU General Public License |
5657 |
16 Jun 11 |
nicklas |
12 |
as published by the Free Software Foundation; either version 3 |
5657 |
16 Jun 11 |
nicklas |
13 |
of the License, or (at your option) any later version. |
5657 |
16 Jun 11 |
nicklas |
14 |
|
5657 |
16 Jun 11 |
nicklas |
15 |
BASE is distributed in the hope that it will be useful, |
5657 |
16 Jun 11 |
nicklas |
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
5657 |
16 Jun 11 |
nicklas |
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5657 |
16 Jun 11 |
nicklas |
18 |
GNU General Public License for more details. |
5657 |
16 Jun 11 |
nicklas |
19 |
|
5657 |
16 Jun 11 |
nicklas |
20 |
You should have received a copy of the GNU General Public License |
5657 |
16 Jun 11 |
nicklas |
21 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
5657 |
16 Jun 11 |
nicklas |
22 |
------------------------------------------------------------------ |
5657 |
16 Jun 11 |
nicklas |
23 |
|
5657 |
16 Jun 11 |
nicklas |
24 |
--%> |
5657 |
16 Jun 11 |
nicklas |
25 |
<%@ page pageEncoding="UTF-8" session="false" |
5657 |
16 Jun 11 |
nicklas |
26 |
import="net.sf.basedb.core.SessionControl" |
5657 |
16 Jun 11 |
nicklas |
27 |
import="net.sf.basedb.core.DbControl" |
5685 |
04 Aug 11 |
nicklas |
28 |
import="net.sf.basedb.core.DerivedBioAssay" |
5657 |
16 Jun 11 |
nicklas |
29 |
import="net.sf.basedb.core.PhysicalBioAssay" |
5685 |
04 Aug 11 |
nicklas |
30 |
import="net.sf.basedb.core.RawBioAssay" |
5657 |
16 Jun 11 |
nicklas |
31 |
import="net.sf.basedb.core.ItemSubtype" |
5685 |
04 Aug 11 |
nicklas |
32 |
import="net.sf.basedb.core.Extract" |
6996 |
03 Nov 15 |
nicklas |
33 |
import="net.sf.basedb.core.Kit" |
5657 |
16 Jun 11 |
nicklas |
34 |
import="net.sf.basedb.core.Protocol" |
5657 |
16 Jun 11 |
nicklas |
35 |
import="net.sf.basedb.core.Software" |
5657 |
16 Jun 11 |
nicklas |
36 |
import="net.sf.basedb.core.Hardware" |
5657 |
16 Jun 11 |
nicklas |
37 |
import="net.sf.basedb.core.Item" |
5657 |
16 Jun 11 |
nicklas |
38 |
import="net.sf.basedb.core.Include" |
5657 |
16 Jun 11 |
nicklas |
39 |
import="net.sf.basedb.core.User" |
5657 |
16 Jun 11 |
nicklas |
40 |
import="net.sf.basedb.core.OwnedItem" |
6695 |
28 Jan 15 |
nicklas |
41 |
import="net.sf.basedb.core.AnnotatedItem" |
5657 |
16 Jun 11 |
nicklas |
42 |
import="net.sf.basedb.core.ItemQuery" |
5657 |
16 Jun 11 |
nicklas |
43 |
import="net.sf.basedb.core.ItemResultIterator" |
5657 |
16 Jun 11 |
nicklas |
44 |
import="net.sf.basedb.core.Permission" |
5657 |
16 Jun 11 |
nicklas |
45 |
import="net.sf.basedb.core.PluginDefinition" |
5657 |
16 Jun 11 |
nicklas |
46 |
import="net.sf.basedb.core.ItemContext" |
5657 |
16 Jun 11 |
nicklas |
47 |
import="net.sf.basedb.core.MultiPermissions" |
5657 |
16 Jun 11 |
nicklas |
48 |
import="net.sf.basedb.core.PermissionDeniedException" |
5657 |
16 Jun 11 |
nicklas |
49 |
import="net.sf.basedb.core.ItemAlreadyExistsException" |
5685 |
04 Aug 11 |
nicklas |
50 |
import="net.sf.basedb.core.query.Hql" |
5685 |
04 Aug 11 |
nicklas |
51 |
import="net.sf.basedb.core.query.Orders" |
5685 |
04 Aug 11 |
nicklas |
52 |
import="net.sf.basedb.core.query.Restrictions" |
5685 |
04 Aug 11 |
nicklas |
53 |
import="net.sf.basedb.core.query.Expressions" |
5657 |
16 Jun 11 |
nicklas |
54 |
import="net.sf.basedb.util.RemovableUtil" |
5657 |
16 Jun 11 |
nicklas |
55 |
import="net.sf.basedb.util.ShareableUtil" |
5657 |
16 Jun 11 |
nicklas |
56 |
import="net.sf.basedb.util.IncludeExcludeFilter" |
5657 |
16 Jun 11 |
nicklas |
57 |
import="net.sf.basedb.clients.web.Base" |
5657 |
16 Jun 11 |
nicklas |
58 |
import="net.sf.basedb.clients.web.WebException" |
5657 |
16 Jun 11 |
nicklas |
59 |
import="net.sf.basedb.util.Values" |
5657 |
16 Jun 11 |
nicklas |
60 |
import="net.sf.basedb.clients.web.util.HTML" |
5657 |
16 Jun 11 |
nicklas |
61 |
import="net.sf.basedb.core.plugin.GuiContext" |
5657 |
16 Jun 11 |
nicklas |
62 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
5685 |
04 Aug 11 |
nicklas |
63 |
import="net.sf.basedb.util.formatter.NameableFormatter" |
5657 |
16 Jun 11 |
nicklas |
64 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5657 |
16 Jun 11 |
nicklas |
65 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5657 |
16 Jun 11 |
nicklas |
66 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
67 |
import="net.sf.basedb.clients.web.extensions.edit.OnSaveAction" |
5657 |
16 Jun 11 |
nicklas |
68 |
import="net.sf.basedb.clients.web.extensions.edit.OnSaveRenderer" |
6040 |
30 Mar 12 |
nicklas |
69 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnExportRenderer" |
7604 |
25 Feb 19 |
nicklas |
70 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnAction" |
6040 |
30 Mar 12 |
nicklas |
71 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
5685 |
04 Aug 11 |
nicklas |
72 |
import="net.sf.basedb.clients.web.plugins.ItemQueryLoader" |
5657 |
16 Jun 11 |
nicklas |
73 |
import="java.util.Enumeration" |
5657 |
16 Jun 11 |
nicklas |
74 |
import="java.util.Set" |
5657 |
16 Jun 11 |
nicklas |
75 |
import="java.util.HashSet" |
5657 |
16 Jun 11 |
nicklas |
76 |
import="java.util.List" |
5657 |
16 Jun 11 |
nicklas |
77 |
import="java.util.LinkedList" |
5657 |
16 Jun 11 |
nicklas |
78 |
import="java.util.Collections" |
5657 |
16 Jun 11 |
nicklas |
79 |
import="java.util.Arrays" |
5657 |
16 Jun 11 |
nicklas |
80 |
%> |
5657 |
16 Jun 11 |
nicklas |
81 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
5657 |
16 Jun 11 |
nicklas |
82 |
<%! |
5685 |
04 Aug 11 |
nicklas |
83 |
private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,itemSubtype,physicalBioAssay,extract,parent,description"); |
5685 |
04 Aug 11 |
nicklas |
84 |
private static final Item itemType = Item.DERIVEDBIOASSAY; |
5685 |
04 Aug 11 |
nicklas |
85 |
|
5685 |
04 Aug 11 |
nicklas |
86 |
private static void registerExportUtils(ItemContext cc) |
5685 |
04 Aug 11 |
nicklas |
87 |
{ |
5685 |
04 Aug 11 |
nicklas |
88 |
// Register formatters |
6084 |
16 Aug 12 |
nicklas |
89 |
cc.setObject("export.formatter.&physicalBioAssays(name)", new NameableFormatter()); |
6084 |
16 Aug 12 |
nicklas |
90 |
cc.setObject("export.formatter.&parents(name)", new NameableFormatter()); |
5685 |
04 Aug 11 |
nicklas |
91 |
cc.setObject("export.formatter.&children(name)", new NameableFormatter()); |
5685 |
04 Aug 11 |
nicklas |
92 |
cc.setObject("export.formatter.&rawBioAssays(name)", new NameableFormatter()); |
5685 |
04 Aug 11 |
nicklas |
93 |
|
5685 |
04 Aug 11 |
nicklas |
94 |
// Register dataloaders |
5685 |
04 Aug 11 |
nicklas |
95 |
String bioassayParameter = "bioassay"; |
6084 |
16 Aug 12 |
nicklas |
96 |
// Physical bioassays |
6084 |
16 Aug 12 |
nicklas |
97 |
ItemQuery<PhysicalBioAssay> physicalQuery = PhysicalBioAssay.getQuery(); |
6084 |
16 Aug 12 |
nicklas |
98 |
physicalQuery.include(cc.getInclude()); |
6084 |
16 Aug 12 |
nicklas |
99 |
physicalQuery.join(Hql.innerJoin("derivedBioAssays", "dba")); |
6084 |
16 Aug 12 |
nicklas |
100 |
physicalQuery.restrict(Restrictions.eq(Hql.alias("dba"), Expressions.parameter(bioassayParameter))); |
6084 |
16 Aug 12 |
nicklas |
101 |
physicalQuery.order(Orders.asc(Hql.property("name"))); |
7604 |
25 Feb 19 |
nicklas |
102 |
cc.setObject("export.dataloader.&physicalBioAssays(name)", new ItemQueryLoader<DerivedBioAssay>(physicalQuery, bioassayParameter)); |
6084 |
16 Aug 12 |
nicklas |
103 |
|
6084 |
16 Aug 12 |
nicklas |
104 |
// Parent bioassays |
6084 |
16 Aug 12 |
nicklas |
105 |
ItemQuery<DerivedBioAssay> parentQuery = DerivedBioAssay.getQuery(); |
6084 |
16 Aug 12 |
nicklas |
106 |
parentQuery.include(cc.getInclude()); |
6084 |
16 Aug 12 |
nicklas |
107 |
parentQuery.join(Hql.innerJoin("children", "c")); |
6084 |
16 Aug 12 |
nicklas |
108 |
parentQuery.restrict(Restrictions.eq(Hql.alias("c"), Expressions.parameter(bioassayParameter))); |
6084 |
16 Aug 12 |
nicklas |
109 |
parentQuery.order(Orders.asc(Hql.property("name"))); |
7604 |
25 Feb 19 |
nicklas |
110 |
cc.setObject("export.dataloader.&parents(name)", new ItemQueryLoader<DerivedBioAssay>(parentQuery, bioassayParameter)); |
6084 |
16 Aug 12 |
nicklas |
111 |
|
5685 |
04 Aug 11 |
nicklas |
112 |
// Child bioassays |
6084 |
16 Aug 12 |
nicklas |
113 |
ItemQuery<DerivedBioAssay> childQuery = DerivedBioAssay.getQuery(); |
6084 |
16 Aug 12 |
nicklas |
114 |
childQuery.include(cc.getInclude()); |
6084 |
16 Aug 12 |
nicklas |
115 |
childQuery.join(Hql.innerJoin("parents", "p")); |
6084 |
16 Aug 12 |
nicklas |
116 |
childQuery.restrict(Restrictions.eq(Hql.alias("p"), Expressions.parameter(bioassayParameter))); |
6084 |
16 Aug 12 |
nicklas |
117 |
childQuery.order(Orders.asc(Hql.property("name"))); |
7604 |
25 Feb 19 |
nicklas |
118 |
cc.setObject("export.dataloader.&children(name)", new ItemQueryLoader<DerivedBioAssay>(childQuery, bioassayParameter)); |
5685 |
04 Aug 11 |
nicklas |
119 |
|
5685 |
04 Aug 11 |
nicklas |
120 |
// Child raw bioassays |
5685 |
04 Aug 11 |
nicklas |
121 |
ItemQuery<RawBioAssay> rawQuery = RawBioAssay.getQuery(); |
5685 |
04 Aug 11 |
nicklas |
122 |
rawQuery.include(cc.getInclude()); |
5685 |
04 Aug 11 |
nicklas |
123 |
rawQuery.restrict(Restrictions.eq(Hql.property("parentBioAssay"), Expressions.parameter(bioassayParameter))); |
5685 |
04 Aug 11 |
nicklas |
124 |
rawQuery.order(Orders.asc(Hql.property("name"))); |
7604 |
25 Feb 19 |
nicklas |
125 |
cc.setObject("export.dataloader.&rawBioAssays(name)", new ItemQueryLoader<DerivedBioAssay>(rawQuery, bioassayParameter)); |
5685 |
04 Aug 11 |
nicklas |
126 |
|
5685 |
04 Aug 11 |
nicklas |
127 |
} |
5685 |
04 Aug 11 |
nicklas |
128 |
|
5657 |
16 Jun 11 |
nicklas |
129 |
%> |
5657 |
16 Jun 11 |
nicklas |
130 |
<% |
5657 |
16 Jun 11 |
nicklas |
131 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
5657 |
16 Jun 11 |
nicklas |
132 |
final String ID = sc.getId(); |
5657 |
16 Jun 11 |
nicklas |
133 |
final String cmd = request.getParameter("cmd"); |
5657 |
16 Jun 11 |
nicklas |
134 |
final String root = request.getContextPath()+"/"; |
5657 |
16 Jun 11 |
nicklas |
135 |
final String mode = request.getParameter("mode"); |
5657 |
16 Jun 11 |
nicklas |
136 |
final String callback = request.getParameter("callback"); |
5657 |
16 Jun 11 |
nicklas |
137 |
final String itemId = request.getParameter("item_id"); |
5685 |
04 Aug 11 |
nicklas |
138 |
final String listPage = "list_bioassays.jsp?ID="+ID+"&item_id="+itemId |
5657 |
16 Jun 11 |
nicklas |
139 |
+(mode == null ? "" : "&mode="+mode) |
5657 |
16 Jun 11 |
nicklas |
140 |
+(callback == null ? "" : "&callback="+callback) |
5657 |
16 Jun 11 |
nicklas |
141 |
+(itemId == null ? "" : "&item_id="+itemId); |
5685 |
04 Aug 11 |
nicklas |
142 |
final String viewPage = "view_bioassay.jsp?ID="+ID; |
5685 |
04 Aug 11 |
nicklas |
143 |
final String editPage = "edit_bioassay.jsp?ID="+ID; |
5657 |
16 Jun 11 |
nicklas |
144 |
|
5657 |
16 Jun 11 |
nicklas |
145 |
String forward = null; |
5657 |
16 Jun 11 |
nicklas |
146 |
String redirect = null; |
5657 |
16 Jun 11 |
nicklas |
147 |
String message = null; |
5657 |
16 Jun 11 |
nicklas |
148 |
DbControl dc = null; |
5657 |
16 Jun 11 |
nicklas |
149 |
|
5657 |
16 Jun 11 |
nicklas |
150 |
try |
5657 |
16 Jun 11 |
nicklas |
151 |
{ |
5657 |
16 Jun 11 |
nicklas |
152 |
if (cmd == null || "List".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
153 |
{ |
5657 |
16 Jun 11 |
nicklas |
154 |
// Display the list page without updatinging the current context |
5657 |
16 Jun 11 |
nicklas |
155 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext, true); |
5657 |
16 Jun 11 |
nicklas |
156 |
redirect = listPage; |
5657 |
16 Jun 11 |
nicklas |
157 |
} |
5657 |
16 Jun 11 |
nicklas |
158 |
else if ("UpdateContext".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
159 |
{ |
5657 |
16 Jun 11 |
nicklas |
160 |
// Display the list page after updating the current context from the request parameters |
5657 |
16 Jun 11 |
nicklas |
161 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
162 |
redirect = listPage; |
5657 |
16 Jun 11 |
nicklas |
163 |
} |
5657 |
16 Jun 11 |
nicklas |
164 |
else if ("LoadContext".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
165 |
{ |
5657 |
16 Jun 11 |
nicklas |
166 |
// Display the list page after loading a saved context |
5657 |
16 Jun 11 |
nicklas |
167 |
int contextId = Values.getInt(request.getParameter("context")); |
5657 |
16 Jun 11 |
nicklas |
168 |
Base.loadContext(sc, contextId, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
169 |
redirect = listPage; |
5657 |
16 Jun 11 |
nicklas |
170 |
} |
5657 |
16 Jun 11 |
nicklas |
171 |
else if ("ViewItem".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
172 |
{ |
5657 |
16 Jun 11 |
nicklas |
173 |
// Display the view page for a single item |
5657 |
16 Jun 11 |
nicklas |
174 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
175 |
forward = viewPage; |
5657 |
16 Jun 11 |
nicklas |
176 |
} |
5657 |
16 Jun 11 |
nicklas |
177 |
else if ("EditItem".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
178 |
{ |
5657 |
16 Jun 11 |
nicklas |
179 |
// Display the edit page for a single item (should be opened in a popup) |
5657 |
16 Jun 11 |
nicklas |
180 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5721 |
06 Sep 11 |
nicklas |
181 |
forward = editPage; |
5657 |
16 Jun 11 |
nicklas |
182 |
} |
5657 |
16 Jun 11 |
nicklas |
183 |
else if ("NewItem".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
184 |
{ |
5657 |
16 Jun 11 |
nicklas |
185 |
// Display the edit page for a new item (should be opened in a popup) |
5657 |
16 Jun 11 |
nicklas |
186 |
if (!sc.hasPermission(Permission.CREATE, itemType)) |
5657 |
16 Jun 11 |
nicklas |
187 |
{ |
5657 |
16 Jun 11 |
nicklas |
188 |
throw new PermissionDeniedException(Permission.CREATE, itemType.toString()); |
5657 |
16 Jun 11 |
nicklas |
189 |
} |
5657 |
16 Jun 11 |
nicklas |
190 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
191 |
cc.setId(0); |
5657 |
16 Jun 11 |
nicklas |
192 |
forward = editPage; |
5657 |
16 Jun 11 |
nicklas |
193 |
} |
5657 |
16 Jun 11 |
nicklas |
194 |
else if ("UpdateItem".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
195 |
{ |
5657 |
16 Jun 11 |
nicklas |
196 |
// Update the properties on an item (will close the popup) |
5657 |
16 Jun 11 |
nicklas |
197 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
198 |
final int maxRecent = Base.getMaxRecent(sc); |
7954 |
12 May 21 |
nicklas |
199 |
dc = sc.newDbControl(":Edit "+itemType); |
5657 |
16 Jun 11 |
nicklas |
200 |
|
7605 |
26 Feb 19 |
nicklas |
201 |
DerivedBioAssay bas = cc.getObject("item"); |
5657 |
16 Jun 11 |
nicklas |
202 |
if (bas == null) |
5657 |
16 Jun 11 |
nicklas |
203 |
{ |
6082 |
14 Aug 12 |
nicklas |
204 |
bas = DerivedBioAssay.getNew(dc, Values.getBoolean(request.getParameter("isRoot")), null); |
5657 |
16 Jun 11 |
nicklas |
205 |
dc.saveItem(bas); |
5685 |
04 Aug 11 |
nicklas |
206 |
message = "Derived bioassay created"; |
5657 |
16 Jun 11 |
nicklas |
207 |
} |
5657 |
16 Jun 11 |
nicklas |
208 |
else |
5657 |
16 Jun 11 |
nicklas |
209 |
{ |
5657 |
16 Jun 11 |
nicklas |
210 |
dc.reattachItem(bas, false); |
5685 |
04 Aug 11 |
nicklas |
211 |
message = "Derived bioassay updated"; |
5657 |
16 Jun 11 |
nicklas |
212 |
} |
5657 |
16 Jun 11 |
nicklas |
213 |
|
5657 |
16 Jun 11 |
nicklas |
214 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), bas); |
7604 |
25 Feb 19 |
nicklas |
215 |
ExtensionsInvoker<OnSaveAction> invoker = EditUtil.useOnSaveExtensions(jspContext); |
5657 |
16 Jun 11 |
nicklas |
216 |
try |
5657 |
16 Jun 11 |
nicklas |
217 |
{ |
5657 |
16 Jun 11 |
nicklas |
218 |
bas.setName(Values.getStringOrNull(request.getParameter("name"))); |
5657 |
16 Jun 11 |
nicklas |
219 |
bas.setDescription(Values.getStringOrNull(request.getParameter("description"))); |
5657 |
16 Jun 11 |
nicklas |
220 |
|
5657 |
16 Jun 11 |
nicklas |
221 |
int subtypeId = Values.getInt(request.getParameter("subtype_id"), -1); |
5687 |
09 Aug 11 |
nicklas |
222 |
ItemSubtype subtype = null; |
5657 |
16 Jun 11 |
nicklas |
223 |
if (subtypeId >= 0) // < 0 = denied or unchanged |
5657 |
16 Jun 11 |
nicklas |
224 |
{ |
5687 |
09 Aug 11 |
nicklas |
225 |
subtype = subtypeId == 0 ? null : ItemSubtype.getById(dc, subtypeId); |
5657 |
16 Jun 11 |
nicklas |
226 |
bas.setItemSubtype(subtype); |
7703 |
11 Apr 19 |
nicklas |
227 |
cc.setRecent(Item.ITEMSUBTYPE, subtype, maxRecent); |
5657 |
16 Jun 11 |
nicklas |
228 |
} |
5685 |
04 Aug 11 |
nicklas |
229 |
|
5685 |
04 Aug 11 |
nicklas |
230 |
int extractId = Values.getInt(request.getParameter("extract_id"), -1); |
5685 |
04 Aug 11 |
nicklas |
231 |
if (extractId >= 0) // < 0 = denied or unchanged |
5685 |
04 Aug 11 |
nicklas |
232 |
{ |
5685 |
04 Aug 11 |
nicklas |
233 |
Extract extract = extractId == 0 ? null : Extract.getById(dc, extractId); |
5685 |
04 Aug 11 |
nicklas |
234 |
bas.setExtract(extract); |
5685 |
04 Aug 11 |
nicklas |
235 |
} |
5657 |
16 Jun 11 |
nicklas |
236 |
|
5657 |
16 Jun 11 |
nicklas |
237 |
int protocolId = Values.getInt(request.getParameter("protocol_id"), -1); |
5657 |
16 Jun 11 |
nicklas |
238 |
if (protocolId >= 0) // < 0 = denied or unchanged |
5657 |
16 Jun 11 |
nicklas |
239 |
{ |
5657 |
16 Jun 11 |
nicklas |
240 |
Protocol pt = protocolId == 0 ? null : Protocol.getById(dc, protocolId); |
5657 |
16 Jun 11 |
nicklas |
241 |
bas.setProtocol(pt); |
7703 |
11 Apr 19 |
nicklas |
242 |
cc.setRecent(Item.PROTOCOL, pt, subtype, maxRecent); |
5657 |
16 Jun 11 |
nicklas |
243 |
} |
5657 |
16 Jun 11 |
nicklas |
244 |
|
6996 |
03 Nov 15 |
nicklas |
245 |
int kitId = Values.getInt(request.getParameter("kit_id"), -1); |
6996 |
03 Nov 15 |
nicklas |
246 |
if (kitId >= 0) // < 0 = denied or unchanged |
6996 |
03 Nov 15 |
nicklas |
247 |
{ |
6996 |
03 Nov 15 |
nicklas |
248 |
Kit kit = kitId == 0 ? null : Kit.getById(dc, kitId); |
6996 |
03 Nov 15 |
nicklas |
249 |
bas.setKit(kit); |
7703 |
11 Apr 19 |
nicklas |
250 |
cc.setRecent(Item.KIT, kit, subtype, maxRecent); |
6996 |
03 Nov 15 |
nicklas |
251 |
} |
6996 |
03 Nov 15 |
nicklas |
252 |
|
5657 |
16 Jun 11 |
nicklas |
253 |
int hardwareId = Values.getInt(request.getParameter("hardware_id"), -1); |
5657 |
16 Jun 11 |
nicklas |
254 |
if (hardwareId >= 0) // < 0 denied or unchanged |
5657 |
16 Jun 11 |
nicklas |
255 |
{ |
5657 |
16 Jun 11 |
nicklas |
256 |
Hardware hw = hardwareId == 0 ? null : Hardware.getById(dc, hardwareId); |
5657 |
16 Jun 11 |
nicklas |
257 |
bas.setHardware(hw); |
7703 |
11 Apr 19 |
nicklas |
258 |
cc.setRecent(Item.HARDWARE, hw, subtype, maxRecent); |
5657 |
16 Jun 11 |
nicklas |
259 |
} |
5657 |
16 Jun 11 |
nicklas |
260 |
|
5657 |
16 Jun 11 |
nicklas |
261 |
int softwareId = Values.getInt(request.getParameter("software_id"), -1); |
5657 |
16 Jun 11 |
nicklas |
262 |
if (softwareId >= 0) // < 0 denied or unchanged |
5657 |
16 Jun 11 |
nicklas |
263 |
{ |
5657 |
16 Jun 11 |
nicklas |
264 |
Software sw = softwareId == 0 ? null : Software.getById(dc, softwareId); |
5657 |
16 Jun 11 |
nicklas |
265 |
bas.setSoftware(sw); |
7703 |
11 Apr 19 |
nicklas |
266 |
cc.setRecent(Item.SOFTWARE, sw, subtype, maxRecent); |
5657 |
16 Jun 11 |
nicklas |
267 |
} |
5657 |
16 Jun 11 |
nicklas |
268 |
|
6082 |
14 Aug 12 |
nicklas |
269 |
if (bas.isRoot()) |
6082 |
14 Aug 12 |
nicklas |
270 |
{ |
6082 |
14 Aug 12 |
nicklas |
271 |
// A root derived bioassay set may have physical bioassays as parents |
6314 |
02 Sep 13 |
nicklas |
272 |
String[] removePhysicalBioAssays = Values.getString(request.getParameter("-PHYSICALBIOASSAY")).split(","); |
6082 |
14 Aug 12 |
nicklas |
273 |
for (int i = 0; i < removePhysicalBioAssays.length; ++i) |
6082 |
14 Aug 12 |
nicklas |
274 |
{ |
6082 |
14 Aug 12 |
nicklas |
275 |
int pbaId = Values.getInt(removePhysicalBioAssays[i], -1); |
6082 |
14 Aug 12 |
nicklas |
276 |
if (pbaId != -1) bas.removePhysicalBioAssay(PhysicalBioAssay.getById(dc, pbaId)); |
6082 |
14 Aug 12 |
nicklas |
277 |
} |
6082 |
14 Aug 12 |
nicklas |
278 |
|
6314 |
02 Sep 13 |
nicklas |
279 |
String[] addPhysicalBioAssays = Values.getString(request.getParameter("+PHYSICALBIOASSAY")).split(","); |
6082 |
14 Aug 12 |
nicklas |
280 |
for (int i = 0; i < addPhysicalBioAssays.length; ++i) |
6082 |
14 Aug 12 |
nicklas |
281 |
{ |
6082 |
14 Aug 12 |
nicklas |
282 |
int pbaId = Values.getInt(addPhysicalBioAssays[i], -1); |
6082 |
14 Aug 12 |
nicklas |
283 |
if (pbaId != -1) bas.addPhysicalBioAssay(PhysicalBioAssay.getById(dc, pbaId)); |
6082 |
14 Aug 12 |
nicklas |
284 |
} |
6082 |
14 Aug 12 |
nicklas |
285 |
} |
6082 |
14 Aug 12 |
nicklas |
286 |
else |
6082 |
14 Aug 12 |
nicklas |
287 |
{ |
6082 |
14 Aug 12 |
nicklas |
288 |
// A non-root derived bioassay set may have other derived bioassays as parents |
6314 |
02 Sep 13 |
nicklas |
289 |
String[] removeParents = Values.getString(request.getParameter("-DERIVEDBIOASSAY")).split(","); |
6082 |
14 Aug 12 |
nicklas |
290 |
for (int i = 0; i < removeParents.length; ++i) |
6082 |
14 Aug 12 |
nicklas |
291 |
{ |
6082 |
14 Aug 12 |
nicklas |
292 |
int parentId = Values.getInt(removeParents[i], -1); |
6082 |
14 Aug 12 |
nicklas |
293 |
if (parentId != -1) bas.removeParent(DerivedBioAssay.getById(dc, parentId)); |
6082 |
14 Aug 12 |
nicklas |
294 |
} |
6082 |
14 Aug 12 |
nicklas |
295 |
|
6314 |
02 Sep 13 |
nicklas |
296 |
String[] addParents = Values.getString(request.getParameter("+DERIVEDBIOASSAY")).split(","); |
6082 |
14 Aug 12 |
nicklas |
297 |
for (int i = 0; i < addParents.length; ++i) |
6082 |
14 Aug 12 |
nicklas |
298 |
{ |
6082 |
14 Aug 12 |
nicklas |
299 |
int parentId = Values.getInt(addParents[i], -1); |
6082 |
14 Aug 12 |
nicklas |
300 |
if (parentId != -1) bas.addParent(DerivedBioAssay.getById(dc, parentId)); |
6082 |
14 Aug 12 |
nicklas |
301 |
} |
6082 |
14 Aug 12 |
nicklas |
302 |
} |
6082 |
14 Aug 12 |
nicklas |
303 |
|
5657 |
16 Jun 11 |
nicklas |
304 |
// Data files tab |
5657 |
16 Jun 11 |
nicklas |
305 |
boolean validate = Values.getBoolean(request.getParameter("datafiles.validate")); |
5657 |
16 Jun 11 |
nicklas |
306 |
Base.updateFiles(dc, bas, request, validate, cc, maxRecent); |
5657 |
16 Jun 11 |
nicklas |
307 |
|
5657 |
16 Jun 11 |
nicklas |
308 |
// Annotations tab |
5657 |
16 Jun 11 |
nicklas |
309 |
Base.updateAnnotations(dc, bas, bas, request); |
5657 |
16 Jun 11 |
nicklas |
310 |
|
5657 |
16 Jun 11 |
nicklas |
311 |
// OnSave extensions |
5657 |
16 Jun 11 |
nicklas |
312 |
invoker.render(OnSaveRenderer.ON_SAVE); |
5657 |
16 Jun 11 |
nicklas |
313 |
dc.commit(); |
5657 |
16 Jun 11 |
nicklas |
314 |
invoker.render(OnSaveRenderer.ON_COMMIT); |
5657 |
16 Jun 11 |
nicklas |
315 |
} |
5657 |
16 Jun 11 |
nicklas |
316 |
catch (Exception ex) |
5657 |
16 Jun 11 |
nicklas |
317 |
{ |
5657 |
16 Jun 11 |
nicklas |
318 |
invoker.render(OnSaveRenderer.onRollback(ex)); |
5657 |
16 Jun 11 |
nicklas |
319 |
throw ex; |
5657 |
16 Jun 11 |
nicklas |
320 |
} |
5657 |
16 Jun 11 |
nicklas |
321 |
finally |
5657 |
16 Jun 11 |
nicklas |
322 |
{ |
5657 |
16 Jun 11 |
nicklas |
323 |
cc.removeObject("item"); |
5657 |
16 Jun 11 |
nicklas |
324 |
} |
5657 |
16 Jun 11 |
nicklas |
325 |
} |
5657 |
16 Jun 11 |
nicklas |
326 |
else if ("DeleteItem".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
327 |
{ |
5657 |
16 Jun 11 |
nicklas |
328 |
// Delete a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
329 |
dc = sc.newDbControl(":Delete "+itemType); |
5657 |
16 Jun 11 |
nicklas |
330 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
331 |
RemovableUtil.removeRecursively(dc, itemType, Collections.singleton(cc.getId()), true); |
5657 |
16 Jun 11 |
nicklas |
332 |
dc.commit(); |
5657 |
16 Jun 11 |
nicklas |
333 |
redirect = viewPage; |
5657 |
16 Jun 11 |
nicklas |
334 |
} |
5657 |
16 Jun 11 |
nicklas |
335 |
else if ("DeleteItems".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
336 |
{ |
5657 |
16 Jun 11 |
nicklas |
337 |
// Delete all selected items on the list page |
7954 |
12 May 21 |
nicklas |
338 |
dc = sc.newDbControl(":Delete "+itemType); |
5657 |
16 Jun 11 |
nicklas |
339 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
340 |
int numTotal = cc.getSelected().size(); |
5657 |
16 Jun 11 |
nicklas |
341 |
int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), true); |
5657 |
16 Jun 11 |
nicklas |
342 |
dc.commit(); |
5657 |
16 Jun 11 |
nicklas |
343 |
if (numTotal != numRemoved) |
5657 |
16 Jun 11 |
nicklas |
344 |
{ |
5657 |
16 Jun 11 |
nicklas |
345 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission"; |
5657 |
16 Jun 11 |
nicklas |
346 |
} |
6192 |
31 Oct 12 |
nicklas |
347 |
redirect = listPage; |
5657 |
16 Jun 11 |
nicklas |
348 |
} |
5657 |
16 Jun 11 |
nicklas |
349 |
else if ("RestoreItem".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
350 |
{ |
5657 |
16 Jun 11 |
nicklas |
351 |
// Restore a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
352 |
dc = sc.newDbControl(":Restore "+itemType); |
5657 |
16 Jun 11 |
nicklas |
353 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
354 |
RemovableUtil.removeRecursively(dc, itemType, Collections.singleton(cc.getId()), false); |
5657 |
16 Jun 11 |
nicklas |
355 |
dc.commit(); |
5657 |
16 Jun 11 |
nicklas |
356 |
redirect = viewPage; |
5657 |
16 Jun 11 |
nicklas |
357 |
} |
5657 |
16 Jun 11 |
nicklas |
358 |
else if ("RestoreItems".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
359 |
{ |
5657 |
16 Jun 11 |
nicklas |
360 |
// Restore all selected items on the list page |
7954 |
12 May 21 |
nicklas |
361 |
dc = sc.newDbControl(":Restore "+itemType); |
5657 |
16 Jun 11 |
nicklas |
362 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
363 |
int numTotal = cc.getSelected().size(); |
5657 |
16 Jun 11 |
nicklas |
364 |
int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), false); |
5657 |
16 Jun 11 |
nicklas |
365 |
dc.commit(); |
5657 |
16 Jun 11 |
nicklas |
366 |
if (numTotal != numRemoved) |
5657 |
16 Jun 11 |
nicklas |
367 |
{ |
5657 |
16 Jun 11 |
nicklas |
368 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be restored, because you have no WRITE permission"; |
5657 |
16 Jun 11 |
nicklas |
369 |
} |
6192 |
31 Oct 12 |
nicklas |
370 |
redirect = listPage; |
5657 |
16 Jun 11 |
nicklas |
371 |
} |
5657 |
16 Jun 11 |
nicklas |
372 |
else if ("ShareItem".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
373 |
{ |
5657 |
16 Jun 11 |
nicklas |
374 |
// Display a popup window for sharing a single item |
7954 |
12 May 21 |
nicklas |
375 |
dc = sc.newDbControl(":Share "+itemType); |
5657 |
16 Jun 11 |
nicklas |
376 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
377 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, Collections.singleton(cc.getId())); |
5657 |
16 Jun 11 |
nicklas |
378 |
dc.close(); |
5657 |
16 Jun 11 |
nicklas |
379 |
cc.setObject("MultiPermissions", permissions); |
5657 |
16 Jun 11 |
nicklas |
380 |
redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); |
5657 |
16 Jun 11 |
nicklas |
381 |
} |
5657 |
16 Jun 11 |
nicklas |
382 |
else if ("ShareItems".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
383 |
{ |
5657 |
16 Jun 11 |
nicklas |
384 |
// Display a popup window for sharing all selected items on the list page |
7954 |
12 May 21 |
nicklas |
385 |
dc = sc.newDbControl(":Share "+itemType); |
5657 |
16 Jun 11 |
nicklas |
386 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
387 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, cc.getSelected()); |
5657 |
16 Jun 11 |
nicklas |
388 |
dc.close(); |
5657 |
16 Jun 11 |
nicklas |
389 |
cc.setObject("MultiPermissions", permissions); |
5657 |
16 Jun 11 |
nicklas |
390 |
redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); |
5657 |
16 Jun 11 |
nicklas |
391 |
} |
5657 |
16 Jun 11 |
nicklas |
392 |
else if ("SetOwnerOfItem".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
393 |
{ |
5657 |
16 Jun 11 |
nicklas |
394 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
395 |
dc = sc.newDbControl(":Set owner of "+itemType); |
5657 |
16 Jun 11 |
nicklas |
396 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
397 |
OwnedItem item = (OwnedItem)itemType.getById(dc, cc.getId()); |
5657 |
16 Jun 11 |
nicklas |
398 |
cc.setObject("OwnedItems", Collections.singleton(item)); |
5657 |
16 Jun 11 |
nicklas |
399 |
redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name(); |
5657 |
16 Jun 11 |
nicklas |
400 |
} |
5657 |
16 Jun 11 |
nicklas |
401 |
else if ("SetOwnerOfItems".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
402 |
{ |
5657 |
16 Jun 11 |
nicklas |
403 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
404 |
dc = sc.newDbControl(":Set owner of "+itemType); |
5657 |
16 Jun 11 |
nicklas |
405 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
406 |
Set<OwnedItem> items = new HashSet<OwnedItem>(); |
5657 |
16 Jun 11 |
nicklas |
407 |
for (Integer id : cc.getSelected()) |
5657 |
16 Jun 11 |
nicklas |
408 |
{ |
5657 |
16 Jun 11 |
nicklas |
409 |
if (id != null) items.add((OwnedItem)itemType.getById(dc, id)); |
5657 |
16 Jun 11 |
nicklas |
410 |
} |
5657 |
16 Jun 11 |
nicklas |
411 |
dc.close(); |
5657 |
16 Jun 11 |
nicklas |
412 |
cc.setObject("OwnedItems", items); |
5657 |
16 Jun 11 |
nicklas |
413 |
redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name(); |
5657 |
16 Jun 11 |
nicklas |
414 |
} |
6695 |
28 Jan 15 |
nicklas |
415 |
else if ("InheritAnnotations".equals(cmd)) |
6695 |
28 Jan 15 |
nicklas |
416 |
{ |
6695 |
28 Jan 15 |
nicklas |
417 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
418 |
dc = sc.newDbControl(":Inherit annotations "+itemType); |
6695 |
28 Jan 15 |
nicklas |
419 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
6695 |
28 Jan 15 |
nicklas |
420 |
Set<AnnotatedItem> items = new HashSet<AnnotatedItem>(); |
6695 |
28 Jan 15 |
nicklas |
421 |
for (Integer id : cc.getSelected()) |
6695 |
28 Jan 15 |
nicklas |
422 |
{ |
6695 |
28 Jan 15 |
nicklas |
423 |
if (id != null) items.add((AnnotatedItem)itemType.getById(dc, id)); |
6695 |
28 Jan 15 |
nicklas |
424 |
} |
6695 |
28 Jan 15 |
nicklas |
425 |
dc.close(); |
6695 |
28 Jan 15 |
nicklas |
426 |
cc.setObject("AnnotatedItems", items); |
6695 |
28 Jan 15 |
nicklas |
427 |
redirect = "../../common/annotations/batch_inherit.jsp?ID="+ID+"&item_type="+itemType.name(); |
6695 |
28 Jan 15 |
nicklas |
428 |
} |
5657 |
16 Jun 11 |
nicklas |
429 |
else if ("ExportItems".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
430 |
{ |
5657 |
16 Jun 11 |
nicklas |
431 |
// Run an export plugin in a list context |
5657 |
16 Jun 11 |
nicklas |
432 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5685 |
04 Aug 11 |
nicklas |
433 |
final ItemQuery<DerivedBioAssay> query = DerivedBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
434 |
dc = sc.newDbControl(":Export "+itemType); |
7914 |
23 Feb 21 |
nicklas |
435 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
436 |
cc.configureQuery(dc, query, jspContext, true); |
6040 |
30 Mar 12 |
nicklas |
437 |
cc.setQuery(query); |
6040 |
30 Mar 12 |
nicklas |
438 |
registerExportUtils(cc); |
7604 |
25 Feb 19 |
nicklas |
439 |
ExtensionsInvoker<ListColumnAction<DerivedBioAssay,?>> listInvoker = ListColumnUtil.useExtensions(jspContext); |
7604 |
25 Feb 19 |
nicklas |
440 |
listInvoker.render(new ListColumnExportRenderer<DerivedBioAssay>(cc)); |
5657 |
16 Jun 11 |
nicklas |
441 |
dc.close(); |
5657 |
16 Jun 11 |
nicklas |
442 |
redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+bioassay+sets"; |
5657 |
16 Jun 11 |
nicklas |
443 |
} |
5657 |
16 Jun 11 |
nicklas |
444 |
else if ("ExportItem".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
445 |
{ |
5657 |
16 Jun 11 |
nicklas |
446 |
// Run an export plugin in single-item context |
5657 |
16 Jun 11 |
nicklas |
447 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5685 |
04 Aug 11 |
nicklas |
448 |
registerExportUtils(cc); |
5657 |
16 Jun 11 |
nicklas |
449 |
redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+bioassay+set"; |
5657 |
16 Jun 11 |
nicklas |
450 |
} |
5657 |
16 Jun 11 |
nicklas |
451 |
else if ("ImportItems".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
452 |
{ |
5657 |
16 Jun 11 |
nicklas |
453 |
// Run an import plugin in a list context |
5657 |
16 Jun 11 |
nicklas |
454 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5685 |
04 Aug 11 |
nicklas |
455 |
final ItemQuery<DerivedBioAssay> query = DerivedBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
456 |
dc = sc.newDbControl(":Import "+itemType); |
7914 |
23 Feb 21 |
nicklas |
457 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
458 |
cc.configureQuery(dc, query, jspContext, true); |
5657 |
16 Jun 11 |
nicklas |
459 |
dc.close(); |
5657 |
16 Jun 11 |
nicklas |
460 |
cc.setQuery(query); |
5657 |
16 Jun 11 |
nicklas |
461 |
redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Import+bioassay+sets"; |
5657 |
16 Jun 11 |
nicklas |
462 |
} |
5657 |
16 Jun 11 |
nicklas |
463 |
else if ("ImportItem".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
464 |
{ |
5657 |
16 Jun 11 |
nicklas |
465 |
// Run an import plugin in single-item context |
5657 |
16 Jun 11 |
nicklas |
466 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
467 |
redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Import+bioassay+set"; |
5657 |
16 Jun 11 |
nicklas |
468 |
} |
5657 |
16 Jun 11 |
nicklas |
469 |
else if ("RunListPlugin".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
470 |
{ |
5657 |
16 Jun 11 |
nicklas |
471 |
// Run another plugin in a list context |
5657 |
16 Jun 11 |
nicklas |
472 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5685 |
04 Aug 11 |
nicklas |
473 |
final ItemQuery<DerivedBioAssay> query = DerivedBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
474 |
dc = sc.newDbControl(":Run plugin "+itemType); |
7914 |
23 Feb 21 |
nicklas |
475 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
476 |
cc.configureQuery(dc, query, jspContext, true); |
5657 |
16 Jun 11 |
nicklas |
477 |
dc.close(); |
5657 |
16 Jun 11 |
nicklas |
478 |
cc.setQuery(query); |
5657 |
16 Jun 11 |
nicklas |
479 |
redirect = "../../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&main_type=OTHER&title=Run+plugin"; |
5657 |
16 Jun 11 |
nicklas |
480 |
} |
5657 |
16 Jun 11 |
nicklas |
481 |
else if ("RunPlugin".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
482 |
{ |
5657 |
16 Jun 11 |
nicklas |
483 |
// Run a plugin in single-item context |
5657 |
16 Jun 11 |
nicklas |
484 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
485 |
redirect = "../../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=OTHER&title=Run+plugin"; |
5657 |
16 Jun 11 |
nicklas |
486 |
} |
5657 |
16 Jun 11 |
nicklas |
487 |
else if ("RunAnalysisPlugin".equals(cmd)) |
5657 |
16 Jun 11 |
nicklas |
488 |
{ |
5657 |
16 Jun 11 |
nicklas |
489 |
// Run an analysis plugin in single-item context |
5657 |
16 Jun 11 |
nicklas |
490 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
5657 |
16 Jun 11 |
nicklas |
491 |
redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=ANALYZE&title=Run+analysis+plugin"; |
5657 |
16 Jun 11 |
nicklas |
492 |
} |
6813 |
31 Mar 15 |
nicklas |
493 |
else if ("CreateItemList".equals(cmd)) |
6813 |
31 Mar 15 |
nicklas |
494 |
{ |
6813 |
31 Mar 15 |
nicklas |
495 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
6813 |
31 Mar 15 |
nicklas |
496 |
final ItemQuery<DerivedBioAssay> query = DerivedBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
497 |
dc = sc.newDbControl(":Create "+itemType+" item list"); |
7914 |
23 Feb 21 |
nicklas |
498 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
499 |
cc.configureQuery(dc, query, jspContext, true); |
6813 |
31 Mar 15 |
nicklas |
500 |
dc.close(); |
6813 |
31 Mar 15 |
nicklas |
501 |
cc.setQuery(query); |
6813 |
31 Mar 15 |
nicklas |
502 |
redirect = "../../views/itemlists/index.jsp?ID="+ID+"&cmd=NewItem&addItems=1&memberType=DERIVEDBIOASSAY&formId=bioassays"; |
6813 |
31 Mar 15 |
nicklas |
503 |
} |
7813 |
19 May 20 |
nicklas |
504 |
else if ("AddItemsToList".equals(cmd)) |
7813 |
19 May 20 |
nicklas |
505 |
{ |
7813 |
19 May 20 |
nicklas |
506 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
7813 |
19 May 20 |
nicklas |
507 |
final ItemQuery<DerivedBioAssay> query = DerivedBioAssay.getQuery(); |
7954 |
12 May 21 |
nicklas |
508 |
dc = sc.newDbControl(":Add to "+itemType+" item list"); |
7914 |
23 Feb 21 |
nicklas |
509 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
510 |
cc.configureQuery(dc, query, jspContext, true); |
7813 |
19 May 20 |
nicklas |
511 |
dc.close(); |
7813 |
19 May 20 |
nicklas |
512 |
cc.setQuery(query); |
7813 |
19 May 20 |
nicklas |
513 |
redirect = "../../views/itemlists/add_items.jsp?ID="+ID+"&memberType=DERIVEDBIOASSAY&formId=bioassays"; |
7813 |
19 May 20 |
nicklas |
514 |
} |
6082 |
14 Aug 12 |
nicklas |
515 |
else if ("NewMergedDerivedBioAssay".equals(cmd)) |
6082 |
14 Aug 12 |
nicklas |
516 |
{ |
6082 |
14 Aug 12 |
nicklas |
517 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
6082 |
14 Aug 12 |
nicklas |
518 |
cc.setId(0); |
6082 |
14 Aug 12 |
nicklas |
519 |
forward = editPage + "&useParents=DERIVEDBIOASSAY"; |
6082 |
14 Aug 12 |
nicklas |
520 |
} |
5657 |
16 Jun 11 |
nicklas |
521 |
else |
5657 |
16 Jun 11 |
nicklas |
522 |
{ |
5657 |
16 Jun 11 |
nicklas |
523 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
5657 |
16 Jun 11 |
nicklas |
524 |
} |
5657 |
16 Jun 11 |
nicklas |
525 |
} |
5657 |
16 Jun 11 |
nicklas |
526 |
finally |
5657 |
16 Jun 11 |
nicklas |
527 |
{ |
5657 |
16 Jun 11 |
nicklas |
528 |
if (dc != null) dc.close(); |
5657 |
16 Jun 11 |
nicklas |
529 |
} |
5657 |
16 Jun 11 |
nicklas |
530 |
|
5657 |
16 Jun 11 |
nicklas |
531 |
if (forward != null) |
5657 |
16 Jun 11 |
nicklas |
532 |
{ |
6192 |
31 Oct 12 |
nicklas |
533 |
sc.setSessionSetting("alert-message", message); |
5657 |
16 Jun 11 |
nicklas |
534 |
pageContext.forward(forward); |
5657 |
16 Jun 11 |
nicklas |
535 |
} |
5657 |
16 Jun 11 |
nicklas |
536 |
else if (redirect != null) |
5657 |
16 Jun 11 |
nicklas |
537 |
{ |
6192 |
31 Oct 12 |
nicklas |
538 |
sc.setSessionSetting("alert-message", message); |
5657 |
16 Jun 11 |
nicklas |
539 |
response.sendRedirect(redirect); |
5657 |
16 Jun 11 |
nicklas |
540 |
} |
5657 |
16 Jun 11 |
nicklas |
541 |
else if (message == null) |
5657 |
16 Jun 11 |
nicklas |
542 |
{ |
5657 |
16 Jun 11 |
nicklas |
543 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
5657 |
16 Jun 11 |
nicklas |
544 |
} |
5657 |
16 Jun 11 |
nicklas |
545 |
else |
5657 |
16 Jun 11 |
nicklas |
546 |
{ |
5657 |
16 Jun 11 |
nicklas |
547 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
5657 |
16 Jun 11 |
nicklas |
548 |
} |
5657 |
16 Jun 11 |
nicklas |
549 |
%> |
5657 |
16 Jun 11 |
nicklas |
550 |
|