2.17.2: 2011-06-17

net.sf.basedb.plugins.batchimport
Class InternalIdMethod

java.lang.Object
  extended by net.sf.basedb.plugins.batchimport.InternalIdMethod
All Implemented Interfaces:
IdMethod

public class InternalIdMethod
extends Object
implements IdMethod

Identification method implementation that finds an item by using the getById() method.

Version:
2.8
Author:
nicklas
Last modified
$Date: 2008-09-11 22:06:36 +0200 (Thu, 11 Sep 2008) $

Field Summary
static InternalIdMethod INTERNAL_ID
          Use the internal ID for finding items.
private  String method
           
private  String title
           
 
Constructor Summary
InternalIdMethod(String method, String title)
          Create a new id method.
 
Method Summary
<I extends BasicItem>
List<I>
find(DbControl dc, ItemQuery<I> query, String identifier)
          Use getById method to find an item.
 String getColumnMappingParameterName()
           
 String getMethod()
          The name of this method, which should be unique among the methods that can be used at a given time.
 String getTitle()
          The display title of the method.
 boolean isTrulyUnique()
          If the identification method is truly unique or not.
<I extends BasicItem>
ItemQuery<I>
prepareQuery(DbControl dc, ItemQuery<I> query)
          Return the original query, unmodified.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INTERNAL_ID

public static final InternalIdMethod INTERNAL_ID
Use the internal ID for finding items.


method

private final String method

title

private final String title
Constructor Detail

InternalIdMethod

public InternalIdMethod(String method,
                        String title)
Create a new id method.

Method Detail

getMethod

public String getMethod()
Description copied from interface: IdMethod
The name of this method, which should be unique among the methods that can be used at a given time.

Specified by:
getMethod in interface IdMethod
Returns:
The method name

getTitle

public String getTitle()
Description copied from interface: IdMethod
The display title of the method.

Specified by:
getTitle in interface IdMethod

isTrulyUnique

public boolean isTrulyUnique()
Description copied from interface: IdMethod
If the identification method is truly unique or not. If this method returns true, the IdMethod.find(DbControl, ItemQuery, String) method will never ever return a list with more than one item.

Specified by:
isTrulyUnique in interface IdMethod

getColumnMappingParameterName

public String getColumnMappingParameterName()
Specified by:
getColumnMappingParameterName in interface IdMethod

prepareQuery

public <I extends BasicItem> ItemQuery<I> prepareQuery(DbControl dc,
                                                       ItemQuery<I> query)
Return the original query, unmodified.

Specified by:
prepareQuery in interface IdMethod
query - The query to prepare
Returns:
The query that is used for item lookup

find

public <I extends BasicItem> List<I> find(DbControl dc,
                                          ItemQuery<I> query,
                                          String identifier)
Use getById method to find an item. The query is not used except to find the type of item to load.

Specified by:
find in interface IdMethod
query - The query to use, which should have been prepared using IdMethod.prepareQuery(DbControl, ItemQuery)
identifier - The identifier of the item
Returns:
A list with the found items, if IdMethod.isTrulyUnique() return true the list is guaranteed to have at most one item

toString

public String toString()
Overrides:
toString in class Object

2.17.2: 2011-06-17