| 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.domain.Category; |
| 36 |
|
import net.sourceforge.pebble.domain.Blog; |
| 37 |
|
import net.sourceforge.pebble.util.Utilities; |
| 38 |
|
import net.sourceforge.pebble.web.view.ForwardView; |
| 39 |
|
import net.sourceforge.pebble.web.view.View; |
| 40 |
|
import net.sourceforge.pebble.web.view.impl.UtilitiesView; |
| 41 |
|
|
| 42 |
|
import javax.servlet.ServletException; |
| 43 |
|
import javax.servlet.http.HttpServletRequest; |
| 44 |
|
import javax.servlet.http.HttpServletResponse; |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
@author |
| 51 |
|
|
|
|
|
| 0% |
Uncovered Elements: 44 (44) |
Complexity: 11 |
Complexity Density: 0,42 |
|
| 52 |
|
public class UtilitiesAction extends SecureAction { |
| 53 |
|
|
| 54 |
|
|
| 55 |
|
|
| 56 |
|
|
| 57 |
|
@param |
| 58 |
|
@param |
| 59 |
|
@return |
| 60 |
|
|
|
|
|
| 0% |
Uncovered Elements: 41 (41) |
Complexity: 10 |
Complexity Density: 0,4 |
|
| 61 |
0
|
public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {... |
| 62 |
0
|
Blog blog = (Blog)getModel().get(Constants.BLOG_KEY); |
| 63 |
0
|
String action = request.getParameter("action"); |
| 64 |
0
|
if (action == null) { |
| 65 |
|
|
| 66 |
0
|
} else if (action.equalsIgnoreCase("ipAddressListener")) { |
| 67 |
0
|
Utilities.buildIpAddressLists(blog); |
| 68 |
0
|
return new ForwardView("/reloadBlog.secureaction"); |
| 69 |
0
|
} else if (action.equalsIgnoreCase("fixHtmlInResponses")) { |
| 70 |
0
|
Utilities.fixHtmlInResponses(blog); |
| 71 |
0
|
return new ForwardView("/reloadBlog.secureaction"); |
| 72 |
0
|
} else if (action.equalsIgnoreCase("buildIndexes")) { |
| 73 |
0
|
Utilities.buildIndexes(blog); |
| 74 |
0
|
return new ForwardView("/reloadBlog.secureaction"); |
| 75 |
0
|
} else if (action.equalsIgnoreCase("convertCategories")) { |
| 76 |
0
|
Utilities.convertCategories(blog); |
| 77 |
0
|
return new ForwardView("/reloadBlog.secureaction"); |
| 78 |
0
|
} else if (action.equalsIgnoreCase("restructureBlogToGMT")) { |
| 79 |
0
|
Utilities.restructureBlogToGMT(blog); |
| 80 |
0
|
Utilities.buildIndexes(blog); |
| 81 |
0
|
return new ForwardView("/reloadBlog.secureaction"); |
| 82 |
0
|
} else if (action.equalsIgnoreCase("moveBlogEntriesFromCategory")) { |
| 83 |
0
|
Category from = blog.getCategory(request.getParameter("from")); |
| 84 |
0
|
Category to = blog.getCategory(request.getParameter("to")); |
| 85 |
0
|
if (from != null && to != null) { |
| 86 |
0
|
Utilities.moveBlogEntriesFromCategory(blog, from, to); |
| 87 |
|
} |
| 88 |
|
} |
| 89 |
|
|
| 90 |
0
|
return new UtilitiesView(); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
@return |
| 97 |
|
@param |
| 98 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 99 |
0
|
public String[] getRoles(HttpServletRequest request) {... |
| 100 |
0
|
return new String[]{Constants.BLOG_ADMIN_ROLE, Constants.BLOG_OWNER_ROLE}; |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
} |