Class MultiPropertyIdMethod
java.lang.Object
net.sf.basedb.plugins.batchimport.MultiPropertyIdMethod
- All Implemented Interfaces:
IdMethod
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.
- Version:
- 2.8
- Author:
- nicklas
- Last modified
- $Date: 2016-03-08 13:22:23 +0100 (ti, 08 mar 2016) $
-
Field Summary
Modifier and TypeFieldDescriptionprivate final String
static final MultiPropertyIdMethod
Use the name or barcode for finding items.static final MultiPropertyIdMethod
Use the name or external ID for finding items.static final MultiPropertyIdMethod
Use the name or system Id for finding items.static final MultiPropertyIdMethod
Use the name or unit symbol for finding items.private final String[]
private final String
private final boolean
private final Type
-
Constructor Summary
ConstructorDescriptionMultiPropertyIdMethod
(String method, String title, String[] properties, boolean unique, Type valueType) Create a new id method. -
Method Summary
Modifier and TypeMethodDescriptionFind all items withproperty[0] = identifier
, or property[1] = identifier, ....The name of this method, which should be unique among the methods that can be used at a given time.getTitle()
The display title of the method.boolean
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 ....
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.basedb.plugins.batchimport.IdMethod
setIdentifierOnNewItem
-
Field Details
-
NAME_OR_EXTERNALID
Use the name or external ID for finding items. -
NAME_OR_BARCODE
Use the name or barcode for finding items. -
NAME_OR_SYSTEMID
Use the name or system Id for finding items.- Since:
- 3.0
-
NAME_OR_UNITSYMBOL
Use the name or unit symbol for finding items. Can be used for finding units.- Since:
- 3.8
-
method
-
properties
-
title
-
unique
private final boolean unique -
valueType
-
-
Constructor Details
-
MultiPropertyIdMethod
public MultiPropertyIdMethod(String method, String title, String[] properties, boolean unique, Type valueType) Create a new id method.- Parameters:
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 values
-
-
Method Details
-
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. -
getTitle
Description copied from interface:IdMethod
The display title of the method. -
getColumnMappingParameterName
- Specified by:
getColumnMappingParameterName
in interfaceIdMethod
-
isTrulyUnique
public boolean isTrulyUnique()Description copied from interface:IdMethod
If the identification method is truly unique or not. If this method returns true, theIdMethod.find(DbControl, ItemQuery, String)
method will never ever return a list with more than one item.- Specified by:
isTrulyUnique
in interfaceIdMethod
-
prepareQuery
Adds a restriction to the query:property[0] = :identifier OR property[1] = :identifier ....
- Specified by:
prepareQuery
in interfaceIdMethod
query
- The query to prepare- Returns:
- The query that is used for item lookup
-
find
Find all items withproperty[0] = identifier
, or property[1] = identifier, ....- Specified by:
find
in interfaceIdMethod
query
- The query to use, which should have been prepared usingIdMethod.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
-
getValueType
-