public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException, CommunicationException, NamingException
{
String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
SupportFacadeHome supportFacade = (SupportFacadeHome)
CVUtility.getHomeObject("com.centraview.support.supportfacade.SupportFacadeHome", "SupportFacade");
try {
HttpSession session = request.getSession();
UserObject userObject = (UserObject) session.getAttribute("userobject");
int individualID = userObject.getIndividualID();
CategoryForm catForm = (CategoryForm) form;
int catid = 1;
String rowId = request.getParameter("rowId");
if (rowId != null && !rowId.equals("")) {
if (rowId.indexOf("*") > -1) {
String elements[] = rowId.split("\\*");
if (elements.length != 2)
throw new Exception("No row selected.");
catid = Integer.parseInt(elements[0]);
} else {
catid = Integer.parseInt(rowId);
}
}
String categoryId = Integer.toString(catid);
request.setAttribute("rowId", categoryId);
SupportFacade remote = (SupportFacade) supportFacade.create();
remote.setDataSource(dataSource);
CategoryVO catVO = remote.getCategory(individualID, catid);
if (catVO == null)
throw new Exception("Bad category");