%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ page import="org.crosswire.utils.HTTPUtils" %>
<%@ page import="com.liferay.portlet.messageboards.service.MBCategoryLocalServiceUtil" %>
<%@ page import="com.liferay.portlet.messageboards.model.MBCategory" %>
<%@ page import="java.util.List" %>
<%@ 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 = "Get information about categories.", name = "forum/category/get")
public static class MyParameters extends Parameters {
@NotNull
@Description(value = "forum group context", example = "12")
public Integer groupID;
@Description(value = "parent id of categories to assure exists", example = "12")
public Integer parentCategoryID;
}
%>
<%
MyParameters params = new MyParameters().loadFromRequest(request, response, false);
if (params.getErrors().size() == 0) {
List cats = (params.parentCategoryID == null) ? MBCategoryLocalServiceUtil.getCategories(params.groupID) : MBCategoryLocalServiceUtil.getCategories(params.groupID, params.parentCategoryID, -1, -1);
StringBuffer retVal = new StringBuffer();
retVal.append("");
for (MBCategory cat : cats) {
retVal.append("");
retVal.append(HTTPUtils.canonize(cat.getDescription()));
retVal.append("");
}
retVal.append("");
Serializer.output(response, out, params, XMLBlock.createXMLBlock(retVal.toString()));
return;
}
else params.format = "html";
Serializer.reportErrors(request, response, out, params, true);
%>