Search in sources :

Example 6 with DimensionField

use of org.pentaho.di.palo.core.DimensionField in project pentaho-kettle by pentaho.

the class PaloCellInputDialog method getInfo.

private void getInfo(PaloCellInputMeta myMeta) throws KettleException {
    stepname = textStepName.getText();
    List<DimensionField> fields = new ArrayList<DimensionField>();
    for (int i = 0; i < tableViewFields.table.getItemCount(); i++) {
        DimensionField field = new DimensionField(tableViewFields.table.getItem(i).getText(1), tableViewFields.table.getItem(i).getText(2), tableViewFields.table.getItem(i).getText(3));
        fields.add(field);
    }
    myMeta.setDatabaseMeta(transMeta.findDatabase(addConnectionLine.getText()));
    myMeta.setCubeMeasureName(new DimensionField("Measure", textMeasureName.getText(), comboMeasureType.getText()));
    myMeta.setLevels(fields);
    myMeta.setCube(comboCube.getText());
    myMeta.setChanged(true);
}
Also used : DimensionField(org.pentaho.di.palo.core.DimensionField) ArrayList(java.util.ArrayList)

Example 7 with DimensionField

use of org.pentaho.di.palo.core.DimensionField in project pentaho-kettle by pentaho.

the class PaloCellInputDialog method fillStoredData.

private void fillStoredData() {
    if (stepname != null) {
        textStepName.setText(stepname);
    }
    int index = addConnectionLine.indexOf(meta.getDatabaseMeta() != null ? meta.getDatabaseMeta().getName() : "");
    if (index >= 0) {
        addConnectionLine.select(index);
    }
    tableViewFields.table.removeAll();
    if (meta.getFields().size() > 0) {
        for (DimensionField level : meta.getFields()) {
            tableViewFields.add(level.getDimensionName(), level.getFieldName(), level.getFieldType());
        }
        tableViewFields.setRowNums();
        tableViewFields.optWidth(true);
    }
    if (meta.getCube() != null) {
        comboCube.add(meta.getCube());
        comboCube.select(0);
    }
    comboMeasureType.setItems(new String[] { "String", "Number" });
    if (meta.getCubeMeasure() != null) {
        if (meta.getCubeMeasure().getFieldType() != null) {
            int indexType = comboMeasureType.indexOf(meta.getCubeMeasure().getFieldType());
            if (indexType >= 0) {
                comboMeasureType.select(indexType);
            }
        }
    }
    if (meta.getCubeMeasure() != null) {
        if (meta.getCubeMeasure().getFieldName() != null) {
            textMeasureName.setText(meta.getCubeMeasure().getFieldName());
        }
    }
}
Also used : DimensionField(org.pentaho.di.palo.core.DimensionField)

Example 8 with DimensionField

use of org.pentaho.di.palo.core.DimensionField in project pentaho-kettle by pentaho.

the class PaloCellOutputDialog method getInfo.

private void getInfo(PaloCellOutputMeta myMeta) throws KettleException {
    stepname = textStepName.getText();
    List<DimensionField> fields = new ArrayList<DimensionField>();
    if (this.updateOptions.getCode(comboUpdateMode.getText()) == "ADD" && this.splashOptions.getCode(comboSplashMode.getText()) == "SET") {
        throw new KettleException(BaseMessages.getString(PKG, "PaloCellOutputDialog.UpdateSplashError", BaseMessages.getString(PKG, "PaloCellOutputDialog.UpdateMode"), comboUpdateMode.getText(), BaseMessages.getString(PKG, "PaloCellOutputDialog.SplashMode"), comboSplashMode.getText()));
    }
    try {
        Integer.parseInt(this.textCommitSize.getText());
    } catch (Exception e) {
        throw new KettleException(BaseMessages.getString(PKG, "PaloCellOutputDialog.CommitSizeErrorMessage"));
    }
    for (int i = 0; i < tableViewFields.table.getItemCount(); i++) {
        DimensionField field = new DimensionField(tableViewFields.table.getItem(i).getText(1), tableViewFields.table.getItem(i).getText(// tableViewFields.table.getItem(i).getText(3)
        2), // tableViewFields.table.getItem(i).getText(3)
        "");
        if (i != tableViewFields.table.getItemCount() - 1) {
            // if(tableViewFields.table.getItem(i).getText(3)!="String")
            // throw new
            // KettleException("Dimension input field must be from String type");
            fields.add(field);
        } else {
            myMeta.setMeasureField(field);
        }
    }
    myMeta.setCube(this.comboCube.getText());
    myMeta.setMeasureType(this.comboMeasureType.getText());
    myMeta.setUpdateMode(this.updateOptions.getCode(comboUpdateMode.getText()));
    myMeta.setSplashMode(this.splashOptions.getCode(comboSplashMode.getText()));
    myMeta.setLevels(fields);
    myMeta.setClearCube(this.buttonClearCube.getSelection());
    myMeta.setDatabaseMeta(transMeta.findDatabase(addConnectionLine.getText()));
    myMeta.setCommitSize(Integer.parseInt(this.textCommitSize.getText()));
    myMeta.setEnableDimensionCache(this.buttonEnableDimensionCache.getSelection());
    if (this.buttonEnableDimensionCache.getSelection()) {
        myMeta.setPreloadDimensionCache(this.buttonPreloadDimensionCache.getSelection());
    } else {
        myMeta.setPreloadDimensionCache(false);
    }
    myMeta.setChanged(true);
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) DimensionField(org.pentaho.di.palo.core.DimensionField) ArrayList(java.util.ArrayList) KettleException(org.pentaho.di.core.exception.KettleException)

Example 9 with DimensionField

