Java Reference
In-Depth Information
To be complete, we expose the code of the
saveBuildSettingsAnd-
ExecuteTask
method, which saves the task object before execution.
1. private ExecutionHandle saveBuildSettingsAndExecuteTask(
2.
String iFunctionName,
3.
String iDatasetName,
4.
BuildSettings iBuildSettings) throws JDMException {
5.
String lBuildSettingsName
6.
getBuildSettingsName(iFunctionName,
7.
mModelNameTextField.getText());
8.
mDmeConn.saveObject(lBuildSettingsName,
9.
iBuildSettings,
10.
mOverwriteCheckBox.isSelected());
11.
BuildTaskFactory lBuildTaskFactory
12.
(BuildTaskFactory) mDmeConn.getFactory(
13.
"javax.datamining.task.BuildTask");
14.
BuildTask lBuildTask
15.
lBuildTaskFactory.create(
16.
iDatasetName,
17.
lBuildSettingsName,
18.
mModelNameTextField.getText());
19.
VerificationReport lVerifTask
lBuildTask.verify();
20.
if (lVerifTask !
null) {
21.
displayLongMessage(this, "Wrong Task",
22.
lVerifTask.getReportText(),
23.
JOptionPane.INFORMATION_MESSAGE);
24.
return null;
25.
}
26.
27.
String lTaskName
iFunctionName
"Task_"
28.
mModelNameTextField.getText();
29.
if (lTaskName.length() > getMaxNameLength()) {
30.
displayLongMessage(this, "String Too Long",
31.
"The task name is too long, please change "
32.
"your model name.",
33.
JOptionPane.ERROR_MESSAGE);
34.
return null;
35.
}
36.
mDmeConn.saveObject(lTaskName, lBuildTask,
37.
mOverwriteCheckBox.isSelected());
38.
// Run the task.
39.
return mDmeConn.execute(lTaskName);
40.}
Both the
BuildSettings
and the
Task
are saved in this method. Note
that the value of the check box indicating that the objects should be
overwritten is used each time a named object is saved to the MOR. If
this is not checked, the operation will fail if there is an object with the
same name in the MOR. The
BuildSettings
name is based on the
Search WWH ::
Custom Search