org.mmbase.applications.xmlimporter
Class BasicFinder

java.lang.Object
  |
  +--org.mmbase.applications.xmlimporter.BasicFinder
All Implemented Interfaces:
SimilarObjectFinder

public abstract class BasicFinder
extends java.lang.Object
implements SimilarObjectFinder

A basic implementation of SimilarObjectFinder.

Since:
MMBase-1.5
Version:
$Id: BasicFinder.java,v 1.2 2002/02/27 16:54:24 pierre Exp $

Constructor Summary
BasicFinder()
          Creates new BasicFinder
 
Method Summary
protected static java.util.List findPersistentObjects(MMObjectBuilder builder, java.lang.String criterium)
          Convenience method: finds MMBase id's for all objects in the persistent cloud of a given type and satisfying a criterium.
 java.util.List findSimilarObject(Transaction transaction, TmpObject tmpObj)
          Searches for similar object.
abstract  java.util.Collection getClosePersistentObjects(TmpObject tmpObj)
          Gets MMBase id's for all objects from persistent cloud that might produce a qualifying match with the given object (possibly including the object itself).
abstract  java.util.Collection getExactPersistentObjects(TmpObject tmpObj)
          Gets MMBase id's for all objects from persistent cloud that produce an exact match with the given object (possibly including the object itself).
 void init(java.util.HashMap params)
          Initializes this instance.
abstract  float scoreNode(TmpObject tmpObj1, TmpObject tmpObj2)
          Calculates matching rate for two objects, e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicFinder

public BasicFinder()
Creates new BasicFinder
Method Detail

findPersistentObjects

protected static java.util.List findPersistentObjects(MMObjectBuilder builder,
                                                      java.lang.String criterium)
Convenience method: finds MMBase id's for all objects in the persistent cloud of a given type and satisfying a criterium.
Parameters:
builder - The builder for this type.
criterium - The criterium: SQL where-clause, but without the "where ".
Returns:
List of (Integer) MMBase id's.

init

public void init(java.util.HashMap params)
          throws TransactionHandlerException
Initializes this instance.
Specified by:
init in interface SimilarObjectFinder
Parameters:
params - The initialization parameters, provided as name/value pairs (both String).
Throws:
TransactionHandlerException - if a failure occurred.

findSimilarObject

public java.util.List findSimilarObject(Transaction transaction,
                                        TmpObject tmpObj)
                                 throws TransactionHandlerException
Searches for similar object. Objects found in the persistent cloud will be accessed in the transaction.
Specified by:
findSimilarObject in interface SimilarObjectFinder
Parameters:
transaction - The transaction.
tmpObj - The object to search for.
Returns:
List of the similar objects found.
Throws:
TransactionHandlerException - If a failure occurred.

scoreNode

public abstract float scoreNode(TmpObject tmpObj1,
                                TmpObject tmpObj2)
Calculates matching rate for two objects, e.g. the rate in which tmpObj1 matches tmpObj2, represented by a value ranging from 0 to 1:
Parameters:
tmpObj1 - The object for which the matching rate is wanted.
tmpObj2 - The object to match with.
Returns:
Matching rate.

getExactPersistentObjects

public abstract java.util.Collection getExactPersistentObjects(TmpObject tmpObj)
Gets MMBase id's for all objects from persistent cloud that produce an exact match with the given object (possibly including the object itself). This can be used to prevent a more extensive search for close matches when exact matches are possible.
Parameters:
tmpObj - The object to match with.
Returns:
Collection of (Integer) MMBase id's for objects from the persistent cloud that produce an exact match with the given object.

getClosePersistentObjects

public abstract java.util.Collection getClosePersistentObjects(TmpObject tmpObj)
Gets MMBase id's for all objects from persistent cloud that might produce a qualifying match with the given object (possibly including the object itself). When looking for a fuzzy match, this can be used to make a pre-selection from all the objects in the persistent cloud, to reduce the total number of objects to be inspected closer.
Parameters:
tmpObj - The object to match with.
Returns:
Collection of (Integer) MMBase id's for objects from the persistent cloud that might produce a qualifying match with the given object.


MMBase build 1.6.5.20030923