use of org.pentaho.di.trans.steps.palo.diminput.PaloDimInputData 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")));
}
}
use of org.pentaho.di.trans.steps.palo.diminput.PaloDimInputData in project pentaho-kettle by pentaho.
the class PaloDimInputDialog method doSelectConnection.
private void doSelectConnection(boolean clearCurrentData) {
try {
if (clearCurrentData) {
tableViewFields.table.removeAll();
comboDimension.removeAll();
}
if (addConnectionLine.getText() != null) {
DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
if (dbMeta != null) {
PaloDimInputData data = new PaloDimInputData(dbMeta);
data.helper.connect();
List<String> dimensions = data.helper.getDimensionsNames();
Collections.sort(dimensions, new PaloNameComparator());
for (String dimensionName : dimensions) {
if (comboDimension.indexOf(dimensionName) == -1) {
comboDimension.add(dimensionName);
}
}
data.helper.disconnect();
}
}
} catch (Exception ex) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "PaloDimInputDialog.RetreiveDimensionsErrorTitle"), BaseMessages.getString(PKG, "PaloDimInputDialog.RetreiveDimensionsError"), ex);
}
}
Aggregations