Search in sources :

Example 11 with PaloDimensionLevel

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

the class PaloDimOutputDialog method doGetFields.

private void doGetFields() {
    try {
        if (comboDimension.getText() != null) {
            if (addConnectionLine.getText() != null) {
                DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
                if (dbMeta != null) {
                    PaloDimOutputData data = new PaloDimOutputData(dbMeta);
                    tableViewFields.table.removeAll();
                    data.helper.connect();
                    List<PaloDimensionLevel> levels = data.helper.getDimensionLevels(comboDimension.getText());
                    for (PaloDimensionLevel level : levels) {
                        tableViewFields.add(String.valueOf(level.getLevelNumber()), level.getLevelName(), level.getFieldName());
                    }
                    tableViewFields.removeEmptyRows();
                    tableViewFields.setRowNums();
                    tableViewFields.optWidth(true);
                    data.helper.disconnect();
                }
            }
        } else {
            new ErrorDialog(shell, BaseMessages.getString("System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString("System.Dialog.GetFieldsFailed.Message"), new Exception(BaseMessages.getString(PKG, "PaloDimOutputDialog.SelectDimensionsFirstError")));
        }
        this.fillPreviousFieldTableViewColumn();
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString("System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString("System.Dialog.GetFieldsFailed.Message"), ke);
        tableViewFields.add();
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) PaloDimOutputData(org.pentaho.di.trans.steps.palo.dimoutput.PaloDimOutputData) PaloDimensionLevel(org.pentaho.di.palo.core.PaloDimensionLevel) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) KettleException(org.pentaho.di.core.exception.KettleException)

Example 12 with PaloDimensionLevel

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

the class PaloDimInputMeta method readRep.

public void readRep(Repository rep, IMetaStore metaStore, ObjectId idStep, List<DatabaseMeta> databases) throws KettleException {
    try {
        this.databaseMeta = rep.loadDatabaseMetaFromStepAttribute(idStep, "connection", databases);
        this.dimension = rep.getStepAttributeString(idStep, "dimension");
        this.baseElementsOnly = rep.getStepAttributeBoolean(idStep, "baseElementsOnly");
        int nrLevels = rep.countNrStepAttributes(idStep, "levelname");
        for (int i = 0; i < nrLevels; i++) {
            String levelName = rep.getStepAttributeString(idStep, i, "levelname");
            int levelNumber = (int) rep.getStepAttributeInteger(idStep, i, "levelnumber");
            String fieldName = rep.getStepAttributeString(idStep, i, "fieldname");
            String fieldType = rep.getStepAttributeString(idStep, i, "fieldtype");
            this.levels.add(new PaloDimensionLevel(levelName, levelNumber, fieldName, fieldType));
        }
    } catch (Exception e) {
        throw new KettleException("Unexpected error reading step information from the repository", e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) PaloDimensionLevel(org.pentaho.di.palo.core.PaloDimensionLevel) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 13 with PaloDimensionLevel

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

the class PaloDimOutputMeta method readRep.

public void readRep(Repository rep, IMetaStore metaStore, ObjectId idStep, List<DatabaseMeta> databases) throws KettleException {
    try {
        this.databaseMeta = rep.loadDatabaseMetaFromStepAttribute(idStep, "connection", databases);
        this.dimension = rep.getStepAttributeString(idStep, "dimension");
        this.elementType = rep.getStepAttributeString(idStep, "elementtype");
        this.createNewDimension = rep.getStepAttributeBoolean(idStep, "createdimension");
        this.clearDimension = rep.getStepAttributeBoolean(idStep, "cleardimension");
        this.clearConsolidations = rep.getStepAttributeBoolean(idStep, "clearconsolidations");
        this.recreateDimension = rep.getStepAttributeBoolean(idStep, "recreatedimension");
        this.enableElementCache = rep.getStepAttributeBoolean(idStep, "enableElementCache");
        this.preloadElementCache = rep.getStepAttributeBoolean(idStep, "preloadElementCache");
        int nrLevels = rep.countNrStepAttributes(idStep, "levelname");
        for (int i = 0; i < nrLevels; i++) {
            String levelName = rep.getStepAttributeString(idStep, i, "levelname");
            int levelNumber = (int) rep.getStepAttributeInteger(idStep, i, "levelnumber");
            String fieldName = rep.getStepAttributeString(idStep, i, "fieldname");
            String fieldType = rep.getStepAttributeString(idStep, i, "fieldtype");
            String consolidationField = rep.getStepAttributeString(idStep, i, "consolidationfieldname");
            this.levels.add(new PaloDimensionLevel(levelName, levelNumber, fieldName, fieldType, consolidationField));
        }
    } catch (Exception e) {
        throw new KettleException("Unexpected error reading step information from the repository", e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) PaloDimensionLevel(org.pentaho.di.palo.core.PaloDimensionLevel) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException)

Example 14 with PaloDimensionLevel

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

the class PaloDimInputDialog method getInfo.

private void getInfo(PaloDimInputMeta myMeta) throws KettleException {
    stepname = textStepName.getText();
    List<PaloDimensionLevel> levels = new ArrayList<PaloDimensionLevel>();
    for (int i = 0; i < tableViewFields.table.getItemCount(); i++) {
        PaloDimensionLevel level = new PaloDimensionLevel(tableViewFields.table.getItem(i).getText(1), Integer.parseInt(tableViewFields.table.getItem(i).getText(2)), tableViewFields.table.getItem(i).getText(3), tableViewFields.table.getItem(i).getText(4));
        levels.add(level);
    }
    myMeta.setDatabaseMeta(transMeta.findDatabase(addConnectionLine.getText()));
    myMeta.setLevels(levels);
    myMeta.setDimension(comboDimension.getText());
    myMeta.setBaseElementsOnly(buttonBaseElementsOnly.getSelection());
    myMeta.setChanged(true);
}
Also used : PaloDimensionLevel(org.pentaho.di.palo.core.PaloDimensionLevel) ArrayList(java.util.ArrayList)

Aggregations

PaloDimensionLevel (org.pentaho.di.palo.core.PaloDimensionLevel)14 KettleException (org.pentaho.di.core.exception.KettleException)8 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)4 ArrayList (java.util.ArrayList)3 CheckResult (org.pentaho.di.core.CheckResult)2 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)2 KettleStepException (org.pentaho.di.core.exception.KettleStepException)2 PaloHelper (org.pentaho.di.palo.core.PaloHelper)2 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)2 Node (org.w3c.dom.Node)2 List (java.util.List)1 PaloDimInputData (org.pentaho.di.trans.steps.palo.diminput.PaloDimInputData)1 PaloDimOutputData (org.pentaho.di.trans.steps.palo.dimoutput.PaloDimOutputData)1