1 package com.genimen.djeneric.web.controller; 2 3 import java.io.IOException ; 4 5 import javax.servlet.ServletException ; 6 import javax.servlet.http.HttpServletRequest ; 7 import javax.servlet.http.HttpServletResponse ; 8 9 import com.genimen.djeneric.repository.DjExtent; 10 import com.genimen.djeneric.repository.DjOql; 11 import com.genimen.djeneric.repository.exceptions.DjenericException; 12 import com.genimen.djeneric.web.renderers.tree.AbstractWebNode; 13 import com.genimen.djeneric.web.renderers.tree.WebFolder; 14 import com.genimen.djeneric.web.renderers.tree.WebTree; 15 import com.genimen.djeneric.web.util.DjenericSessionManager; 16 import com.genimen.djeneric.web.util.DjenericXSLTransform; 17 import com.genimen.djeneric.web.util.OqlUtil; 18 19 public class SetFilterCommand 20 { 21 public void get(DjenericSessionManager sessionManager, HttpServletRequest request, HttpServletResponse response) 22 throws IOException , ServletException , DjenericException 23 { 24 try 25 { 26 WebTree tree = sessionManager.getTree(); 27 DjenericXSLTransform xsl = sessionManager.getTransformer(); 28 29 response.setContentType("text/html; charset=UTF-8"); 30 31 String nodeId = request.getParameter("nodeid"); 32 if (nodeId != null) 33 { 34 tree.setSelectedNode(nodeId); 35 36 AbstractWebNode node = tree.getNode(nodeId); 37 if (!(node instanceof WebFolder)) throw new DjenericException("Node with id " + nodeId + " is not a WebFolder"); 38 39 WebFolder folder = (WebFolder) node; 40 DjExtent extent = node.getExtentUsage().getExtent(); 41 42 DjOql oql = OqlUtil.createOql(sessionManager, extent, request.getParameterMap()); 43 folder.filter(oql); 44 folder.load(); 45 } 46 else 47 { 48 throw new DjenericException("Parameter nodeid not defined"); 49 } 50 } 51 catch (Exception e) 52 { 53 throw new ServletException (e); 54 } 55 } 56 57 } 58 | Popular Tags |