<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page trimDirectiveWhitespaces="true" %> <%@ page import="com.liferay.portlet.messageboards.service.MBCategoryLocalServiceUtil" %> <%@ page import="org.crosswire.xml.XMLBlock" %> <%@ page import="org.crosswire.webtools.annotation.*" %> <%@ page import="org.crosswire.webtools.*" %> <%@ page import="javax.validation.constraints.NotNull" %> <%! @Description(value = "Delete a category.", name = "forum/category/delete") public static class MyParameters extends Parameters { @NotNull @Description(value = "id of category to delete", example = "12") public Integer categoryID; @Override protected void customValidation() { if (getUser() == null) { addError(-5, "Must be logged in."); return; } } } %> <% MyParameters params = new MyParameters().loadFromRequest(request, response, false); if (params.getErrors().size() == 0) { if (!params.getUser().hasRole("VMR Administrator")) { params.addError(-6, "Must be a VMR Administrator to delete Forum Categories."); } else { params.getLogger().info("forum/category/delete(categoryID:"+params.categoryID + "; userName: " + params.getUser().getUserName()); try { MBCategoryLocalServiceUtil.deleteCategory(params.categoryID); Serializer.output(response, out, params, XMLBlock.createXMLBlock("")); return; } catch (Exception e) { params.addError(-7, e.toString()); } } } else params.format = "html"; Serializer.reportErrors(request, response, out, params, true); %>