use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method getElementType.
@Override
public IMetaStoreElementType getElementType(String namespace, String elementTypeId) throws MetaStoreException {
try {
ObjectId namespaceId = delegate.getNamespaceId(namespace);
if (namespaceId == null) {
return null;
}
RowMetaAndData elementTypeRow = delegate.getElementType(new LongObjectId(new StringObjectId(elementTypeId)));
return delegate.parseElementType(namespace, namespaceId, elementTypeRow);
} catch (Exception e) {
throw new MetaStoreException("Unable to get element type with id '" + elementTypeId + "' in namespace '" + namespace + "'", e);
}
}
use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class DatabaseImpact method getRow.
public RowMetaAndData getRow() {
RowMetaAndData r = new RowMetaAndData();
r.addValue(new ValueMetaString(BaseMessages.getString(PKG, "DatabaseImpact.RowDesc.Label.Type")), getTypeDesc());
r.addValue(new ValueMetaString(BaseMessages.getString(PKG, "DatabaseImpact.RowDesc.Label.Transformation")), getTransformationName());
r.addValue(new ValueMetaString(BaseMessages.getString(PKG, "DatabaseImpact.RowDesc.Label.Step")), getStepName());
r.addValue(new ValueMetaString(BaseMessages.getString(PKG, "DatabaseImpact.RowDesc.Label.Database")), getDatabaseName());
r.addValue(new ValueMetaString(BaseMessages.getString(PKG, "DatabaseImpact.RowDesc.Label.Table")), getTable());
r.addValue(new ValueMetaString(BaseMessages.getString(PKG, "DatabaseImpact.RowDesc.Label.Field")), getField());
r.addValue(new ValueMetaString(BaseMessages.getString(PKG, "DatabaseImpact.RowDesc.Label.Value")), getValue());
r.addValue(new ValueMetaString(BaseMessages.getString(PKG, "DatabaseImpact.RowDesc.Label.ValueOrigin")), getValueOrigin());
r.addValue(new ValueMetaString(BaseMessages.getString(PKG, "DatabaseImpact.RowDesc.Label.SQL")), getSQL());
r.addValue(new ValueMetaString(BaseMessages.getString(PKG, "DatabaseImpact.RowDesc.Label.Remarks")), getRemark());
return r;
}
use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryClusterSchemaDelegate method updateCluster.
public synchronized void updateCluster(ClusterSchema clusterSchema) throws KettleException {
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_CLUSTER_ID_CLUSTER), clusterSchema.getObjectId());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_CLUSTER_NAME), clusterSchema.getName());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_CLUSTER_BASE_PORT), clusterSchema.getBasePort());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_BUFFER_SIZE), clusterSchema.getSocketsBufferSize());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_FLUSH_INTERVAL), clusterSchema.getSocketsFlushInterval());
table.addValue(new ValueMetaBoolean(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_COMPRESSED), Boolean.valueOf(clusterSchema.isSocketsCompressed()));
table.addValue(new ValueMetaBoolean(KettleDatabaseRepository.FIELD_CLUSTER_DYNAMIC), Boolean.valueOf(clusterSchema.isDynamic()));
repository.connectionDelegate.updateTableRow(KettleDatabaseRepository.TABLE_R_CLUSTER, KettleDatabaseRepository.FIELD_CLUSTER_ID_CLUSTER, table, clusterSchema.getObjectId());
}
use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryClusterSchemaDelegate method loadClusterSchema.
public ClusterSchema loadClusterSchema(ObjectId id_cluster_schema, List<SlaveServer> slaveServers) throws KettleException {
ClusterSchema clusterSchema = new ClusterSchema();
RowMetaAndData row = getClusterSchema(id_cluster_schema);
clusterSchema.setObjectId(id_cluster_schema);
clusterSchema.setName(row.getString(KettleDatabaseRepository.FIELD_CLUSTER_NAME, null));
clusterSchema.setBasePort(row.getString(KettleDatabaseRepository.FIELD_CLUSTER_BASE_PORT, null));
clusterSchema.setSocketsBufferSize(row.getString(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_BUFFER_SIZE, null));
clusterSchema.setSocketsFlushInterval(row.getString(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_FLUSH_INTERVAL, null));
clusterSchema.setSocketsCompressed(row.getBoolean(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_COMPRESSED, true));
clusterSchema.setDynamic(row.getBoolean(KettleDatabaseRepository.FIELD_CLUSTER_DYNAMIC, true));
ObjectId[] pids = repository.getClusterSlaveIDs(id_cluster_schema);
for (int i = 0; i < pids.length; i++) {
// Load last version
SlaveServer slaveServer = repository.loadSlaveServer(pids[i], null);
SlaveServer reference = SlaveServer.findSlaveServer(slaveServers, slaveServer.getName());
if (reference != null) {
clusterSchema.getSlaveServers().add(reference);
} else {
clusterSchema.getSlaveServers().add(slaveServer);
}
}
return clusterSchema;
}
use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryConditionDelegate method lookupValue.
public synchronized ObjectId lookupValue(String name, String type, String value_str, boolean isnull) throws KettleException {
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_VALUE_NAME), name);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_VALUE_VALUE_TYPE), type);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_VALUE_VALUE_STR), value_str);
table.addValue(new ValueMetaBoolean(KettleDatabaseRepository.FIELD_VALUE_IS_NULL), Boolean.valueOf(isnull));
String sql = "SELECT " + quote(KettleDatabaseRepository.FIELD_VALUE_ID_VALUE) + " FROM " + quoteTable(KettleDatabaseRepository.TABLE_R_VALUE) + " ";
sql += "WHERE " + quote(KettleDatabaseRepository.FIELD_VALUE_NAME) + " = ? ";
sql += "AND " + quote(KettleDatabaseRepository.FIELD_VALUE_VALUE_TYPE) + " = ? ";
sql += "AND " + quote(KettleDatabaseRepository.FIELD_VALUE_VALUE_STR) + " = ? ";
sql += "AND " + quote(KettleDatabaseRepository.FIELD_VALUE_IS_NULL) + " = ? ";
RowMetaAndData result = repository.connectionDelegate.getOneRow(sql, table.getRowMeta(), table.getData());
if (result != null && result.getData() != null && result.isNumeric(0)) {
return new LongObjectId(result.getInteger(0, 0L));
} else {
return null;
}
}
Aggregations