Qore jni Module  1.2.0
org.qore.lang.mapper.Mapper Class Reference
Inheritance diagram for org.qore.lang.mapper.Mapper:
org.qore.jni.QoreObjectWrapper org.qore.lang.tablemapper.AbstractSqlStatementOutboundMapper org.qore.lang.tablemapper.InboundTableMapper org.qore.lang.tablemapper.RawSqlStatementOutboundMapper org.qore.lang.tablemapper.SqlStatementOutboundMapper org.qore.lang.tablemapper.InboundIdentityTableMapper

Public Member Methods

 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
 
- Public Member Methods inherited from org.qore.jni.QoreObjectWrapper
 QoreObjectWrapper (QoreObject obj)
 creates the wrapper object with the Qore object
 
void release ()
 releases the Qore object; do not call any further methods on the object after this call
 
QoreObject getQoreObject ()
 returns the Qore object
 
String className ()
 returns the class name for the Qore object
 
boolean instanceOf (String class_name)
 returns true if the object is an instance of the given class
 

Additional Inherited Members

- Private Attributes inherited from org.qore.jni.QoreObjectWrapper
QoreObject obj
 the wrapper Qore object
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Mapper()

org.qore.lang.mapper.Mapper.Mapper ( QoreObject  obj)
inline

creates the object as a wrapper for the Qore object

Parameters
objthe Qore object

Member Function Documentation

◆ 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-ERRORno output provider available in this mapper

Reimplemented in org.qore.lang.tablemapper.InboundTableMapper, and org.qore.lang.tablemapper.AbstractSqlStatementOutboundMapper.

◆ 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-ERRORno 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-ERRORno output bulk operation is in progress

◆ getFieldName()

String org.qore.lang.mapper.Mapper.getFieldName ( String  fname) throws Throwable
inline
Parameters
fnamethe field
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()

MapperOutputRecordIterator org.qore.lang.mapper.Mapper.getOutputIterator ( ) throws Throwable
inline
Returns
an output record iterator that produces mapped data from the input data provider
Exceptions
MAPPER-INPUT-PROVIDER-ERRORif 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
keythe 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
recsa Map<String, Object> of lists of input records
Returns
the mapped data as a list of output records
Exceptions
MISSING-INPUTa field marked mandatory is missing
STRING-TOO-LONGa field value exceeds the maximum value and the 'trunc' key is not set
INVALID-NUMBERthe 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
recsthe list of input records
Returns
the mapped data as a list of output records
Exceptions
MISSING-INPUTa field marked mandatory is missing
STRING-TOO-LONGa field value exceeds the maximum value and the 'trunc' key is not set
INVALID-NUMBERthe 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
recsinput 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-INPUTa field marked mandatory is missing
STRING-TOO-LONGa field value exceeds the maximum value and the 'trunc' key is not set
INVALID-NUMBERthe field is marked as numeric but the input value contains non-numeric data
MAPPER-INPUT-TYPE-ERRORrecords 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
recthe input record or record set in case a Map<String, Object> of lists is passed
crecan 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
Exceptions
MISSING-INPUTa field marked mandatory is missing
STRING-TOO-LONGa field value exceeds the maximum value and the 'trunc' key is not set
INVALID-NUMBERthe 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
recthe 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-INPUTa field marked mandatory is missing
STRING-TOO-LONGa field value exceeds the maximum value and the 'trunc' key is not set
INVALID-NUMBERthe 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())
  • uses
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-ERRORno output provider available in this mapper

Reimplemented in org.qore.lang.tablemapper.InboundTableMapper, and org.qore.lang.tablemapper.AbstractSqlStatementOutboundMapper.

◆ 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-ERRORno input provider available in this mapper
MAPPER-OUTPUT-PROVIDER-ERRORno 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: