portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r1709948 - in /portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/search: ./ SearchPortlet.java
Date Thu, 22 Oct 2015 03:54:11 GMT
Author: taylor
Date: Thu Oct 22 03:54:11 2015
New Revision: 1709948

URL: http://svn.apache.org/viewvc?rev=1709948&view=rev
Log:
JS2-1341: implemented detached portlet rendering for page pipeline

Added:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/search/
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/search/SearchPortlet.java
      - copied, changed from r1693303, portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/BreadcrumbMenu.java

Copied: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/search/SearchPortlet.java
(from r1693303, portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/BreadcrumbMenu.java)
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/search/SearchPortlet.java?p2=portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/search/SearchPortlet.java&p1=portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/BreadcrumbMenu.java&r1=1693303&r2=1709948&rev=1709948&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/BreadcrumbMenu.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/search/SearchPortlet.java
Thu Oct 22 03:54:11 2015
@@ -14,107 +14,47 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jetspeed.portlets.spaces;
+package org.apache.jetspeed.portlets.search;
 
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Stack;
+import org.apache.jetspeed.CommonPortletServices;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.search.SearchEngine;
+import org.apache.portals.bridges.common.GenericServletPortlet;
 
 import javax.portlet.PortletConfig;
 import javax.portlet.PortletContext;
 import javax.portlet.PortletException;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
-
-import org.apache.jetspeed.CommonPortletServices;
-import org.apache.jetspeed.administration.PortalAdministration;
-import org.apache.jetspeed.page.PageManager;
-import org.apache.jetspeed.page.document.Node;
-import org.apache.jetspeed.request.RequestContext;
-import org.apache.jetspeed.spaces.Spaces;
-import org.apache.portals.bridges.common.GenericServletPortlet;
+import java.io.IOException;
 
 /**
- * Jetspeed Breadcrumb Menu
+ * Jetspeed Search Portlet
  *
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  * @version $Id$
  */
-public class BreadcrumbMenu extends GenericServletPortlet
+public class SearchPortlet extends GenericServletPortlet
 {
-    private Spaces spacesService;
-    private PortalAdministration admin;
-    protected PageManager pageManager;    
+    private SearchEngine searchEngine;
 
     public void init(PortletConfig config) throws PortletException
     {
         super.init(config);
         PortletContext context = getPortletContext();
-        spacesService = (Spaces) context.getAttribute(CommonPortletServices.CPS_SPACES_SERVICE);
-        if (spacesService == null)
+        searchEngine = (SearchEngine) context.getAttribute(CommonPortletServices.CPS_SEARCH_COMPONENT);
+        if (searchEngine == null)
                 throw new PortletException(
-                        "Could not get instance of portal spaces service component");
-        admin = (PortalAdministration) getPortletContext().getAttribute(
-                CommonPortletServices.CPS_PORTAL_ADMINISTRATION);
-        if (null == admin) { throw new PortletException(
-                "Failed to find the Portal Administration on portlet initialization"); }
-        pageManager = (PageManager)context.getAttribute(CommonPortletServices.CPS_PAGE_MANAGER_COMPONENT);
-        if (null == pageManager)
-        {
-            throw new PortletException("Failed to find the Page Manager on portlet initialization");
-        }                       
+                        "Could not get instance of portal Search Engine component");
     }
 
     public void doView(RenderRequest request, RenderResponse response)
             throws PortletException, IOException
     {    
         RequestContext rc = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);
-        Stack<BreadcrumbMenuItem> stack = new Stack<BreadcrumbMenuItem>();
-        Node node = rc.getPage().getPageOrTemplate().getParent();
-        while (node != null)
-        {
-            stack.push(new BreadcrumbMenuItem(node.getTitle(), admin.getPortalURL(request,
response, node.getPath())));
-            node = node.getParent();
-        } 
-        List<BreadcrumbMenuItem> breadcrumbs = new LinkedList<BreadcrumbMenuItem>();
-        while (!stack.empty())
-        {
-            breadcrumbs.add(stack.pop());
-        }
-        breadcrumbs.add(new BreadcrumbMenuItem(rc.getPage().getTitle(), admin.getPortalURL(request,
response, rc.getPage().getPath())));
-        request.setAttribute("breadcrumbs", breadcrumbs);
-        try
-        {
-            super.doView(request, response);
-        }
-        catch (Throwable t)
-        {
-            t.printStackTrace();
-        }
+        String viewPage = getPortletConfig().getInitParameter("ViewPage");
+        getPortletContext().getRequestDispatcher(viewPage).include(request, response);
+        // TODO: complete this portlet
     }
 
-    public class BreadcrumbMenuItem implements Serializable
-    {
-        private static final long serialVersionUID = 1L;
-        private String title;
-        private String path;
-        
-        public BreadcrumbMenuItem(String title, String path)
-        {
-            this.title = title;
-            this.path = path;
-        }
-        
-        public String getTitle()
-        {
-            return title;
-        }
-        
-        public String getPath()
-        {
-            return path;
-        }
-    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message