Class DbSeriesBuilder
java.lang.Object
com.inet.taskplanner.server.api.series.DbSeriesBuilder
Use this to easily create Series definitions which loads data from a database. This Series performs a SQL-Query and
constructs a series with the values of one row.
Note that this builder does not validate the settings, use
Note that this builder does not validate the settings, use
TaskDefinition.validate()
to check for errors.
Example usage:
TaskDefinition task = new TaskDefinition("mytask");
SeriesDefinition definition = new DbSeriesBuilder()
.withUrl("jdbc:mysql://server:3306/databaseOne")
.withUsername("alfred")
.withPassword("xyz")
.withSql("Select * from tblUser where status = 1")
.create();
task.setSeries( definition );
// .. add jobs, actions and triggers ...
TaskPlanner.getInstance().addTask( task );
- Since:
- taskplanner 3.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate()
Finish building and create a series definition.withPassword
(String password) Set the password for the user to log in the database.Set the SQL query to use for data loading.Set the JDBC url to your database server.
Example: "jdbc:mysql://server:3306/databaseOne"withUsername
(String user) Set the username to use to log in the database.
-
Constructor Details
-
DbSeriesBuilder
public DbSeriesBuilder()
-
-
Method Details
-
withUrl
Set the JDBC url to your database server.
Example: "jdbc:mysql://server:3306/databaseOne"- Parameters:
url
- the URl to your database- Returns:
- this builder instance
- Throws:
IllegalArgumentException
- if url is null or empty- Since:
- taskplanner 3.0
-
withSql
Set the SQL query to use for data loading.- Parameters:
sql
- the sql query- Returns:
- this builder instance
- Throws:
IllegalArgumentException
- if sql is null or empty- Since:
- taskplanner 3.0
-
withPassword
Set the password for the user to log in the database.- Parameters:
password
- the password to use- Returns:
- this builder instance
- Since:
- taskplanner 3.0
-
withUsername
Set the username to use to log in the database.- Parameters:
user
- the user to use- Returns:
- this builder instance
- Since:
- taskplanner 3.0
-
create
Finish building and create a series definition.- Returns:
- a definition for the database series
- Since:
- taskplanner 3.0
-