Inherits QoreObjectWrapper.
|
| | Mapper (QoreObject obj) |
| |
| Object | getRuntime (String key) throws Throwable |
| |
| String | getFieldName (String fname) throws Throwable |
| |
| HashMap< String, Object > | validKeys () throws Throwable |
| |
| HashMap< String, Object > | validTypes () throws Throwable |
| |
| HashMap< String, Object > | optionKeys () throws Throwable |
| |
| HashMap< String, Object > | getInputRecord () throws Throwable |
| |
| HashMap< String, Object > | getOutputRecord () throws Throwable |
| |
| MapperOutputRecordIterator | getOutputIterator () throws Throwable |
| |
| void | commit () throws Throwable |
| |
| void | rollback () throws Throwable |
| |
| void | flushOutput () throws Throwable |
| |
| void | discardOutput () throws Throwable |
| |
| void | runAutonomous () throws Throwable |
| |
| HashMap< String, Object >[] | mapAll (Map< String, Object >[] recs) throws Throwable |
| |
| HashMap< String, Object >[] | mapAll (Map< String, Object > recs) throws Throwable |
| |
| HashMap< String, Object > | mapData (Map< String, Object > rec) throws Throwable |
| |
| Object | mapAuto (Object recs) throws Throwable |
| |
| Hash | mapBulk (Map< String, Object > rec, Map< String, Object > crec) throws Throwable |
| |
Java wrapper for the
- See also
- Mapper::Mapper class in Qore
- Note
- Loads and initializes the Qore library and the jni module in static initialization if necessary
- Deprecated:
- Use dynamic imports instead:
import qoremod.Mapper.Mapper;
◆ Mapper()
| org.qore.lang.mapper.Mapper.Mapper |
( |
QoreObject |
obj | ) |
|
|
inline |
creates the object as a wrapper for the Qore object
- Parameters
-
◆ commit()
| void org.qore.lang.mapper.Mapper.commit |
( |
| ) |
throws Throwable |
|
inline |
Commits data written to the output data provider if the output data provider supports transaction management Has no effect if the output data provider does not support transaction management
- Exceptions
-
| MAPPER-OUTPUT-PROVIDER-ERROR | no output provider available in this mapper |
◆ discardOutput()
| void org.qore.lang.mapper.Mapper.discardOutput |
( |
| ) |
throws Throwable |
|
inline |
Discards any buffered data This method should always be called if an error occurs in a bulk output operation
- Exceptions
-
| MAPPER-OUTPUT-BULK-ERROR | no output bulk operation is in progress |
◆ flushOutput()
| void org.qore.lang.mapper.Mapper.flushOutput |
( |
| ) |
throws Throwable |
|
inline |
Flushes any remaining data to the data provider This method should always be called for successful bulk output operations with an output provider
- Exceptions
-
| MAPPER-OUTPUT-BULK-ERROR | no output bulk operation is in progress |
◆ getFieldName()
| String org.qore.lang.mapper.Mapper.getFieldName |
( |
String |
fname | ) |
throws Throwable |
|
inline |
- Parameters
-
- Returns
- a descriptive name of the given field if possible, otherwise returns the field name itself
◆ getInputRecord()
| HashMap< String, Object > org.qore.lang.mapper.Mapper.getInputRecord |
( |
| ) |
throws Throwable |
|
inline |
- Note
- null is returned if no input record is set
- Returns
- the value of the
"input" option
◆ getOutputIterator()
- Returns
- an output record iterator that produces mapped data from the input data provider
- Exceptions
-
| MAPPER-INPUT-PROVIDER-ERROR | if no input_provider option was provided in the constructor or the input provider uses the request/response API |
◆ getOutputRecord()
| HashMap< String, Object > org.qore.lang.mapper.Mapper.getOutputRecord |
( |
| ) |
throws Throwable |
|
inline |
- Note
- null is returned if no output record is set
- Returns
- the value of the
"output" option
◆ getRuntime()
| Object org.qore.lang.mapper.Mapper.getRuntime |
( |
String |
key | ) |
throws Throwable |
|
inline |
get current
- See also
- mapper_runtime_handling "runtime option" value for a key
- Parameters
-
| key | the runtime option key |
- Returns
- a runtime value if the key exists in the current
- See also
- mapper_runtime_handling "runtime option hash" and is set
-
mapper_runtime_handling
- Since
- Mapper 1.1
◆ mapAll() [1/2]
| HashMap< String, Object >[] org.qore.lang.mapper.Mapper.mapAll |
( |
Map< String, Object > |
recs | ) |
throws Throwable |
|
inline |
maps all input records and returns the mapped data as a list of output records this method applies the
- See also
- mapData() method to all input records and returns the resulting list
- Parameters
-
| recs | a Map<String, Object> of lists of input records |
- Returns
- the mapped data as a list of output records
- Exceptions
-
| MISSING-INPUT | a field marked mandatory is missing |
| STRING-TOO-LONG | a field value exceeds the maximum value and the 'trunc' key is not set |
| INVALID-NUMBER | the field is marked as numeric but the input value contains non-numeric data |
◆ mapAll() [2/2]
| HashMap< String, Object >[] org.qore.lang.mapper.Mapper.mapAll |
( |
Map< String, Object >[] |
recs | ) |
throws Throwable |
|
inline |
maps all input records and returns the mapped data as a list of output records this method applies the
- See also
- mapData() method to all input records and returns the resulting list
- Parameters
-
| recs | the list of input records |
- Returns
- the mapped data as a list of output records
- Exceptions
-
| MISSING-INPUT | a field marked mandatory is missing |
| STRING-TOO-LONG | a field value exceeds the maximum value and the 'trunc' key is not set |
| INVALID-NUMBER | the field is marked as numeric but the input value contains non-numeric data |
◆ mapAuto()
| Object org.qore.lang.mapper.Mapper.mapAuto |
( |
Object |
recs | ) |
throws Throwable |
|
inline |
maps all input record(s) automatically and returns the mapped data this method applies the
- See also
- mapAll() method if the input records are given as list and the
-
mapBulk() method if the input is a Map<String, Object> of lists. For a simple Map<String, Object> (one record) it calls the
-
mapData() method.
- Parameters
-
| recs | input records (one record or more), can be represented by list or Map<String, Object> |
- Returns
- the mapped data as of output records (type depends on the given records' type)
- Exceptions
-
| MISSING-INPUT | a field marked mandatory is missing |
| STRING-TOO-LONG | a field value exceeds the maximum value and the 'trunc' key is not set |
| INVALID-NUMBER | the field is marked as numeric but the input value contains non-numeric data |
| MAPPER-INPUT-TYPE-ERROR | records input type is not acceptable |
- Since
- Mapper 1.6
◆ mapBulk()
| Hash org.qore.lang.mapper.Mapper.mapBulk |
( |
Map< String, Object > |
rec, |
|
|
Map< String, Object > |
crec |
|
) |
| throws Throwable |
|
inline |
maps a set of records in Map<String, Object> of lists format; returns mapped data in a Hash of lists format
- Example:
Hash output = mapper.mapBulk(h);
- Parameters
-
| rec | the input record or record set in case a Map<String, Object> of lists is passed |
| crec | an optional Map<String, Object> of data to be added to each input row before mapping |
- Returns
- returns a Hash of lists of mapped data
- Note
- using a Map<String, Object> of lists in rec; note that this provides very high performance when used with data provider output that support bulk write operations
- in case a Map<String, Object> of empty lists is passed, null is returned
- 'crec' does not affect the number of output lines; in particular, if 'rec' is a batch with
N rows of a column C and 'crec = {"C": "mystring"}' then the output will be as if there was 'N' rows with C = "mystring" on the input.
- See also
- flushOutput()
- discardOutput()
- Exceptions
-
| MISSING-INPUT | a field marked mandatory is missing |
| STRING-TOO-LONG | a field value exceeds the maximum value and the 'trunc' key is not set |
| INVALID-NUMBER | the field is marked as numeric but the input value contains non-numeric data |
◆ mapData()
| HashMap< String, Object > org.qore.lang.mapper.Mapper.mapData |
( |
Map< String, Object > |
rec | ) |
throws Throwable |
|
inline |
processes the input record and returns a Map<String, Object> of the mapped values where the keys in the Map<String, Object> returned are the target field names; the order of the fields in the Map<String, Object> returned is the same order as the keys in the map hash.
- Parameters
-
| rec | the record to translate |
- Returns
- a Map<String, Object> of field values in the target format based on the input data and processed according to the logic in the map hash
- Exceptions
-
| MISSING-INPUT | a field marked mandatory is missing |
| STRING-TOO-LONG | a field value exceeds the maximum value and the 'trunc' key is not set |
| INVALID-NUMBER | the field is marked as numeric but the input value contains non-numeric data |
- Note
- each time this method is executed successfully, the record count is updated (see
- See also
- getCount() and
-
resetCount())
-
Mapper::Mapper::mapDataIntern() to map the data, then
-
Mapper::Mapper::logOutput() is called for each output row
◆ optionKeys()
| HashMap< String, Object > org.qore.lang.mapper.Mapper.optionKeys |
( |
| ) |
throws Throwable |
|
inline |
- Returns
- a list of valid constructor options for this class (can be overridden in subclasses)
◆ rollback()
| void org.qore.lang.mapper.Mapper.rollback |
( |
| ) |
throws Throwable |
|
inline |
Rolls back data written to the output data provider Has no effect if the output data provider does not support transaction management
- Exceptions
-
| MAPPER-OUTPUT-PROVIDER-ERROR | no output provider available in this mapper |
◆ runAutonomous()
| void org.qore.lang.mapper.Mapper.runAutonomous |
( |
| ) |
throws Throwable |
|
inline |
Runs the input and output mappers with data providers on each end autonomously
- Exceptions
-
| MAPPER-INPUT-PROVIDER-ERROR | no input provider available in this mapper |
| MAPPER-OUTPUT-PROVIDER-ERROR | no output provider available in this mapper |
◆ validKeys()
| HashMap< String, Object > org.qore.lang.mapper.Mapper.validKeys |
( |
| ) |
throws Throwable |
|
inline |
- Returns
- a list of valid field keys for this class (can be overridden in subclasses)
◆ validTypes()
| HashMap< String, Object > org.qore.lang.mapper.Mapper.validTypes |
( |
| ) |
throws Throwable |
|
inline |
- Returns
- a list of valid types for this class (can be overridden in subclasses)
The documentation for this class was generated from the following file:
- /tmp/module-jni/src/java/org/qore/lang/mapper/Mapper.java