|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.plugins.batchimport.MultiPropertyIdMethod
public class MultiPropertyIdMethod
Identification method implementation that can use a multiple properties (eg, name, id, externalId, etc.) for identifying items. Each property is tried in turn and a result is returned as soon as the query returns at least one result.
Field Summary | |
---|---|
private String |
method
|
static MultiPropertyIdMethod |
NAME_OR_BARCODE
Use the name or barcode for finding items. |
static MultiPropertyIdMethod |
NAME_OR_EXTERNALID
Use the name or external ID for finding items. |
private String[] |
properties
|
private String |
title
|
private boolean |
unique
|
private Type |
valueType
|
Constructor Summary | |
---|---|
MultiPropertyIdMethod(String method,
String title,
String[] properties,
boolean unique,
Type valueType)
Create a new id method. |
Method Summary | ||
---|---|---|
|
find(DbControl dc,
ItemQuery<I> query,
String identifier)
Find all items with property[0] = identifier ,
or property[1] = identifier, .... |
|
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. |
|
Type |
getValueType()
|
|
boolean |
isTrulyUnique()
If the identification method is truly unique or not. |
|
|
prepareQuery(DbControl dc,
ItemQuery<I> query)
Adds a restriction to the query: property[0] = :identifier OR property[1] = :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 MultiPropertyIdMethod NAME_OR_EXTERNALID
public static final MultiPropertyIdMethod NAME_OR_BARCODE
private final String method
private final String[] properties
private final String title
private final boolean unique
private final Type valueType
Constructor Detail |
---|
public MultiPropertyIdMethod(String method, String title, String[] properties, boolean unique, Type valueType)
method
- The method name, which should be unique among all methodstitle
- The title to use for display purposesproperties
- The name of the properties to filter on when using this
id methodunique
- If this property is guaranteed to be unique or notvalueType
- The type of valuesMethod Detail |
---|
public String getMethod()
IdMethod
getMethod
in interface IdMethod
public String getTitle()
IdMethod
getTitle
in interface IdMethod
public String getColumnMappingParameterName()
getColumnMappingParameterName
in interface IdMethod
public boolean isTrulyUnique()
IdMethod
IdMethod.find(DbControl, ItemQuery, String)
method will
never ever return a list with more than one item.
isTrulyUnique
in interface IdMethod
public <I extends BasicItem> ItemQuery<I> prepareQuery(DbControl dc, ItemQuery<I> query)
property[0] = :identifier OR property[1] = :identifier ....
prepareQuery
in interface IdMethod
query
- The query to prepare
public <I extends BasicItem> List<I> find(DbControl dc, ItemQuery<I> query, String identifier)
property[0] = identifier
,
or property[1] = identifier, ....
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
IdMethod.isTrulyUnique()
return true
the list is guaranteed to have at most one itempublic String toString()
toString
in class Object
public Type getValueType()
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |