public class StatementFormat
extends java.lang.Object
StatementFormat
or by calling format
.
Examples of values include:
StatementFormat
.
This resource domain in this example INPUT_EXPRESSIONS
can have dependencies, just as the other two special resource domains can. You declare when you call the
setResourceDomain
method. All dependencies except the last one are used to generate a suggested field name. The last dependency should point to a parameter with a field type. The Adapter Service Editor or Adapter Notification Editor uses this information to populate a choice with values (such as "%field1%") and to create fields in the input signature with the appropriate types.
In the following example, the adapter service class contains a parameter called sqlStatement, which stores the SQL statement:
private String sqlStatement; public void setsqlStatement{String str) { sqlStatement = str; } .... public void execute(WmManagedConnection con, WmRecord input) throws ResourceException { StatementFormat st = new StatementFormat(sqlFormat); st.format(input); //execute the sql statement. } public void fillWmTemplateDescriptor(WmTemplateDescriptor d, java.util.Locale) { ... d.setResourceDomain("sqlStatement", WmTemplateDescriptor.INPUT_EXPRESSIONS, null); ... }
Constructor and Description |
---|
StatementFormat(java.lang.String statement)
Formats and parses the statement using the default
delimiter (%) and escape character (\).
|
StatementFormat(java.lang.String statement,
char begin_delim,
char end_delim,
char escape)
Formats and parses the statement using the specified delimiter
and escape character.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
format(WmRecord rec)
Replaces the reference string with the value(s) of the input record and
re-establishs the statement.
|
java.util.Vector |
getFieldList() |
java.util.Vector |
getTokenList() |
protected java.util.Vector |
preparse(java.lang.String statement) |
public StatementFormat(java.lang.String statement)
statement
- the statement to be processedpublic StatementFormat(java.lang.String statement, char begin_delim, char end_delim, char escape)
statement
- the statement to be processedbegin_delim
- the beginning delimiter for the reference stringend_delim
- the ending delimiter for the reference stringescape
- the escape characterpublic java.lang.String format(WmRecord rec)
rec
- the input recordpublic java.util.Vector getFieldList()
public java.util.Vector getTokenList()
protected java.util.Vector preparse(java.lang.String statement)
Copyright © 2003 - 2021 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.