Search in sources :

Example 6 with PaloDimensionLevel

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

the class PaloDimOutputMeta method readData.

private void readData(final Node stepnode, final List<? extends SharedObjectInterface> databases) throws KettleXMLException {
    try {
        databaseMeta = DatabaseMeta.findDatabase(databases, XMLHandler.getTagValue(stepnode, "connection"));
        dimension = XMLHandler.getTagValue(stepnode, "dimension");
        elementType = XMLHandler.getTagValue(stepnode, "elementtype");
        createNewDimension = XMLHandler.getTagValue(stepnode, "createdimension").equals("Y") ? true : false;
        clearDimension = XMLHandler.getTagValue(stepnode, "cleardimension").equals("Y") ? true : false;
        clearConsolidations = (XMLHandler.getTagValue(stepnode, "clearconsolidations") == null ? false : XMLHandler.getTagValue(stepnode, "clearconsolidations").equals("Y") ? true : false);
        recreateDimension = (XMLHandler.getTagValue(stepnode, "recreatedimension") == null ? false : XMLHandler.getTagValue(stepnode, "recreatedimension").equals("Y") ? true : false);
        enableElementCache = (XMLHandler.getTagValue(stepnode, "enableElementCache") == null ? false : XMLHandler.getTagValue(stepnode, "enableElementCache").equals("Y") ? true : false);
        preloadElementCache = (XMLHandler.getTagValue(stepnode, "preloadElementCache") == null ? false : XMLHandler.getTagValue(stepnode, "preloadElementCache").equals("Y") ? true : false);
        Node levels = XMLHandler.getSubNode(stepnode, "levels");
        int nrLevels = XMLHandler.countNodes(levels, "level");
        for (int i = 0; i < nrLevels; i++) {
            Node fnode = XMLHandler.getSubNodeByNr(levels, "level", i);
            String levelName = XMLHandler.getTagValue(fnode, "levelname");
            String levelNumber = XMLHandler.getTagValue(fnode, "levelnumber");
            String fieldName = XMLHandler.getTagValue(fnode, "fieldname");
            String fieldType = XMLHandler.getTagValue(fnode, "fieldtype");
            String consolidationField = XMLHandler.getTagValue(fnode, "consolidationfieldname");
            this.levels.add(new PaloDimensionLevel(levelName, Integer.parseInt(levelNumber), fieldName, fieldType, consolidationField));
        }
    } catch (Exception e) {
        throw new KettleXMLException("Unable to load step info from XML", e);
    }
}
Also used : PaloDimensionLevel(org.pentaho.di.palo.core.PaloDimensionLevel) Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException)

Example 7 with PaloDimensionLevel

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

the class PaloDimInputDialog 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.getDimension() != null) {
        comboDimension.add(meta.getDimension());
        comboDimension.select(0);
    }
    buttonBaseElementsOnly.setSelection(meta.getBaseElementsOnly());
    tableViewFields.table.removeAll();
    if (meta.getLevels().size() > 0) {
        for (PaloDimensionLevel level : meta.getLevels()) {
            tableViewFields.add(level.getLevelName(), String.valueOf(level.getLevelNumber()), level.getFieldName(), level.getFieldType());
        }
        tableViewFields.setRowNums();
        tableViewFields.optWidth(true);
    }
}
Also used : PaloDimensionLevel(org.pentaho.di.palo.core.PaloDimensionLevel)

Example 8 with PaloDimensionLevel

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

the class PaloDimInputDialog method doGetLevels.

