Data Loader based on DataLoader2 interface
The DataLoader2 interface is used to extract data which has a flat tabular structure, as opposed to data with an inherent hierarchy. This is the simplest way to extract tabular data. It requires no Data Helper class because it deals only with primitive data types.
The DataLoader2 interface defines the following four methods:
• public String[] getRequests()
This method should return a list of request names. A request is
tied to one set of output objects sharing the same class, and to one
set of parameters. Requests are presented in Style Studio and are selected
as part of a query, e.g:
public String[] getRequests() {
return new String[]
{"salesForEmployee", "salesForState"};
}
• public ObjectMetaData getRequestOutput(String request)
This method gets the output object type of a request. This method
must support all requests returned from the getRequests()
method, e.g:
public ObjectMetaData getRequestOutput(String request) {
if(request.equals(“salesForEmployee“)) {
return new ObjectMetaData(
new String[] {"Employee", "Sales", "Year"},
new Class[] {
(new String()).getClass(),
(new Float(0)).getClass(),
(new Integer(0)).getClass()
});
}
else if(request.equals(“salesForState“)){
....
}
}
• public ObjectMetaData getRequestParameter(String
request)
This method gets the request parameter type. The parameter can
be constructed when building a query and is passed to the data loaded
in execute().
public ObjectMetaData getRequestParameter(String request) {
if(request.equals(“salesForEmployee“)) {
return new ObjectMetaData(
new String[] {"fiscalYear"},
new Class[] {(new Integer(0)).getClass()});
}
else if(...) {
...
}
}
• public Object execute(String request, VariableTable
params, XSelection columns, XNodePath condition) throws ConditionNotSupportedException
This method executes a request. If any condition is defined, the
condition is passed to the execute() method.
The method may choose to handle the conditions, or throw a ConditionNotSupportedException. If the exception
is thrown, the engine will call execute() again
without the condition parameter passed in, and will handle the filtering
as part of the post processing. The following return types are supported:
XTable object, XTableNode
object, or a two-dimensional array in which the first row serves as the
column headers.
| << Data Loader based on DataLoader Interface | © 1996-2013 InetSoft Technology Corporation (v11.5) | Using a Data Helper >> |