Search in sources :

Example 6 with TransDependency

use of org.pentaho.di.trans.TransDependency in project pentaho-kettle by pentaho.

the class TransDialog method getData.

/**
 * Copy information from the meta-data input to the dialog fields.
 */
public void getData() {
    wTransname.setText(Const.NVL(transMeta.getName(), ""));
    wTransFilename.setText(Const.NVL(transMeta.getFilename(), ""));
    wTransdescription.setText(Const.NVL(transMeta.getDescription(), ""));
    wExtendeddescription.setText(Const.NVL(transMeta.getExtendedDescription(), ""));
    wTransversion.setText(Const.NVL(transMeta.getTransversion(), ""));
    wTransstatus.select(transMeta.getTransstatus() - 1);
    if (transMeta.getCreatedUser() != null) {
        wCreateUser.setText(transMeta.getCreatedUser());
    }
    if (transMeta.getCreatedDate() != null) {
        wCreateDate.setText(transMeta.getCreatedDate().toString());
    }
    if (transMeta.getModifiedUser() != null) {
        wModUser.setText(transMeta.getModifiedUser());
    }
    if (transMeta.getModifiedDate() != null) {
        wModDate.setText(transMeta.getModifiedDate().toString());
    }
    if (transMeta.getMaxDateConnection() != null) {
        wMaxdateconnection.setText(transMeta.getMaxDateConnection().getName());
    }
    if (transMeta.getMaxDateTable() != null) {
        wMaxdatetable.setText(transMeta.getMaxDateTable());
    }
    if (transMeta.getMaxDateField() != null) {
        wMaxdatefield.setText(transMeta.getMaxDateField());
    }
    wMaxdateoffset.setText(Double.toString(transMeta.getMaxDateOffset()));
    wMaxdatediff.setText(Double.toString(transMeta.getMaxDateDifference()));
    // The dependencies
    for (int i = 0; i < transMeta.nrDependencies(); i++) {
        TableItem item = wFields.table.getItem(i);
        TransDependency td = transMeta.getDependency(i);
        DatabaseMeta conn = td.getDatabase();
        String table = td.getTablename();
        String field = td.getFieldname();
        if (conn != null) {
            item.setText(1, conn.getName());
        }
        if (table != null) {
            item.setText(2, table);
        }
        if (field != null) {
            item.setText(3, field);
        }
    }
    // The named parameters
    String[] parameters = transMeta.listParameters();
    for (int idx = 0; idx < parameters.length; idx++) {
        TableItem item = wParamFields.table.getItem(idx);
        String defValue;
        try {
            defValue = transMeta.getParameterDefault(parameters[idx]);
        } catch (UnknownParamException e) {
            defValue = "";
        }
        String description;
        try {
            description = transMeta.getParameterDescription(parameters[idx]);
        } catch (UnknownParamException e) {
            description = "";
        }
        item.setText(1, parameters[idx]);
        item.setText(2, Const.NVL(defValue, ""));
        item.setText(3, Const.NVL(description, ""));
    }
    wSizeRowset.setText(Integer.toString(transMeta.getSizeRowset()));
    wUniqueConnections.setSelection(transMeta.isUsingUniqueConnections());
    wShowFeedback.setSelection(transMeta.isFeedbackShown());
    wFeedbackSize.setText(Integer.toString(transMeta.getFeedbackSize()));
    wSharedObjectsFile.setText(Const.NVL(transMeta.getSharedObjectsFile(), ""));
    wManageThreads.setSelection(transMeta.isUsingThreadPriorityManagment());
    wTransformationType.setText(transMeta.getTransformationType().getDescription());
    wFields.setRowNums();
    wFields.optWidth(true);
    wParamFields.setRowNums();
    wParamFields.optWidth(true);
    // Directory:
    if (transMeta.getRepositoryDirectory() != null && transMeta.getRepositoryDirectory().getPath() != null) {
        wDirectory.setText(transMeta.getRepositoryDirectory().getPath());
    }
    // Performance monitoring tab:
    // 
    wEnableStepPerfMonitor.setSelection(transMeta.isCapturingStepPerformanceSnapShots());
    wStepPerfInterval.setText(Long.toString(transMeta.getStepPerformanceCapturingDelay()));
    wStepPerfMaxSize.setText(Const.NVL(transMeta.getStepPerformanceCapturingSizeLimit(), ""));
    if (rep == null) {
        wTransname.selectAll();
        wTransname.setFocus();
    }
    for (TransDialogPluginInterface extraTab : extraTabs) {
        try {
            extraTab.getData(transMeta);
        } catch (Exception e) {
            new ErrorDialog(shell, "Error", "Error adding extra plugin tab", e);
        }
    }
    setFlags();
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) TransDependency(org.pentaho.di.trans.TransDependency) UnknownParamException(org.pentaho.di.core.parameters.UnknownParamException) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) DuplicateParamException(org.pentaho.di.core.parameters.DuplicateParamException) UnknownParamException(org.pentaho.di.core.parameters.UnknownParamException) KettleException(org.pentaho.di.core.exception.KettleException) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException)

Aggregations

TransDependency (org.pentaho.di.trans.TransDependency)6 KettleException (org.pentaho.di.core.exception.KettleException)5 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)4 StepMeta (org.pentaho.di.trans.step.StepMeta)3 TableItem (org.eclipse.swt.widgets.TableItem)2 SlaveServer (org.pentaho.di.cluster.SlaveServer)2 NotePadMeta (org.pentaho.di.core.NotePadMeta)2 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)2 DuplicateParamException (org.pentaho.di.core.parameters.DuplicateParamException)2 UnknownParamException (org.pentaho.di.core.parameters.UnknownParamException)2 PartitionSchema (org.pentaho.di.partition.PartitionSchema)2 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)2 LongObjectId (org.pentaho.di.repository.LongObjectId)2 ObjectId (org.pentaho.di.repository.ObjectId)2 TransHopMeta (org.pentaho.di.trans.TransHopMeta)2 StepErrorMeta (org.pentaho.di.trans.step.StepErrorMeta)2 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)2 MessageBox (org.eclipse.swt.widgets.MessageBox)1 ClusterSchema (org.pentaho.di.cluster.ClusterSchema)1 Condition (org.pentaho.di.core.Condition)1