Java Reference
In-Depth Information
same techniques: JDBC for some data manipulations and JDM to
create clustering models.
Again, for the sake of simplicity, we will implement all services of
the business layer in a single class called
CustomerSegmenter
.
12.3.3
Code Examples
This section details the code of the
CustomerSegmenter
class that
follows the steps described in the previous section. As presented ear-
lier, the constructor creates a new campaign optimization object with
a name and a creation date. Because our object must deal with some
basic data manipulations as well as data mining operations, we pro-
vide it with two valid connections (JDBC and JDM). This is reflected
in the following constructor:
1. public CustomerSegmenter(String iName,
2. java.sql.Connection iJDBCConnection,
3. Connection iJDMConnection) {
4.
mName
iName;
5.
mCreationDate
Calendar.getInstance().getTime();
6.
mJDBCConnection
iJDBCConnection;
7.
mJDMConnection
iJDMConnection;
8. }
The following sections detail the code of the
CustomerSegmenter
class that follows the steps described earlier. The first step consists of
extracting some file to be provided to TSB for enhancement. This
code is very similar to the one described in the
CampaignOptimizer
project except that no sampling is involved. This code starts with the
name of the table containing at least the customer identifier, name,
and address as
iCustomerTableName
. These attributes are mandatory
to allow the recognition of the individuals by the enhancement ser-
vice and they are provided as a list of names in
iColumnNames
. The
identifier attribute must also be provided because it will be the one
used to reconcile the data provided by TSB with the customer data-
base. Finally, the table name to be generated is provided in
iOutput-
TableName
.
1. public void export(String iCustomerTableName,
2.
Collection iColumnNames,
3.
String iIdentifierColumnName,
4.
String iOutputTableName)
Search WWH ::
Custom Search