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);
}
}
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);
}
}
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")));
}
}
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());
}
}
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);
}
Aggregations