KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > monitor > session > component > UISessionLogManager


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.portlets.monitor.session.component;
6
7 import java.util.ArrayList JavaDoc;
8 import java.util.List JavaDoc;
9 import org.exoplatform.faces.core.component.model.SelectItem;
10 import org.exoplatform.faces.search.component.UISearchBar;
11 import org.exoplatform.faces.search.component.UISearcher;
12 import org.exoplatform.services.portal.log.Query;
13 /**
14  * @author Tuan Nguyen (tuan08@users.sourceforge.net)
15  * @since Aug 27, 2004
16  * @version $Id: UIContentSearcher.java,v 1.1 2004/10/25 03:48:11 tuan08 Exp $
17  */

18 public class UISessionLogManager extends UISearcher {
19
20   public UISessionLogManager() throws Exception JavaDoc {
21     setId("UISearcher") ;
22     setRendererType("ChildrenRenderer") ;
23     List JavaDoc options = new ArrayList JavaDoc() ;
24     options.add(new SelectItem("#{UISearchBar.label.search-all}", ""));
25     options.add(new SelectItem("#{UISearchBar.label.session-owner}", "sessionOwner"));
26     options.add(new SelectItem("#{UISearchBar.label.remote-user}","remoteUser"));
27     options.add(new SelectItem("#{UISearchBar.label.ip-address}", "ipAddress"));
28     options.add(new SelectItem("#{UISearchBar.label.client-type}", "clientName"));
29     UISearchBar uiBar = new UISearchBar();
30     uiBar.setSearchOptions(options) ;
31     getChildren().add(uiBar) ;
32     addChild(UIListSessionLog.class) ;
33     addChild(UISearchLogForm.class).setRendered(false) ;
34     addChild(UIActionHistory.class).setRendered(false) ;
35   }
36  
37   public void showAdvancedSearch() throws Exception JavaDoc {
38     setRenderedComponent(UISearchLogForm.class) ;
39   }
40   
41   public void quickSearch(String JavaDoc term, List JavaDoc fields) throws Exception JavaDoc {
42     Query query = new Query() ;
43     if(term != null && term.length() > 0 && fields.size() == 1) {
44       String JavaDoc field = (String JavaDoc) fields.get(0) ;
45       if("sessionOwner".equals(field)) query.setSessionOwner(term) ;
46       else if("remoteUser".equals(field))query.setRemoteUser(term) ;
47       else if("ipAddress".equals(field))query.setIPAddress(term) ;
48       else if("clientName".equals(field))query.setClientType(term) ;
49     }
50     UIListSessionLog uiList =
51       (UIListSessionLog) getChildComponentOfType(UIListSessionLog.class) ;
52     uiList.update(query) ;
53     setRenderedComponent(UIListSessionLog.class) ;
54   }
55 }
Popular Tags