|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.basedb.plugins.batchimport.FallbackIdMethod
public class FallbackIdMethod
Identification method implementation that first tries a parent id method, and, if no item is found and the identifier is a number, tries to load the item by id.
| Field Summary | |
|---|---|
private String |
method
|
static FallbackIdMethod |
NAME_OR_BARCODE_OR_ID
|
static FallbackIdMethod |
NAME_OR_EXTERNALID_OR_ID
|
static FallbackIdMethod |
NAME_OR_ID
Use the name for finding items. |
static FallbackIdMethod |
NAME_OR_SYSTEMID_OR_ID
Use the name or system ID for finding items. |
private IdMethod |
parent
|
private String |
title
|
| Constructor Summary | |
|---|---|
FallbackIdMethod(String method,
String title,
IdMethod parent)
Create a new id method. |
|
| Method Summary | ||
|---|---|---|
|
find(DbControl dc,
ItemQuery<I> query,
String identifier)
First, find items using the parent id method. |
|
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. |
|
|
prepareQuery(DbControl dc,
ItemQuery<I> query)
Adds a restriction to the query: property = :identifier |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final FallbackIdMethod NAME_OR_ID
public static final FallbackIdMethod NAME_OR_EXTERNALID_OR_ID
public static final FallbackIdMethod NAME_OR_BARCODE_OR_ID
public static final FallbackIdMethod NAME_OR_SYSTEMID_OR_ID
private final String method
private final String title
private final IdMethod parent
| Constructor Detail |
|---|
public FallbackIdMethod(String method,
String title,
IdMethod parent)
method - The method name, which should be unique among all methodstitle - The title to use for display purposesparent - The parent id method, which will be tried first| Method Detail |
|---|
public String getMethod()
IdMethod
getMethod in interface IdMethodpublic String getTitle()
IdMethod
getTitle in interface IdMethodpublic boolean isTrulyUnique()
IdMethodIdMethod.find(DbControl, ItemQuery, String) method will
never ever return a list with more than one item.
isTrulyUnique in interface IdMethodpublic String getColumnMappingParameterName()
getColumnMappingParameterName in interface IdMethod
public <I extends BasicItem> ItemQuery<I> prepareQuery(DbControl dc,
ItemQuery<I> query)
property = :identifier
prepareQuery in interface IdMethodquery - The query to prepare
public <I extends BasicItem> List<I> find(DbControl dc,
ItemQuery<I> query,
String identifier)
getById() to
load the item.
find in interface IdMethodquery - The query to use, which should have been prepared
using IdMethod.prepareQuery(DbControl, ItemQuery)identifier - The identifier of the item
IdMethod.isTrulyUnique() return true
the list is guaranteed to have at most one itempublic String toString()
toString in class Object
|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||