2149 |
04 Apr 06 |
nicklas |
1 |
<%-- $Id$ |
2149 |
04 Apr 06 |
nicklas |
2 |
------------------------------------------------------------------ |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
2149 |
04 Apr 06 |
nicklas |
4 |
|
2304 |
22 May 06 |
jari |
5 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
6 |
Available at http://base.thep.lu.se/ |
2149 |
04 Apr 06 |
nicklas |
7 |
|
2149 |
04 Apr 06 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
2149 |
04 Apr 06 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
10 |
as published by the Free Software Foundation; either version 3 |
2149 |
04 Apr 06 |
nicklas |
11 |
of the License, or (at your option) any later version. |
2149 |
04 Apr 06 |
nicklas |
12 |
|
2149 |
04 Apr 06 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
2149 |
04 Apr 06 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2149 |
04 Apr 06 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2149 |
04 Apr 06 |
nicklas |
16 |
GNU General Public License for more details. |
2149 |
04 Apr 06 |
nicklas |
17 |
|
2149 |
04 Apr 06 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
4511 |
11 Sep 08 |
jari |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
2149 |
04 Apr 06 |
nicklas |
20 |
------------------------------------------------------------------ |
2149 |
04 Apr 06 |
nicklas |
21 |
|
2149 |
04 Apr 06 |
nicklas |
22 |
@author Nicklas |
2149 |
04 Apr 06 |
nicklas |
23 |
@version 2.0 |
2149 |
04 Apr 06 |
nicklas |
24 |
--%> |
6315 |
06 Sep 13 |
nicklas |
25 |
<%@page import="net.sf.basedb.core.ClonableProperty"%> |
6315 |
06 Sep 13 |
nicklas |
26 |
<%@page import="net.sf.basedb.core.VirtualColumn"%> |
6315 |
06 Sep 13 |
nicklas |
27 |
<%@page import="net.sf.basedb.core.query.Dynamic"%> |
5426 |
24 Sep 10 |
nicklas |
28 |
<%@ page pageEncoding="UTF-8" session="false" |
2149 |
04 Apr 06 |
nicklas |
29 |
import="net.sf.basedb.core.SessionControl" |
2149 |
04 Apr 06 |
nicklas |
30 |
import="net.sf.basedb.core.DbControl" |
2149 |
04 Apr 06 |
nicklas |
31 |
import="net.sf.basedb.core.Item" |
2149 |
04 Apr 06 |
nicklas |
32 |
import="net.sf.basedb.core.Include" |
2149 |
04 Apr 06 |
nicklas |
33 |
import="net.sf.basedb.core.ReporterList" |
4306 |
21 May 08 |
nicklas |
34 |
import="net.sf.basedb.core.Reporter" |
2149 |
04 Apr 06 |
nicklas |
35 |
import="net.sf.basedb.core.Permission" |
2428 |
27 Jun 06 |
nicklas |
36 |
import="net.sf.basedb.core.Type" |
2149 |
04 Apr 06 |
nicklas |
37 |
import="net.sf.basedb.core.ItemContext" |
2428 |
27 Jun 06 |
nicklas |
38 |
import="net.sf.basedb.core.DataQuery" |
2149 |
04 Apr 06 |
nicklas |
39 |
import="net.sf.basedb.core.ItemQuery" |
5897 |
02 Dec 11 |
nicklas |
40 |
import="net.sf.basedb.core.query.SqlQuery" |
2428 |
27 Jun 06 |
nicklas |
41 |
import="net.sf.basedb.core.DataResultIterator" |
4306 |
21 May 08 |
nicklas |
42 |
import="net.sf.basedb.core.DynamicResultIterator" |
2149 |
04 Apr 06 |
nicklas |
43 |
import="net.sf.basedb.core.MultiPermissions" |
4587 |
15 Oct 08 |
martin |
44 |
import="net.sf.basedb.core.OwnedItem" |
2149 |
04 Apr 06 |
nicklas |
45 |
import="net.sf.basedb.core.PermissionDeniedException" |
2149 |
04 Apr 06 |
nicklas |
46 |
import="net.sf.basedb.core.ItemAlreadyExistsException" |
2428 |
27 Jun 06 |
nicklas |
47 |
import="net.sf.basedb.core.data.ReporterData" |
4306 |
21 May 08 |
nicklas |
48 |
import="net.sf.basedb.core.query.Query" |
2428 |
27 Jun 06 |
nicklas |
49 |
import="net.sf.basedb.core.query.Restrictions" |
2428 |
27 Jun 06 |
nicklas |
50 |
import="net.sf.basedb.core.query.Expressions" |
6315 |
06 Sep 13 |
nicklas |
51 |
import="net.sf.basedb.core.query.Expression" |
2428 |
27 Jun 06 |
nicklas |
52 |
import="net.sf.basedb.core.query.Hql" |
4306 |
21 May 08 |
nicklas |
53 |
import="net.sf.basedb.core.query.SqlResult" |
2149 |
04 Apr 06 |
nicklas |
54 |
import="net.sf.basedb.util.RemovableUtil" |
2149 |
04 Apr 06 |
nicklas |
55 |
import="net.sf.basedb.util.ShareableUtil" |
2918 |
15 Nov 06 |
nicklas |
56 |
import="net.sf.basedb.util.OwnableUtil" |
2149 |
04 Apr 06 |
nicklas |
57 |
import="net.sf.basedb.clients.web.Base" |
2149 |
04 Apr 06 |
nicklas |
58 |
import="net.sf.basedb.clients.web.WebException" |
2753 |
20 Oct 06 |
nicklas |
59 |
import="net.sf.basedb.util.Values" |
5711 |
30 Aug 11 |
nicklas |
60 |
import="net.sf.basedb.clients.web.ExperimentExplorer" |
2149 |
04 Apr 06 |
nicklas |
61 |
import="net.sf.basedb.clients.web.util.HTML" |
5501 |
18 Nov 10 |
nicklas |
62 |
import="net.sf.basedb.core.plugin.GuiContext" |
5501 |
18 Nov 10 |
nicklas |
63 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
5501 |
18 Nov 10 |
nicklas |
64 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5501 |
18 Nov 10 |
nicklas |
65 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5501 |
18 Nov 10 |
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" |
5501 |
18 Nov 10 |
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" |
2149 |
04 Apr 06 |
nicklas |
72 |
import="java.util.Enumeration" |
2149 |
04 Apr 06 |
nicklas |
73 |
import="java.util.Set" |
2149 |
04 Apr 06 |
nicklas |
74 |
import="java.util.HashSet" |
2149 |
04 Apr 06 |
nicklas |
75 |
import="java.util.List" |
2149 |
04 Apr 06 |
nicklas |
76 |
import="java.util.ArrayList" |
2149 |
04 Apr 06 |
nicklas |
77 |
import="java.util.Collections" |
2149 |
04 Apr 06 |
nicklas |
78 |
import="java.util.Arrays" |
2149 |
04 Apr 06 |
nicklas |
79 |
%> |
2149 |
04 Apr 06 |
nicklas |
80 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
2149 |
04 Apr 06 |
nicklas |
81 |
<%! |
2149 |
04 Apr 06 |
nicklas |
82 |
private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,externalId,description"); |
2149 |
04 Apr 06 |
nicklas |
83 |
private static final Item itemType = Item.REPORTERLIST; |
2149 |
04 Apr 06 |
nicklas |
84 |
%> |
2149 |
04 Apr 06 |
nicklas |
85 |
<% |
2149 |
04 Apr 06 |
nicklas |
86 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
2149 |
04 Apr 06 |
nicklas |
87 |
final String ID = sc.getId(); |
2149 |
04 Apr 06 |
nicklas |
88 |
final String cmd = request.getParameter("cmd"); |
2149 |
04 Apr 06 |
nicklas |
89 |
final String root = request.getContextPath()+"/"; |
2149 |
04 Apr 06 |
nicklas |
90 |
final String mode = request.getParameter("mode"); |
2149 |
04 Apr 06 |
nicklas |
91 |
final String callback = request.getParameter("callback"); |
2149 |
04 Apr 06 |
nicklas |
92 |
final String itemId = request.getParameter("item_id"); |
2149 |
04 Apr 06 |
nicklas |
93 |
final String listPage = "list_reporterlists.jsp?ID="+ID |
2149 |
04 Apr 06 |
nicklas |
94 |
+(mode == null ? "" : "&mode="+mode) |
2149 |
04 Apr 06 |
nicklas |
95 |
+(callback == null ? "" : "&callback="+callback) |
2149 |
04 Apr 06 |
nicklas |
96 |
+(itemId == null ? "" : "&item_id="+itemId); |
2149 |
04 Apr 06 |
nicklas |
97 |
final String viewPage = "view_reporterlist.jsp?ID="+ID; |
2149 |
04 Apr 06 |
nicklas |
98 |
final String editPage = "edit_reporterlist.jsp?ID="+ID; |
2149 |
04 Apr 06 |
nicklas |
99 |
|
2149 |
04 Apr 06 |
nicklas |
100 |
String forward = null; |
2149 |
04 Apr 06 |
nicklas |
101 |
String redirect = null; |
2149 |
04 Apr 06 |
nicklas |
102 |
String message = null; |
2149 |
04 Apr 06 |
nicklas |
103 |
DbControl dc = null; |
2149 |
04 Apr 06 |
nicklas |
104 |
|
2149 |
04 Apr 06 |
nicklas |
105 |
try |
2149 |
04 Apr 06 |
nicklas |
106 |
{ |
2149 |
04 Apr 06 |
nicklas |
107 |
if (cmd == null || "List".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
108 |
{ |
2149 |
04 Apr 06 |
nicklas |
109 |
// Display the list page without updatinging the current context |
2811 |
26 Oct 06 |
nicklas |
110 |
Base.getAndSetCurrentContext(sc, itemType, null, defaultContext, true); |
2149 |
04 Apr 06 |
nicklas |
111 |
redirect = listPage; |
2149 |
04 Apr 06 |
nicklas |
112 |
} |
2149 |
04 Apr 06 |
nicklas |
113 |
else if ("UpdateContext".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
114 |
{ |
2149 |
04 Apr 06 |
nicklas |
115 |
// Display the list page after updating the current context from the request parameters |
2149 |
04 Apr 06 |
nicklas |
116 |
Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
117 |
redirect = listPage; |
2149 |
04 Apr 06 |
nicklas |
118 |
} |
2149 |
04 Apr 06 |
nicklas |
119 |
else if ("LoadContext".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
120 |
{ |
2149 |
04 Apr 06 |
nicklas |
121 |
// Display the list page after loading a saved context |
2149 |
04 Apr 06 |
nicklas |
122 |
int contextId = Values.getInt(request.getParameter("context")); |
2149 |
04 Apr 06 |
nicklas |
123 |
Base.loadContext(sc, contextId, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
124 |
redirect = listPage; |
2149 |
04 Apr 06 |
nicklas |
125 |
} |
2149 |
04 Apr 06 |
nicklas |
126 |
|
2149 |
04 Apr 06 |
nicklas |
127 |
else if ("ViewItem".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
128 |
{ |
2149 |
04 Apr 06 |
nicklas |
129 |
// Display the view page for a single item |
2149 |
04 Apr 06 |
nicklas |
130 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
131 |
forward = viewPage; |
2149 |
04 Apr 06 |
nicklas |
132 |
} |
2149 |
04 Apr 06 |
nicklas |
133 |
else if ("EditItem".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
134 |
{ |
2149 |
04 Apr 06 |
nicklas |
135 |
// Display the edit page for a single item (should be opened in a popup) |
2149 |
04 Apr 06 |
nicklas |
136 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
137 |
redirect = editPage; |
2149 |
04 Apr 06 |
nicklas |
138 |
} |
2149 |
04 Apr 06 |
nicklas |
139 |
else if ("NewItem".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
140 |
{ |
2149 |
04 Apr 06 |
nicklas |
141 |
// Display the edit page for a new item (should be opened in a popup) |
2149 |
04 Apr 06 |
nicklas |
142 |
if (!sc.hasPermission(Permission.CREATE, itemType)) |
2149 |
04 Apr 06 |
nicklas |
143 |
{ |
2149 |
04 Apr 06 |
nicklas |
144 |
throw new PermissionDeniedException(Permission.CREATE, itemType.toString()); |
2149 |
04 Apr 06 |
nicklas |
145 |
} |
2149 |
04 Apr 06 |
nicklas |
146 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
147 |
cc.setId(0); |
2428 |
27 Jun 06 |
nicklas |
148 |
forward = editPage; |
2149 |
04 Apr 06 |
nicklas |
149 |
} |
2149 |
04 Apr 06 |
nicklas |
150 |
else if ("UpdateItem".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
151 |
{ |
2149 |
04 Apr 06 |
nicklas |
152 |
// Update the properties on an item (will close the popup) |
2149 |
04 Apr 06 |
nicklas |
153 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext); |
7954 |
12 May 21 |
nicklas |
154 |
dc = sc.newDbControl(":Edit "+itemType); |
7605 |
26 Feb 19 |
nicklas |
155 |
ReporterList rl = cc.getObject("item"); |
2149 |
04 Apr 06 |
nicklas |
156 |
if (rl == null) |
2149 |
04 Apr 06 |
nicklas |
157 |
{ |
2149 |
04 Apr 06 |
nicklas |
158 |
rl = ReporterList.getNew(dc); |
2149 |
04 Apr 06 |
nicklas |
159 |
dc.saveItem(rl); |
2428 |
27 Jun 06 |
nicklas |
160 |
|
4301 |
16 May 08 |
nicklas |
161 |
// Add individual reporters to the list |
2428 |
27 Jun 06 |
nicklas |
162 |
String which = request.getParameter("which"); |
2428 |
27 Jun 06 |
nicklas |
163 |
if (which != null) |
2428 |
27 Jun 06 |
nicklas |
164 |
{ |
4305 |
21 May 08 |
nicklas |
165 |
Item fromContext = Item.valueOf(request.getParameter("fromContext")); |
4305 |
21 May 08 |
nicklas |
166 |
String subContext = Values.getString(request.getParameter("subContext"), ""); |
5711 |
30 Aug 11 |
nicklas |
167 |
ItemContext reporterContext = sc.getCurrentContext(fromContext, subContext); |
5711 |
30 Aug 11 |
nicklas |
168 |
Query query = reporterContext.getQuery(); |
5711 |
30 Aug 11 |
nicklas |
169 |
Object listCreator = reporterContext.getObject("reporter-list-creator"); |
5711 |
30 Aug 11 |
nicklas |
170 |
if (query != null) |
2428 |
27 Jun 06 |
nicklas |
171 |
{ |
5711 |
30 Aug 11 |
nicklas |
172 |
if ("all".equals(which)) |
4306 |
21 May 08 |
nicklas |
173 |
{ |
5711 |
30 Aug 11 |
nicklas |
174 |
query.setFirstResult(0); |
5711 |
30 Aug 11 |
nicklas |
175 |
query.setMaxResults(-1); |
4306 |
21 May 08 |
nicklas |
176 |
} |
5711 |
30 Aug 11 |
nicklas |
177 |
else if ("selected".equals(which)) |
4306 |
21 May 08 |
nicklas |
178 |
{ |
5711 |
30 Aug 11 |
nicklas |
179 |
query.setFirstResult(0); |
5711 |
30 Aug 11 |
nicklas |
180 |
query.setMaxResults(-1); |
6315 |
06 Sep 13 |
nicklas |
181 |
Expression idCol = query instanceof SqlQuery ? |
6315 |
06 Sep 13 |
nicklas |
182 |
Dynamic.column(VirtualColumn.clonableProperty(ClonableProperty.createFromRegular("id"))) |
6315 |
06 Sep 13 |
nicklas |
183 |
: |
6315 |
06 Sep 13 |
nicklas |
184 |
Hql.property("id"); |
5711 |
30 Aug 11 |
nicklas |
185 |
Integer[] itemIds = Values.getInt(request.getParameter("items").split(",")); |
5711 |
30 Aug 11 |
nicklas |
186 |
query.restrict( |
6315 |
06 Sep 13 |
nicklas |
187 |
Restrictions.in(idCol, Expressions.parameter("_selected_")) |
5711 |
30 Aug 11 |
nicklas |
188 |
); |
5711 |
30 Aug 11 |
nicklas |
189 |
query.setParameter("_selected_", Arrays.asList(itemIds), Type.INT); |
5711 |
30 Aug 11 |
nicklas |
190 |
} |
5711 |
30 Aug 11 |
nicklas |
191 |
// else -- no modifications to the query mean that we only get the current page |
5711 |
30 Aug 11 |
nicklas |
192 |
|
5711 |
30 Aug 11 |
nicklas |
193 |
if (query instanceof DataQuery) |
5711 |
30 Aug 11 |
nicklas |
194 |
{ |
7605 |
26 Feb 19 |
nicklas |
195 |
DataQuery<ReporterData> dataQuery = reporterContext.getQuery(); |
7605 |
26 Feb 19 |
nicklas |
196 |
DataResultIterator<ReporterData> result = dataQuery.iterate(dc); |
5711 |
30 Aug 11 |
nicklas |
197 |
while (result.hasNext()) |
4306 |
21 May 08 |
nicklas |
198 |
{ |
5711 |
30 Aug 11 |
nicklas |
199 |
ReporterData reporter = result.next(); |
5711 |
30 Aug 11 |
nicklas |
200 |
if (reporter != null) rl.addReporter(reporter, null); |
4306 |
21 May 08 |
nicklas |
201 |
} |
4306 |
21 May 08 |
nicklas |
202 |
} |
5897 |
02 Dec 11 |
nicklas |
203 |
else if (query instanceof SqlQuery) |
5711 |
30 Aug 11 |
nicklas |
204 |
{ |
5897 |
02 Dec 11 |
nicklas |
205 |
DynamicResultIterator result = ((SqlQuery)query).iterate(dc); |
5711 |
30 Aug 11 |
nicklas |
206 |
while (result.hasNext()) |
5711 |
30 Aug 11 |
nicklas |
207 |
{ |
5711 |
30 Aug 11 |
nicklas |
208 |
SqlResult i = result.next(); |
5711 |
30 Aug 11 |
nicklas |
209 |
int reporterId = i.getInt(1); |
5711 |
30 Aug 11 |
nicklas |
210 |
if (reporterId != 0) |
5711 |
30 Aug 11 |
nicklas |
211 |
{ |
5711 |
30 Aug 11 |
nicklas |
212 |
rl.addReporter(Reporter.getProxy(reporterId), null); |
5711 |
30 Aug 11 |
nicklas |
213 |
} |
5711 |
30 Aug 11 |
nicklas |
214 |
} |
5711 |
30 Aug 11 |
nicklas |
215 |
} |
4306 |
21 May 08 |
nicklas |
216 |
} |
5711 |
30 Aug 11 |
nicklas |
217 |
else if (listCreator instanceof ExperimentExplorer) |
5711 |
30 Aug 11 |
nicklas |
218 |
{ |
5711 |
30 Aug 11 |
nicklas |
219 |
// Special case when creating reporter list from experiment explorer |
5711 |
30 Aug 11 |
nicklas |
220 |
// since the desired reporter id:s are already cached |
5711 |
30 Aug 11 |
nicklas |
221 |
ExperimentExplorer explorer = (ExperimentExplorer)listCreator; |
5711 |
30 Aug 11 |
nicklas |
222 |
int start = 0; |
5711 |
30 Aug 11 |
nicklas |
223 |
int end = 0; |
5711 |
30 Aug 11 |
nicklas |
224 |
int totalReporters = explorer.getMatchingReporters(dc); |
5711 |
30 Aug 11 |
nicklas |
225 |
if ("all".equals(which)) |
5711 |
30 Aug 11 |
nicklas |
226 |
{ |
5711 |
30 Aug 11 |
nicklas |
227 |
end = totalReporters; |
5711 |
30 Aug 11 |
nicklas |
228 |
} |
5711 |
30 Aug 11 |
nicklas |
229 |
else |
5711 |
30 Aug 11 |
nicklas |
230 |
{ |
5711 |
30 Aug 11 |
nicklas |
231 |
start = reporterContext.getPage() * reporterContext.getRowsPerPage(); |
5711 |
30 Aug 11 |
nicklas |
232 |
end = start + reporterContext.getRowsPerPage(); |
5711 |
30 Aug 11 |
nicklas |
233 |
} |
5711 |
30 Aug 11 |
nicklas |
234 |
|
5711 |
30 Aug 11 |
nicklas |
235 |
for (int index = start; index < end && index < totalReporters; ++index) |
5711 |
30 Aug 11 |
nicklas |
236 |
{ |
5711 |
30 Aug 11 |
nicklas |
237 |
rl.addReporter(Reporter.getProxy(explorer.getReporterId(index)), null); |
5711 |
30 Aug 11 |
nicklas |
238 |
} |
5711 |
30 Aug 11 |
nicklas |
239 |
} |
2428 |
27 Jun 06 |
nicklas |
240 |
} |
4301 |
16 May 08 |
nicklas |
241 |
|
4301 |
16 May 08 |
nicklas |
242 |
// Add reporters from other lists |
4301 |
16 May 08 |
nicklas |
243 |
String create = Values.getStringOrNull(request.getParameter("create")); |
4301 |
16 May 08 |
nicklas |
244 |
if (create != null) |
4301 |
16 May 08 |
nicklas |
245 |
{ |
4301 |
16 May 08 |
nicklas |
246 |
List<ReporterList> lists = new ArrayList<ReporterList>(cc.getSelected().size()); |
4301 |
16 May 08 |
nicklas |
247 |
for (int listId : cc.getSelected()) |
4301 |
16 May 08 |
nicklas |
248 |
{ |
4301 |
16 May 08 |
nicklas |
249 |
lists.add(ReporterList.getById(dc, listId)); |
4301 |
16 May 08 |
nicklas |
250 |
} |
4301 |
16 May 08 |
nicklas |
251 |
if ("union".equals(create)) |
4301 |
16 May 08 |
nicklas |
252 |
{ |
4301 |
16 May 08 |
nicklas |
253 |
rl.addUnion(lists); |
4301 |
16 May 08 |
nicklas |
254 |
} |
4301 |
16 May 08 |
nicklas |
255 |
else if ("intersection".equals(create)) |
4301 |
16 May 08 |
nicklas |
256 |
{ |
4301 |
16 May 08 |
nicklas |
257 |
rl.addIntersection(lists); |
4301 |
16 May 08 |
nicklas |
258 |
} |
4301 |
16 May 08 |
nicklas |
259 |
else if ("count".equals(create)) |
4301 |
16 May 08 |
nicklas |
260 |
{ |
4301 |
16 May 08 |
nicklas |
261 |
int minCount = Values.getInt(request.getParameter("minCount"), 1); |
4301 |
16 May 08 |
nicklas |
262 |
rl.addIfPresentIn(minCount, lists.size(), lists); |
4301 |
16 May 08 |
nicklas |
263 |
} |
4301 |
16 May 08 |
nicklas |
264 |
} |
4305 |
21 May 08 |
nicklas |
265 |
message = "Reporter list created with " + rl.getSize() + " reporter(s)"; |
2149 |
04 Apr 06 |
nicklas |
266 |
} |
2149 |
04 Apr 06 |
nicklas |
267 |
else |
2149 |
04 Apr 06 |
nicklas |
268 |
{ |
5060 |
19 Aug 09 |
nicklas |
269 |
dc.reattachItem(rl, false); |
2149 |
04 Apr 06 |
nicklas |
270 |
message = "Reporter list updated"; |
2149 |
04 Apr 06 |
nicklas |
271 |
} |
5501 |
18 Nov 10 |
nicklas |
272 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(Item.REPORTERLIST), rl); |
7604 |
25 Feb 19 |
nicklas |
273 |
ExtensionsInvoker<OnSaveAction> invoker = EditUtil.useOnSaveExtensions(jspContext); |
5501 |
18 Nov 10 |
nicklas |
274 |
try |
5501 |
18 Nov 10 |
nicklas |
275 |
{ |
5501 |
18 Nov 10 |
nicklas |
276 |
rl.setName(Values.getStringOrNull(request.getParameter("name"))); |
5501 |
18 Nov 10 |
nicklas |
277 |
rl.setExternalId(Values.getStringOrNull(request.getParameter("external_id"))); |
5501 |
18 Nov 10 |
nicklas |
278 |
rl.setDescription(Values.getStringOrNull(request.getParameter("description"))); |
5501 |
18 Nov 10 |
nicklas |
279 |
|
5501 |
18 Nov 10 |
nicklas |
280 |
// OnSave extensions |
5501 |
18 Nov 10 |
nicklas |
281 |
invoker.render(OnSaveRenderer.ON_SAVE); |
5501 |
18 Nov 10 |
nicklas |
282 |
dc.commit(); |
5501 |
18 Nov 10 |
nicklas |
283 |
invoker.render(OnSaveRenderer.ON_COMMIT); |
5501 |
18 Nov 10 |
nicklas |
284 |
} |
5501 |
18 Nov 10 |
nicklas |
285 |
catch (Exception ex) |
5501 |
18 Nov 10 |
nicklas |
286 |
{ |
5501 |
18 Nov 10 |
nicklas |
287 |
invoker.render(OnSaveRenderer.onRollback(ex)); |
5501 |
18 Nov 10 |
nicklas |
288 |
throw ex; |
5501 |
18 Nov 10 |
nicklas |
289 |
} |
5501 |
18 Nov 10 |
nicklas |
290 |
finally |
5501 |
18 Nov 10 |
nicklas |
291 |
{ |
5501 |
18 Nov 10 |
nicklas |
292 |
cc.removeObject("item"); |
5501 |
18 Nov 10 |
nicklas |
293 |
} |
2149 |
04 Apr 06 |
nicklas |
294 |
} |
2149 |
04 Apr 06 |
nicklas |
295 |
else if ("DeleteItem".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
296 |
{ |
2149 |
04 Apr 06 |
nicklas |
297 |
// Delete a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
298 |
dc = sc.newDbControl(":Delete "+itemType); |
2149 |
04 Apr 06 |
nicklas |
299 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
300 |
RemovableUtil.setRemoved(dc, itemType, Collections.singleton(cc.getId()), true); |
2149 |
04 Apr 06 |
nicklas |
301 |
dc.commit(); |
2149 |
04 Apr 06 |
nicklas |
302 |
redirect = viewPage; |
2149 |
04 Apr 06 |
nicklas |
303 |
} |
2149 |
04 Apr 06 |
nicklas |
304 |
else if ("DeleteItems".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
305 |
{ |
2149 |
04 Apr 06 |
nicklas |
306 |
// Delete all selected items on the list page |
7954 |
12 May 21 |
nicklas |
307 |
dc = sc.newDbControl(":Delete "+itemType); |
2149 |
04 Apr 06 |
nicklas |
308 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
309 |
int numTotal = cc.getSelected().size(); |
2149 |
04 Apr 06 |
nicklas |
310 |
int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), true); |
2149 |
04 Apr 06 |
nicklas |
311 |
dc.commit(); |
2149 |
04 Apr 06 |
nicklas |
312 |
if (numTotal != numRemoved) |
2149 |
04 Apr 06 |
nicklas |
313 |
{ |
2149 |
04 Apr 06 |
nicklas |
314 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission"; |
2149 |
04 Apr 06 |
nicklas |
315 |
} |
6192 |
31 Oct 12 |
nicklas |
316 |
redirect = listPage; |
2149 |
04 Apr 06 |
nicklas |
317 |
} |
2149 |
04 Apr 06 |
nicklas |
318 |
else if ("RestoreItem".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
319 |
{ |
2149 |
04 Apr 06 |
nicklas |
320 |
// Restore a single item and then return to the view page |
7954 |
12 May 21 |
nicklas |
321 |
dc = sc.newDbControl(":Restore "+itemType); |
2149 |
04 Apr 06 |
nicklas |
322 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
323 |
RemovableUtil.setRemoved(dc, itemType, Collections.singleton(cc.getId()), false); |
2149 |
04 Apr 06 |
nicklas |
324 |
dc.commit(); |
2149 |
04 Apr 06 |
nicklas |
325 |
redirect = viewPage; |
2149 |
04 Apr 06 |
nicklas |
326 |
} |
2149 |
04 Apr 06 |
nicklas |
327 |
else if ("RestoreItems".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
328 |
{ |
2149 |
04 Apr 06 |
nicklas |
329 |
// Restore all selected items on the list page |
7954 |
12 May 21 |
nicklas |
330 |
dc = sc.newDbControl(":Restore "+itemType); |
2149 |
04 Apr 06 |
nicklas |
331 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
332 |
int numTotal = cc.getSelected().size(); |
2149 |
04 Apr 06 |
nicklas |
333 |
int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), false); |
2149 |
04 Apr 06 |
nicklas |
334 |
dc.commit(); |
2149 |
04 Apr 06 |
nicklas |
335 |
if (numTotal != numRemoved) |
2149 |
04 Apr 06 |
nicklas |
336 |
{ |
2528 |
15 Aug 06 |
martin |
337 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be restored, because you have no WRITE permission"; |
2149 |
04 Apr 06 |
nicklas |
338 |
} |
6192 |
31 Oct 12 |
nicklas |
339 |
redirect = listPage; |
2149 |
04 Apr 06 |
nicklas |
340 |
} |
2149 |
04 Apr 06 |
nicklas |
341 |
else if ("ShareItem".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
342 |
{ |
2149 |
04 Apr 06 |
nicklas |
343 |
// Display a popup window for sharing a single item |
7954 |
12 May 21 |
nicklas |
344 |
dc = sc.newDbControl(":Share "+itemType); |
2149 |
04 Apr 06 |
nicklas |
345 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
346 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, Collections.singleton(cc.getId())); |
2149 |
04 Apr 06 |
nicklas |
347 |
dc.close(); |
2149 |
04 Apr 06 |
nicklas |
348 |
cc.setObject("MultiPermissions", permissions); |
2149 |
04 Apr 06 |
nicklas |
349 |
redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); |
2149 |
04 Apr 06 |
nicklas |
350 |
} |
2149 |
04 Apr 06 |
nicklas |
351 |
else if ("ShareItems".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
352 |
{ |
2149 |
04 Apr 06 |
nicklas |
353 |
// Display a popup window for sharing all selected items on the list page |
7954 |
12 May 21 |
nicklas |
354 |
dc = sc.newDbControl(":Share "+itemType); |
2149 |
04 Apr 06 |
nicklas |
355 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
356 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, cc.getSelected()); |
2149 |
04 Apr 06 |
nicklas |
357 |
dc.close(); |
2149 |
04 Apr 06 |
nicklas |
358 |
cc.setObject("MultiPermissions", permissions); |
2149 |
04 Apr 06 |
nicklas |
359 |
redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); |
2149 |
04 Apr 06 |
nicklas |
360 |
} |
4578 |
13 Oct 08 |
martin |
361 |
else if ("SetOwnerOfItem".equals(cmd)) |
2918 |
15 Nov 06 |
nicklas |
362 |
{ |
4578 |
13 Oct 08 |
martin |
363 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
364 |
dc = sc.newDbControl(":Set owner of "+itemType); |
2918 |
15 Nov 06 |
nicklas |
365 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4587 |
15 Oct 08 |
martin |
366 |
OwnedItem item = (OwnedItem)itemType.getById(dc, cc.getId()); |
4587 |
15 Oct 08 |
martin |
367 |
cc.setObject("OwnedItems", Collections.singleton(item)); |
4578 |
13 Oct 08 |
martin |
368 |
redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name(); |
2918 |
15 Nov 06 |
nicklas |
369 |
} |
4578 |
13 Oct 08 |
martin |
370 |
else if ("SetOwnerOfItems".equals(cmd)) |
2918 |
15 Nov 06 |
nicklas |
371 |
{ |
4578 |
13 Oct 08 |
martin |
372 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
373 |
dc = sc.newDbControl(":Set owner of "+itemType); |
2918 |
15 Nov 06 |
nicklas |
374 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
4587 |
15 Oct 08 |
martin |
375 |
Set<OwnedItem> items = new HashSet<OwnedItem>(); |
4587 |
15 Oct 08 |
martin |
376 |
for (Integer id : cc.getSelected()) |
4587 |
15 Oct 08 |
martin |
377 |
{ |
4587 |
15 Oct 08 |
martin |
378 |
if (id != null) items.add((OwnedItem)itemType.getById(dc, id)); |
4587 |
15 Oct 08 |
martin |
379 |
} |
4587 |
15 Oct 08 |
martin |
380 |
dc.close(); |
4587 |
15 Oct 08 |
martin |
381 |
cc.setObject("OwnedItems", items); |
4578 |
13 Oct 08 |
martin |
382 |
redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name(); |
2918 |
15 Nov 06 |
nicklas |
383 |
} |
2149 |
04 Apr 06 |
nicklas |
384 |
else if ("ExportItems".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
385 |
{ |
2149 |
04 Apr 06 |
nicklas |
386 |
// Run an export plugin in a list context |
2149 |
04 Apr 06 |
nicklas |
387 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
388 |
final ItemQuery<ReporterList> query = ReporterList.getQuery(); |
7954 |
12 May 21 |
nicklas |
389 |
dc = sc.newDbControl(":Export "+itemType); |
7914 |
23 Feb 21 |
nicklas |
390 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
391 |
cc.configureQuery(dc, query, jspContext, true); |
6040 |
30 Mar 12 |
nicklas |
392 |
cc.setQuery(query); |
7604 |
25 Feb 19 |
nicklas |
393 |
ExtensionsInvoker<ListColumnAction<ReporterList,?>> listInvoker = ListColumnUtil.useExtensions(jspContext); |
7604 |
25 Feb 19 |
nicklas |
394 |
listInvoker.render(new ListColumnExportRenderer<ReporterList>(cc)); |
5590 |
16 Mar 11 |
nicklas |
395 |
dc.close(); |
2149 |
04 Apr 06 |
nicklas |
396 |
redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+reporter+lists"; |
2149 |
04 Apr 06 |
nicklas |
397 |
} |
2149 |
04 Apr 06 |
nicklas |
398 |
else if ("ExportItem".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
399 |
{ |
2149 |
04 Apr 06 |
nicklas |
400 |
// Run an export plugin in single-item context |
2149 |
04 Apr 06 |
nicklas |
401 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
402 |
redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+reporter+list"; |
2149 |
04 Apr 06 |
nicklas |
403 |
} |
2149 |
04 Apr 06 |
nicklas |
404 |
else if ("ImportItems".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
405 |
{ |
2149 |
04 Apr 06 |
nicklas |
406 |
// Run an import plugin in a list context |
2149 |
04 Apr 06 |
nicklas |
407 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
408 |
final ItemQuery<ReporterList> query = ReporterList.getQuery(); |
7954 |
12 May 21 |
nicklas |
409 |
dc = sc.newDbControl(":Import "+itemType); |
7914 |
23 Feb 21 |
nicklas |
410 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
411 |
cc.configureQuery(dc, query, jspContext, true); |
5590 |
16 Mar 11 |
nicklas |
412 |
dc.close(); |
2149 |
04 Apr 06 |
nicklas |
413 |
cc.setQuery(query); |
2149 |
04 Apr 06 |
nicklas |
414 |
redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Import+reporter+lists"; |
2149 |
04 Apr 06 |
nicklas |
415 |
} |
2149 |
04 Apr 06 |
nicklas |
416 |
else if ("ImportItem".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
417 |
{ |
2149 |
04 Apr 06 |
nicklas |
418 |
// Run an import plugin in single-item context |
2149 |
04 Apr 06 |
nicklas |
419 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
420 |
redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Import+reporter+list"; |
2149 |
04 Apr 06 |
nicklas |
421 |
} |
2149 |
04 Apr 06 |
nicklas |
422 |
else if ("RunListPlugin".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
423 |
{ |
2149 |
04 Apr 06 |
nicklas |
424 |
// Run another plugin in a list context |
2149 |
04 Apr 06 |
nicklas |
425 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
426 |
final ItemQuery<ReporterList> query = ReporterList.getQuery(); |
7954 |
12 May 21 |
nicklas |
427 |
dc = sc.newDbControl(":Run plugin "+itemType); |
7914 |
23 Feb 21 |
nicklas |
428 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
429 |
cc.configureQuery(dc, query, jspContext, true); |
5590 |
16 Mar 11 |
nicklas |
430 |
dc.close(); |
2149 |
04 Apr 06 |
nicklas |
431 |
cc.setQuery(query); |
2149 |
04 Apr 06 |
nicklas |
432 |
redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&main_type=OTHER&title=Run+plugin"; |
2149 |
04 Apr 06 |
nicklas |
433 |
} |
2149 |
04 Apr 06 |
nicklas |
434 |
else if ("RunPlugin".equals(cmd)) |
2149 |
04 Apr 06 |
nicklas |
435 |
{ |
2149 |
04 Apr 06 |
nicklas |
436 |
// Run another plugin in single-item context |
2149 |
04 Apr 06 |
nicklas |
437 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); |
2149 |
04 Apr 06 |
nicklas |
438 |
redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&main_type=OTHER&title=Run+plugin"; |
2149 |
04 Apr 06 |
nicklas |
439 |
} |
4301 |
16 May 08 |
nicklas |
440 |
else if ("MergeItem".equals(cmd)) |
4301 |
16 May 08 |
nicklas |
441 |
{ |
4301 |
16 May 08 |
nicklas |
442 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext); |
7954 |
12 May 21 |
nicklas |
443 |
dc = sc.newDbControl(":Merge reporter lists"); |
7605 |
26 Feb 19 |
nicklas |
444 |
ReporterList rl = cc.getObject("item"); |
5060 |
19 Aug 09 |
nicklas |
445 |
dc.reattachItem(rl, false); |
4301 |
16 May 08 |
nicklas |
446 |
|
4301 |
16 May 08 |
nicklas |
447 |
String mergeType = request.getParameter("mergeType"); |
4301 |
16 May 08 |
nicklas |
448 |
String sourceMerge = request.getParameter("sourceMerge"); |
4301 |
16 May 08 |
nicklas |
449 |
|
4301 |
16 May 08 |
nicklas |
450 |
String[] sourceListIds = Values.getString(request.getParameter("sourceLists")).split(","); |
4301 |
16 May 08 |
nicklas |
451 |
List<ReporterList> sourceLists = new ArrayList<ReporterList>(sourceListIds.length); |
4301 |
16 May 08 |
nicklas |
452 |
for (int i = 0; i < sourceListIds.length; ++i) |
4301 |
16 May 08 |
nicklas |
453 |
{ |
4301 |
16 May 08 |
nicklas |
454 |
int listId = Values.getInt(sourceListIds[i], -1); |
4301 |
16 May 08 |
nicklas |
455 |
if (listId != -1) sourceLists.add(ReporterList.getById(dc, listId)); |
4301 |
16 May 08 |
nicklas |
456 |
} |
4301 |
16 May 08 |
nicklas |
457 |
|
4301 |
16 May 08 |
nicklas |
458 |
int numAdded = 0; |
4301 |
16 May 08 |
nicklas |
459 |
int numRemoved = 0; |
4301 |
16 May 08 |
nicklas |
460 |
if ("union".equals(mergeType)) |
4301 |
16 May 08 |
nicklas |
461 |
{ |
4301 |
16 May 08 |
nicklas |
462 |
if ("union".equals(sourceMerge)) |
4301 |
16 May 08 |
nicklas |
463 |
{ |
4301 |
16 May 08 |
nicklas |
464 |
numAdded = rl.addUnion(sourceLists); |
4301 |
16 May 08 |
nicklas |
465 |
} |
4301 |
16 May 08 |
nicklas |
466 |
else if ("intersection".equals(sourceMerge)) |
4301 |
16 May 08 |
nicklas |
467 |
{ |
4301 |
16 May 08 |
nicklas |
468 |
numAdded = rl.addIntersection(sourceLists); |
4301 |
16 May 08 |
nicklas |
469 |
} |
4301 |
16 May 08 |
nicklas |
470 |
message = numAdded + " reporters added to this list"; |
4301 |
16 May 08 |
nicklas |
471 |
} |
4301 |
16 May 08 |
nicklas |
472 |
else if ("intersection".equals(mergeType)) |
4301 |
16 May 08 |
nicklas |
473 |
{ |
4301 |
16 May 08 |
nicklas |
474 |
if ("union".equals(sourceMerge)) |
4301 |
16 May 08 |
nicklas |
475 |
{ |
4301 |
16 May 08 |
nicklas |
476 |
numRemoved = rl.retainUnion(sourceLists); |
4301 |
16 May 08 |
nicklas |
477 |
} |
4301 |
16 May 08 |
nicklas |
478 |
else if ("intersection".equals(sourceMerge)) |
4301 |
16 May 08 |
nicklas |
479 |
{ |
4301 |
16 May 08 |
nicklas |
480 |
numRemoved = rl.retainIntersection(sourceLists); |
4301 |
16 May 08 |
nicklas |
481 |
} |
4301 |
16 May 08 |
nicklas |
482 |
message = numRemoved + " reporters removed from this list"; |
4301 |
16 May 08 |
nicklas |
483 |
} |
4301 |
16 May 08 |
nicklas |
484 |
else if ("complement".equals(mergeType)) |
4301 |
16 May 08 |
nicklas |
485 |
{ |
4301 |
16 May 08 |
nicklas |
486 |
if ("union".equals(sourceMerge)) |
4301 |
16 May 08 |
nicklas |
487 |
{ |
4301 |
16 May 08 |
nicklas |
488 |
numRemoved = rl.removeUnion(sourceLists); |
4301 |
16 May 08 |
nicklas |
489 |
} |
4301 |
16 May 08 |
nicklas |
490 |
else if ("intersection".equals(sourceMerge)) |
4301 |
16 May 08 |
nicklas |
491 |
{ |
4301 |
16 May 08 |
nicklas |
492 |
numRemoved = rl.removeIntersection(sourceLists); |
4301 |
16 May 08 |
nicklas |
493 |
} |
4301 |
16 May 08 |
nicklas |
494 |
message = numRemoved + " reporters removed from this list"; |
4301 |
16 May 08 |
nicklas |
495 |
} |
4301 |
16 May 08 |
nicklas |
496 |
dc.commit(); |
4301 |
16 May 08 |
nicklas |
497 |
} |
2149 |
04 Apr 06 |
nicklas |
498 |
else |
2149 |
04 Apr 06 |
nicklas |
499 |
{ |
2149 |
04 Apr 06 |
nicklas |
500 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
2149 |
04 Apr 06 |
nicklas |
501 |
} |
2149 |
04 Apr 06 |
nicklas |
502 |
} |
2149 |
04 Apr 06 |
nicklas |
503 |
finally |
2149 |
04 Apr 06 |
nicklas |
504 |
{ |
2149 |
04 Apr 06 |
nicklas |
505 |
if (dc != null) dc.close(); |
2149 |
04 Apr 06 |
nicklas |
506 |
} |
2149 |
04 Apr 06 |
nicklas |
507 |
|
2149 |
04 Apr 06 |
nicklas |
508 |
if (forward != null) |
2149 |
04 Apr 06 |
nicklas |
509 |
{ |
6192 |
31 Oct 12 |
nicklas |
510 |
sc.setSessionSetting("alert-message", message); |
2149 |
04 Apr 06 |
nicklas |
511 |
pageContext.forward(forward); |
2149 |
04 Apr 06 |
nicklas |
512 |
} |
2149 |
04 Apr 06 |
nicklas |
513 |
else if (redirect != null) |
2149 |
04 Apr 06 |
nicklas |
514 |
{ |
6192 |
31 Oct 12 |
nicklas |
515 |
sc.setSessionSetting("alert-message", message); |
2149 |
04 Apr 06 |
nicklas |
516 |
response.sendRedirect(redirect); |
2149 |
04 Apr 06 |
nicklas |
517 |
} |
2149 |
04 Apr 06 |
nicklas |
518 |
else if (message == null) |
2149 |
04 Apr 06 |
nicklas |
519 |
{ |
2149 |
04 Apr 06 |
nicklas |
520 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
2149 |
04 Apr 06 |
nicklas |
521 |
} |
2149 |
04 Apr 06 |
nicklas |
522 |
else |
2149 |
04 Apr 06 |
nicklas |
523 |
{ |
2149 |
04 Apr 06 |
nicklas |
524 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
2149 |
04 Apr 06 |
nicklas |
525 |
} |
2149 |
04 Apr 06 |
nicklas |
526 |
%> |
2149 |
04 Apr 06 |
nicklas |
527 |
|