public abstract class AbstractCustomWrapper extends Object implements CustomWrapper
CustomWrapper
. Subclasses need only to
implement the methods CustomWrapper#getSchemaParameters
and
CustomWrapper#run
, as default implementations for the rest of the
required methods are provided.
Nevertheless, the user is encouraged to override any of the methods provided by this class if necessary.
Modifier and Type | Field and Description |
---|---|
protected static int |
LOG_DEBUG
'Debug' log level
|
protected static int |
LOG_ERROR
'Error' log level
|
protected static int |
LOG_FATAL
'Fatal' log level
|
protected static int |
LOG_INFO
'Info' log level
|
protected static int |
LOG_TRACE
'Trace' log level
|
protected static int |
LOG_WARN
'Warn' log level
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractCustomWrapper() |
Modifier and Type | Method and Description |
---|---|
void |
commit()
By default, does nothing.
|
int |
delete(CustomWrapperConditionHolder condition,
Map<String,String> inputValues)
By default, does nothing and returns
0 . |
CustomWrapperConfiguration |
getConfiguration()
By default, returns a
CustomWrapperConfiguration instance with
all the configuration parameters set to their default values. |
CustomWrapperPlan |
getCustomWrapperPlan()
Returns the
CustomWrapperPlan of the current wrapper execution. |
CustomWrapperInputParameter[] |
getInputParameters()
By default, an empty array is returned.
|
protected CustomWrapperInputParameterValue |
getInputParameterValue(String name)
Returns the actual
CustomWrapperInputParameterValue associated to
the CustomWrapperInputParameter specified by the name. |
protected List<CustomWrapperOrderByExpression> |
getOrderByExpressions()
If the Custom Wrapper declares in the
CustomWrapperConfiguration
that it supports orderBy delegations, it returns a List with the
expressions in the ORDER BY clause delegated to the custom wrapper. |
int |
insert(Map<CustomWrapperFieldExpression,Object> insertValues,
Map<String,String> inputValues)
By default, does nothing and returns
0 . |
protected void |
log(int level,
String logMessage)
Adds an entry log, with the specified level.
|
void |
prepare()
By default, does nothing.
|
void |
rollback()
By default, does nothing.
|
void |
setInputParameterValues(Map<String,CustomWrapperInputParameterValue> paramValues)
Sets the input parameter values with type information.
|
void |
setOrderByExpressions(List<CustomWrapperOrderByExpression> orderByExpressions)
Sets the order by expressions when they are delegated to the source
|
boolean |
stop()
By default, does nothing and returns
false . |
int |
update(Map<CustomWrapperFieldExpression,Object> updateValues,
CustomWrapperConditionHolder condition,
Map<String,String> inputValues)
By default, does nothing and returns
0 . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSchemaParameters, run
protected static final int LOG_TRACE
protected static final int LOG_DEBUG
protected static final int LOG_INFO
protected static final int LOG_WARN
protected static final int LOG_ERROR
protected static final int LOG_FATAL
public CustomWrapperInputParameter[] getInputParameters()
getInputParameters
in interface CustomWrapper
CustomWrapperInputParameter
CustomWrapperInputParameter
public int insert(Map<CustomWrapperFieldExpression,Object> insertValues, Map<String,String> inputValues) throws CustomWrapperException
0
.insert
in interface CustomWrapper
insertValues
- a Map<CustomWrapperFieldExpression, Object> which associates
fields with values, in similar fashion to the INSERT
statement in SQL
.inputValues
- a Map<String, String> which associates this Custom Wrapper's
input parameters' names (as defined in CustomWrapper.getInputParameters()
) with their
current values.CustomWrapperException
CustomWrapperFieldExpression
public int delete(CustomWrapperConditionHolder condition, Map<String,String> inputValues) throws CustomWrapperException
0
.delete
in interface CustomWrapper
condition
- the deletion condition (akin to the WHERE
clause in
a SQL
DELETE
statement).inputValues
- a Map<String, String> which associates this Custom Wrapper's
input parameters' names (as defined in CustomWrapper.getInputParameters()
) with their
current values.CustomWrapperException
CustomWrapperConditionHolder
public int update(Map<CustomWrapperFieldExpression,Object> updateValues, CustomWrapperConditionHolder condition, Map<String,String> inputValues) throws CustomWrapperException
0
.update
in interface CustomWrapper
updateValues
- a Map<CustomWrapperFieldExpression, Object> which associates fields with values, in similar
fashion to the UPDATE
statement in SQL
. The value can be a literal expressed
as a Java object or a field expressed as a CustomWrapperFieldExpression
condition
- the insert condition (akin to the WHERE
clause in a SQL
UPDATE
statement).inputValues
- a Map<String, String> which associates this Custom Wrapper's input parameters' names (as defined
in CustomWrapper.getInputParameters()
) with their current values.CustomWrapperException
CustomWrapperFieldExpression
,
CustomWrapperConditionHolder
public void commit()
commit
in interface CustomWrapper
public void rollback()
rollback
in interface CustomWrapper
public void prepare()
prepare
in interface CustomWrapper
public boolean stop()
false
.stop
in interface CustomWrapper
true
if this Custom Wrapper can stop its execution,
false
otherwise.public CustomWrapperConfiguration getConfiguration()
CustomWrapperConfiguration
instance with
all the configuration parameters set to their default values.getConfiguration
in interface CustomWrapper
CustomWrapperConfiguration
instance defining this Custom Wrapper
configuration parameters.public final void setInputParameterValues(Map<String,CustomWrapperInputParameterValue> paramValues)
paramValues
- input parameter values to be setprotected final CustomWrapperInputParameterValue getInputParameterValue(String name)
CustomWrapperInputParameterValue
associated to
the CustomWrapperInputParameter
specified by the name.name
- the name of the CustomWrapperInputParameter
whose
CustomWrapperInputParameterValue
is returned.CustomWrapperInputParameterValue
associated to
the CustomWrapperInputParameter
specified by the name.public final void setOrderByExpressions(List<CustomWrapperOrderByExpression> orderByExpressions)
orderByExpressions
- order by expressions to be setprotected final List<CustomWrapperOrderByExpression> getOrderByExpressions()
CustomWrapperConfiguration
that it supports orderBy delegations, it returns a List
with the
expressions in the ORDER BY clause delegated to the custom wrapper.List
with the expressions in the ORDER BY clause
delegated to the custom wrapper.protected final void log(int level, String logMessage)
level
- the desired log level. Should be one of these:
AbstractCustomWrapper#LOG_TRACE
AbstractCustomWrapper#LOG_DEBUG
AbstractCustomWrapper#LOG_INFO
AbstractCustomWrapper#LOG_WARN
AbstractCustomWrapper#LOG_ERROR
AbstractCustomWrapper#LOG_FATAL
logMessage
- the message to be logged.public CustomWrapperPlan getCustomWrapperPlan()
CustomWrapperPlan
of the current wrapper execution.CustomWrapperPlan
of the current wrapper execution.Copyright © 2019 Denodo Technologies. All rights reserved.