| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
package net.sourceforge.pebble.web.action; |
| 33 |
|
|
| 34 |
|
import net.sourceforge.pebble.Constants; |
| 35 |
|
import net.sourceforge.pebble.dao.CategoryDAO; |
| 36 |
|
import net.sourceforge.pebble.dao.DAOFactory; |
| 37 |
|
import net.sourceforge.pebble.dao.PersistenceException; |
| 38 |
|
import net.sourceforge.pebble.domain.Category; |
| 39 |
|
import net.sourceforge.pebble.domain.Blog; |
| 40 |
|
import net.sourceforge.pebble.web.controller.RequireSecurityToken; |
| 41 |
|
import net.sourceforge.pebble.web.view.ForwardView; |
| 42 |
|
import net.sourceforge.pebble.web.view.View; |
| 43 |
|
|
| 44 |
|
import javax.servlet.ServletException; |
| 45 |
|
import javax.servlet.http.HttpServletRequest; |
| 46 |
|
import javax.servlet.http.HttpServletResponse; |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
@author |
| 52 |
|
|
| 53 |
|
@RequireSecurityToken |
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 6 |
Complexity Density: 0,4 |
|
| 54 |
|
public class RemoveCategoriesAction extends SecureAction { |
| 55 |
|
|
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
@param |
| 60 |
|
@param |
| 61 |
|
@return |
| 62 |
|
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 5 |
Complexity Density: 0,36 |
|
| 63 |
0
|
public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {... |
| 64 |
0
|
Blog blog = (Blog)getModel().get(Constants.BLOG_KEY); |
| 65 |
0
|
String ids[] = request.getParameterValues("category"); |
| 66 |
|
|
| 67 |
0
|
if (ids != null) { |
| 68 |
0
|
for (String id : ids) { |
| 69 |
0
|
if (!id.equals("/")) { |
| 70 |
0
|
Category category = blog.getCategory(id); |
| 71 |
0
|
if (category != null) { |
| 72 |
0
|
blog.removeCategory(category); |
| 73 |
0
|
try { |
| 74 |
|
|
| 75 |
0
|
DAOFactory factory = DAOFactory.getConfiguredFactory(); |
| 76 |
0
|
CategoryDAO dao = factory.getCategoryDAO(); |
| 77 |
0
|
dao.deleteCategory(category, blog); |
| 78 |
|
} catch (PersistenceException pe) { |
| 79 |
0
|
pe.printStackTrace(); |
| 80 |
|
} |
| 81 |
|
} |
| 82 |
|
} |
| 83 |
|
} |
| 84 |
|
} |
| 85 |
|
|
| 86 |
0
|
return new ForwardView("/viewCategories.secureaction"); |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| 92 |
|
@return |
| 93 |
|
@param |
| 94 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 95 |
0
|
public String[] getRoles(HttpServletRequest request) {... |
| 96 |
0
|
return new String[]{Constants.BLOG_CONTRIBUTOR_ROLE}; |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
} |