Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/RuntimeCollective/search/bean/Searchable.java


1   /* $Header: /home/CVS/rjp/src/com/RuntimeCollective/search/bean/Searchable.java,v 1.5 2003/09/30 15:12:57 joe Exp $
2    * $Revision: 1.5 $
3    * $Date: 2003/09/30 15:12:57 $
4    *
5    * ====================================================================
6    *
7    * Josephine : http://www.runtime-collective.com/josephine/index.html
8    *
9    * Copyright (C) 2003 Runtime Collective
10   * 
11   * This product includes software developed by the
12   * Apache Software Foundation (http://www.apache.org/).
13   *
14   * This library is free software; you can redistribute it and/or
15   * modify it under the terms of the GNU Lesser General Public
16   * License as published by the Free Software Foundation; either
17   * version 2.1 of the License, or (at your option) any later version.
18   *
19   * This library is distributed in the hope that it will be useful,
20   * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22   * Lesser General Public License for more details.
23   *
24   * You should have received a copy of the GNU Lesser General Public
25   * License along with this library; if not, write to the Free Software
26   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27   *
28   */
29  
30  package com.RuntimeCollective.search.bean;
31  
32  import com.RuntimeCollective.webapps.bean.EntityBean;
33  import com.RuntimeCollective.search.SearchException;
34  import java.util.Collection;
35  
36  /** A javabean must implement this interface to be searchable.
37   * The responsibility for adding this javabean to the search index is entirely down to the implementing class.
38   * A standard way of doing this would be put the following line in the <code>save</code> method:
39   *
40   * <p><pre><code>((SearchIndex)RuntimeParameters.getSearchIndex()).addSearchable(this)</code></pre>
41   *
42   * and in the <code>delete</code> method:
43   *
44   * <p><pre><code>((SearchIndex)RuntimeParameters.getSearchIndex()).removeSearchable(this)</code></pre>
45   *
46   * This will put the bean in the search index when it's saved, and remove it when it's deleted.
47   *
48   * @author Joe Holmberg
49   * @version $Id: Searchable.java,v 1.5 2003/09/30 15:12:57 joe Exp $
50   */
51  public interface Searchable extends EntityBean {
52  
53      /** The category, or section name, to "file" this object under in the search index. */
54      public static String searchCategory = "Content";
55  
56      /** Get a one-line title for this searchable object. */
57      public String getSearchTitle();
58  
59      /** Get a short, one paragraph summary for this searchable object. */
60      public String getSearchSummary();
61  
62      /** Get all text for this object that will be searched on. */
63      public String getSearchText();
64  
65      /** Get a Collection of Strings, for every Field that can be searched for on this object. */
66      public Collection getFields();
67  
68      /** Get a link that will display this object (ok, so this is a bit of a hack - there must be a better way) */
69      public String getLink();
70  
71      /** Return all Searchable objects of this class that should be added to the search index, given an empty index to populate.
72       * Note: This would normally be a static method, but it's defined in the Searchable *interface*.
73       */
74      public Searchable[] populateIndex() throws SearchException;
75  }
76  
77