use of org.pentaho.di.palo.core.DimensionField in project pentaho-kettle by pentaho.
the class PaloCellInputMeta method check.
@Override
public void check(final List<CheckResultInterface> remarks, final TransMeta transMeta, final StepMeta stepMeta, final RowMetaInterface prev, final String[] input, final String[] output, final RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore) {
CheckResult cr;
if (databaseMeta != null) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, "Connection exists", stepMeta);
remarks.add(cr);
final PaloHelper helper = new PaloHelper(databaseMeta, DefaultLogLevel.getLogLevel());
try {
helper.connect();
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, "Connection to database OK", stepMeta);
remarks.add(cr);
if (!Utils.isEmpty(cube)) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, "The name of the cube is entered", stepMeta);
remarks.add(cr);
} else {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "The name of the cube is missing.", stepMeta);
remarks.add(cr);
}
if (this.cubeMeasure == null) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Measure field is empty.", stepMeta);
remarks.add(cr);
} else {
if (Utils.isEmpty(this.cubeMeasure.getFieldName())) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Measure field Name is empty.", stepMeta);
remarks.add(cr);
}
if (Utils.isEmpty(this.cubeMeasure.getFieldType())) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Measure field Type is empty.", stepMeta);
remarks.add(cr);
}
}
if (this.fields == null || this.fields.size() == 0) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Cell Input Fields are empty.", stepMeta);
remarks.add(cr);
} else {
for (DimensionField field : this.fields) {
if (Utils.isEmpty(field.getFieldName())) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Output field for dimension " + field.getDimensionName() + " is empty.", stepMeta);
remarks.add(cr);
}
if (Utils.isEmpty(field.getFieldType())) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Output field type for dimension " + field.getDimensionName() + " is empty.", stepMeta);
remarks.add(cr);
}
}
}
} catch (KettleException e) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "An error occurred: " + e.getMessage(), stepMeta);
remarks.add(cr);
} finally {
helper.disconnect();
}
} else {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Please select or create a connection to use", stepMeta);
remarks.add(cr);
}
}
use of org.pentaho.di.palo.core.DimensionField in project pentaho-kettle by pentaho.
the class PaloCellInputMeta method readData.
private void readData(final Node stepnode, final List<? extends SharedObjectInterface> databases) throws KettleXMLException {
try {
this.databaseMeta = DatabaseMeta.findDatabase(databases, XMLHandler.getTagValue(stepnode, "connection"));
this.cube = XMLHandler.getTagValue(stepnode, "cube");
String cubeMeasureName = XMLHandler.getTagValue(stepnode, "cubemeasurename");
String cubeMeasureType = XMLHandler.getTagValue(stepnode, "cubemeasuretype");
this.cubeMeasure = new DimensionField("Measure", cubeMeasureName, cubeMeasureType);
this.fields = new ArrayList<DimensionField>();
Node levels = XMLHandler.getSubNode(stepnode, "fields");
int nrLevels = XMLHandler.countNodes(levels, "field");
for (int i = 0; i < nrLevels; i++) {
Node fnode = XMLHandler.getSubNodeByNr(levels, "field", i);
String dimensionName = XMLHandler.getTagValue(fnode, "dimensionname");
String fieldName = XMLHandler.getTagValue(fnode, "fieldname");
String fieldType = XMLHandler.getTagValue(fnode, "fieldtype");
this.fields.add(new DimensionField(dimensionName, fieldName, fieldType));
}
} catch (Exception e) {
throw new KettleXMLException("Unable to load step info from XML", e);
}
}
use of org.pentaho.di.palo.core.DimensionField in project pentaho-kettle by pentaho.
the class PaloCellOutputMeta method readData.
private void readData(final Node stepnode, final List<? extends SharedObjectInterface> databases) throws KettleXMLException {
try {
databaseMeta = DatabaseMeta.findDatabase(databases, XMLHandler.getTagValue(stepnode, "connection"));
this.cube = XMLHandler.getTagValue(stepnode, "cube");
measureType = XMLHandler.getTagValue(stepnode, "measuretype");
updateMode = XMLHandler.getTagValue(stepnode, "updateMode");
splashMode = XMLHandler.getTagValue(stepnode, "splashMode");
clearCube = XMLHandler.getTagValue(stepnode, "clearcube").equals("Y") ? true : false;
/* For backwards compatibility */
try {
enableDimensionCache = XMLHandler.getTagValue(stepnode, "enableDimensionCache").equals("Y") ? true : false;
preloadDimensionCache = XMLHandler.getTagValue(stepnode, "preloadDimensionCache").equals("Y") ? true : false;
commitSize = Integer.parseInt(XMLHandler.getTagValue(stepnode, "commitSize"));
} catch (Exception e) {
enableDimensionCache = false;
preloadDimensionCache = false;
commitSize = 1000;
}
this.fields = new ArrayList<DimensionField>();
Node fields = XMLHandler.getSubNode(stepnode, "fields");
int nrFields = XMLHandler.countNodes(fields, "field");
for (int i = 0; i < nrFields; i++) {
Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
String dimensionName = XMLHandler.getTagValue(fnode, "dimensionname");
String fieldName = XMLHandler.getTagValue(fnode, "fieldname");
String fieldType = XMLHandler.getTagValue(fnode, "fieldtype");
this.fields.add(new DimensionField(dimensionName, fieldName, fieldType));
}
Node measures = XMLHandler.getSubNode(stepnode, "measures");
int nrMeasures = XMLHandler.countNodes(measures, "measure");
//
for (int i = 0; i < nrMeasures; ) {
Node fnode = XMLHandler.getSubNodeByNr(measures, "measure", i);
String measureName = XMLHandler.getTagValue(fnode, "measurename");
String fieldName = XMLHandler.getTagValue(fnode, "measurefieldname");
String fieldType = XMLHandler.getTagValue(fnode, "measurefieldtype");
this.measureField = new DimensionField(measureName, fieldName, fieldType);
break;
}
setDefault();
} catch (Exception e) {
throw new KettleXMLException("Unable to load step info from XML", e);
}
}
Aggregations