KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > search > component > model > DocumentDataHandler


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.faces.search.component.model;
6
7 import org.apache.lucene.document.Document ;
8 import org.exoplatform.commons.utils.PageList;
9 import org.exoplatform.faces.core.component.model.PageListDataHandler;
10 import org.exoplatform.services.indexing.HitPageList;
11 import org.exoplatform.services.indexing.IndexingService;
12
13
14 /**
15  * @author Tuan Nguyen (tuan08@users.sourceforge.net)
16  * @since Oct 23, 2004
17  * @version $Id: DocumentDataHandler.java,v 1.3 2004/11/01 20:15:12 tuan08 Exp $
18  */

19 public class DocumentDataHandler extends PageListDataHandler {
20   private Document doc_ ;
21   private float score_ ;
22   private HitPageList hits_ ;
23   
24   public String JavaDoc getData(String JavaDoc fieldName) {
25     return "N/A" ;
26   }
27   
28   public void setPageList(PageList pageList) throws Exception JavaDoc {
29     hits_ = (HitPageList)pageList ;
30     super.setPageList(pageList) ;
31   }
32   
33   public String JavaDoc getTitle() { return doc_.get(IndexingService.TITLE_FIELD) ; }
34   public String JavaDoc getDescription() { return doc_.get(IndexingService.DESCRIPTION_FIELD) ; }
35   public String JavaDoc getAuthor() { return doc_.get(IndexingService.AUTHOR_FIELD) ; }
36   public String JavaDoc getDocumentId() { return doc_.get(IndexingService.IDENTIFIER_FIELD) ; }
37   public String JavaDoc getModule() { return doc_.get(IndexingService.MODULE_FIELD) ; }
38   public float getScore() { return score_ ; }
39   
40   public void setCurrentObject(Object JavaDoc o) {
41     doc_ = (Document) o;
42     score_ = hits_.getScoreOfDocumentInPage(getCurrentRow()) ;
43   }
44 }
Popular Tags