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