private void doGetLevels() {
    if (buttonBaseElementsOnly.getSelection()) {
        tableViewFields.table.removeAll();
        tableViewFields.add(BaseMessages.getString(PKG, "PaloDimInputDialog.BaseElementName"), "0", comboDimension.getText(), "String");
    } else if (comboDimension.getText() != null && comboDimension.getText() != "") {
        try {
            if (addConnectionLine.getText() != null) {
                DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
                if (dbMeta != null) {
                    PaloDimInputData data = new PaloDimInputData(dbMeta);
                    tableViewFields.table.removeAll();
                    data.helper.connect();
                    List<PaloDimensionLevel> levels = data.helper.getDimensionLevels(comboDimension.getText());
                    for (int i = 0; i < levels.size(); i++) {
                        PaloDimensionLevel level = levels.get(i);
                        tableViewFields.add(level.getLevelName(), String.valueOf(level.getLevelNumber()), level.getFieldName());
                    }
                    tableViewFields.setRowNums();
                    tableViewFields.optWidth(true);
                    data.helper.disconnect();
                }
            }
        } catch (Exception ex) {
            new ErrorDialog(shell, BaseMessages.getString("System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString("System.Dialog.GetFieldsFailed.Message"), ex);
        }
    } else {
        new ErrorDialog(shell, BaseMessages.getString("System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString("System.Dialog.GetFieldsFailed.Message"), new Exception(BaseMessages.getString(PKG, "PaloDimInputDialog.SelectDimensionFirstError")));
    }
}
Also used : PaloDimInputData(org.pentaho.di.trans.steps.palo.diminput.PaloDimInputData) PaloDimensionLevel(org.pentaho.di.palo.core.PaloDimensionLevel) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) ArrayList(java.util.ArrayList) List(java.util.List) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) KettleException(org.pentaho.di.core.exception.KettleException)

Example 9 with PaloDimensionLevel

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

the class PaloDimOutputDialog 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.getLevels().size() > 0) {
        for (PaloDimensionLevel level : meta.getLevels()) {
            String consolidationFactor = level.getConsolidationFieldName();
            if (consolidationFactor == null) {
                consolidationFactor = BaseMessages.getString(PKG, "PaloDimOutputDialog.ConsolidationFactorDefault");
            }
            tableViewFields.add(String.valueOf(level.getLevelNumber()), level.getLevelName(), level.getFieldName(), consolidationFactor);
        }
        tableViewFields.setRowNums();
        tableViewFields.optWidth(true);
    }
    if (meta.getDimension() != null) {
        comboDimension.add(meta.getDimension());
        comboDimension.select(0);
    }
    if (meta.getElementType() != null) {
        comboElementType.add(meta.getElementType());
        comboElementType.select(0);
    }
    comboElementType.setItems(new String[] { "Numeric", "String" });
    comboElementType.select(0);
    if (meta.getElementType() != null) {
        int indexType = comboElementType.indexOf(meta.getElementType());
        if (indexType >= 0) {
            comboElementType.select(indexType);
        }
    }
    buttonCreateDimension.setSelection(meta.getCreateNewDimension());
    buttonClearDimension.setSelection(meta.getClearDimension());
    buttonClearConsolidations.setSelection(meta.getClearConsolidations());
    buttonEnableElementCache.setSelection(meta.getEnableElementCache());
    buttonPreloadElementCache.setSelection(meta.getPreloadElementCache());
    buttonRecreateDimension.setSelection(meta.getRecreateDimension());
    buttonClearDimension.setEnabled(!buttonRecreateDimension.getSelection());
    buttonClearConsolidations.setEnabled(!buttonRecreateDimension.getSelection());
    buttonPreloadElementCache.setEnabled(buttonEnableElementCache.getSelection());
    if (buttonClearDimension.getEnabled()) {
        buttonClearConsolidations.setEnabled(!buttonClearDimension.getSelection());
    }
}
Also used : PaloDimensionLevel(org.pentaho.di.palo.core.PaloDimensionLevel)

Example 10 with PaloDimensionLevel

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

the class PaloDimOutputDialog method getInfo.

private void getInfo(PaloDimOutputMeta myMeta) throws KettleException {
    stepname = textStepName.getText();
    List<PaloDimensionLevel> levels = new ArrayList<PaloDimensionLevel>();
    tableViewFields.removeEmptyRows();
    for (int i = 0; i < tableViewFields.table.getItemCount(); i++) {
        String consolidationFactor = tableViewFields.table.getItem(i).getText(4);
        if (consolidationFactor.equals(BaseMessages.getString(PKG, "PaloDimOutputDialog.ConsolidationFactorDefault"))) {
            consolidationFactor = null;
        }
        PaloDimensionLevel level = new PaloDimensionLevel(tableViewFields.table.getItem(i).getText(2), i, tableViewFields.table.getItem(i).getText(3), "String", consolidationFactor);
        levels.add(level);
    }
    myMeta.setDatabaseMeta(transMeta.findDatabase(addConnectionLine.getText()));
    myMeta.setLevels(levels);
    myMeta.setCreateNewDimension(this.buttonCreateDimension.getSelection());
    myMeta.setClearDimension(this.buttonClearDimension.getSelection());
    if (this.buttonClearDimension.getSelection()) {
        myMeta.setClearConsolidations(false);
    } else {
        myMeta.setClearConsolidations(buttonClearConsolidations.getSelection());
    }
    myMeta.setEnableElementCache(buttonEnableElementCache.getSelection());
    if (!this.buttonEnableElementCache.getSelection()) {
        myMeta.setPreloadElementCache(false);
    } else {
        myMeta.setPreloadElementCache(buttonPreloadElementCache.getSelection());
    }
    myMeta.setRecreateDimension(this.buttonRecreateDimension.getSelection());
    myMeta.setDimension(this.comboDimension.getText());
    myMeta.setElementType(this.comboElementType.getText());
    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