Changeset 3792
- Timestamp:
- Sep 27, 2007, 9:58:47 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/views/reporters/index.jsp
r3679 r3792 41 41 import="net.sf.basedb.core.DataQuery" 42 42 import="net.sf.basedb.core.PermissionDeniedException" 43 import="net.sf.basedb.core.BaseException" 43 44 import="net.sf.basedb.util.RemovableUtil" 44 45 import="net.sf.basedb.util.ShareableUtil" … … 175 176 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 176 177 ReporterBatcher batcher = ReporterBatcher.getNew(dc); 177 batcher.delete(cc.getId()); 178 batcher.close(); 179 dc.commit(); 180 redirect = listPage; 178 try 179 { 180 batcher.delete(cc.getId()); 181 batcher.close(); 182 dc.commit(); 183 redirect = listPage; 184 } 185 catch (BaseException bex) 186 { 187 message = "The reporter can not be deleted. " + 188 "Probably because it is used by other items"; 189 redirect = viewPage + "&popmessage="+HTML.urlEncode(message); 190 } 181 191 } 182 192 else if ("DeleteItems".equals(cmd)) … … 186 196 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 187 197 ReporterBatcher batcher = ReporterBatcher.getNew(dc); 198 batcher.setBatchSize(1); 199 int notDeleted = 0; 188 200 for (int reporterId : cc.getSelected()) 189 201 { 190 batcher.delete(reporterId); 191 } 192 batcher.close(); 202 try 203 { 204 batcher.delete(reporterId); 205 } 206 catch (BaseException bex) 207 { 208 notDeleted++; 209 } 210 } 193 211 dc.commit(); 194 redirect = listPage; 212 message = notDeleted > 0 ? notDeleted + " reporters can not be deleted. " + 213 "Probably because they are used by other items" : null; 214 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 195 215 } 196 216 else if ("ExportItems".equals(cmd))
Note: See TracChangeset
for help on using the changeset viewer.