use of org.pentaho.di.palo.core.DimensionField in project pentaho-kettle by pentaho.

the class PaloCellOutputDialog method fillStoredData.

private void fillStoredData() {
    if (stepname != null) {
        textStepName.setText(stepname);
    }
    int index = addConnectionLine.indexOf(meta.getDatabaseMeta() != null ? meta.getDatabaseMeta().getName() : "");
    if (index >= 0) {
        addConnectionLine.select(index);
    }
    if (meta.getCube() != null) {
        comboCube.add(meta.getCube());
        comboCube.select(0);
    }
    for (PaloOption option : updateOptions) {
        comboUpdateMode.add(option.getDescription());
    }
    comboUpdateMode.select(comboUpdateMode.indexOf(this.updateOptions.getDescription(meta.getUpdateMode())));
    for (PaloOption option : splashOptions) {
        comboSplashMode.add(option.getDescription());
    }
    comboSplashMode.select(comboSplashMode.indexOf(this.splashOptions.getDescription(meta.getSplashMode())));
    textCommitSize.setText(String.valueOf(meta.getCommitSize()));
    buttonEnableDimensionCache.setSelection(meta.getEnableDimensionCache());
    buttonPreloadDimensionCache.setSelection(meta.getPreloadDimensionCache());
    buttonPreloadDimensionCache.setEnabled(buttonEnableDimensionCache.getSelection());
    comboMeasureType.setItems(new String[] { "Numeric", "String" });
    comboMeasureType.select(0);
    if (meta.getMeasureType() != null) {
        int indexType = comboMeasureType.indexOf(meta.getMeasureType());
        if (indexType >= 0) {
            comboMeasureType.select(indexType);
        }
    }
    tableViewFields.table.removeAll();
    if (meta.getFields().size() > 0) {
        for (DimensionField level : meta.getFields()) {
            tableViewFields.add(level.getDimensionName(), level.getFieldName());
        }
    }
    List<String> fieldNameList = null;
    try {
        RowMetaInterface r = transMeta.getPrevStepFields(stepname);
        fieldNameList = Arrays.asList(r.getFieldNames());
        Collections.sort(fieldNameList);
    } catch (Exception e) {
    // ignore
    }
    tableViewFields.setColumnInfo(1, new ColumnInfo("Field", ColumnInfo.COLUMN_TYPE_CCOMBO, (fieldNameList == null ? null : fieldNameList.toArray(new String[0])), true));
    if (meta.getMeasure() != null) {
        final TableItem item = new TableItem(tableViewFields.table, SWT.NONE);
        item.setText(1, meta.getMeasure().getDimensionName());
        item.setText(2, meta.getMeasure().getFieldName());
        // item.setText(3,meta.getMeasure().getFieldType());
        item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN));
    }
    tableViewFields.setRowNums();
    tableViewFields.optWidth(true);
    buttonClearCube.setSelection(meta.getClearCube());
}
Also used : DimensionField(org.pentaho.di.palo.core.DimensionField) TableItem(org.eclipse.swt.widgets.TableItem) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) PaloOption(org.pentaho.di.palo.core.PaloOption) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) KettleException(org.pentaho.di.core.exception.KettleException)

Example 10 with DimensionField

use of org.pentaho.di.palo.core.DimensionField in project pentaho-kettle by pentaho.

the class PaloCellInputMeta method getXML.

@Override
public String getXML() {
    StringBuffer retval = new StringBuffer();
    retval.append("    ").append(XMLHandler.addTagValue("connection", databaseMeta == null ? "" : databaseMeta.getName()));
    retval.append("    ").append(XMLHandler.addTagValue("cube", this.cube));
    retval.append("    ").append(XMLHandler.addTagValue("cubemeasurename", this.cubeMeasure.getFieldName()));
    retval.append("    ").append(XMLHandler.addTagValue("cubemeasuretype", this.cubeMeasure.getFieldType()));
    retval.append("    <fields>").append(Const.CR);
    for (DimensionField field : this.fields) {
        retval.append("      <field>").append(Const.CR);
        retval.append("        ").append(XMLHandler.addTagValue("dimensionname", field.getDimensionName()));
        retval.append("        ").append(XMLHandler.addTagValue("fieldname", field.getFieldName()));
        retval.append("        ").append(XMLHandler.addTagValue("fieldtype", field.getFieldType()));
        retval.append("      </field>").append(Const.CR);
    }
    retval.append("    </fields>").append(Const.CR);
    return retval.toString();
}
Also used : DimensionField(org.pentaho.di.palo.core.DimensionField)

Aggregations

DimensionField (org.pentaho.di.palo.core.DimensionField)13 KettleException (org.pentaho.di.core.exception.KettleException)9 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)4 ArrayList (java.util.ArrayList)2 CheckResult (org.pentaho.di.core.CheckResult)2 KettleStepException (org.pentaho.di.core.exception.KettleStepException)2 PaloHelper (org.pentaho.di.palo.core.PaloHelper)2 Node (org.w3c.dom.Node)2 TableItem (org.eclipse.swt.widgets.TableItem)1 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)1 PaloOption (org.pentaho.di.palo.core.PaloOption)1 Trans (org.pentaho.di.trans.Trans)1 TransMeta (org.pentaho.di.trans.TransMeta)1 PaloCellInputMeta (org.pentaho.di.trans.steps.palo.cellinput.PaloCellInputMeta)1 EnterNumberDialog (org.pentaho.di.ui.core.dialog.EnterNumberDialog)1 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)1 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)1 PreviewRowsDialog (org.pentaho.di.ui.core.dialog.PreviewRowsDialog)1 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)1 TransPreviewProgressDialog (org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog)1