use of org.apache.hop.core.row.value.ValueMetaString in project hop by apache.
the class DatabaseMeta method getFeatureSummary.
/**
* @return a feature list for the chosen database type.
*/
public List<RowMetaAndData> getFeatureSummary(IVariables variables) {
List<RowMetaAndData> list = new ArrayList<>();
RowMetaAndData r = null;
final String par = "Parameter";
final String val = "Value";
IValueMeta testValue = new ValueMetaString("FIELD");
testValue.setLength(30);
if (iDatabase != null) {
// Type of database
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Database type");
r.addValue(val, IValueMeta.TYPE_STRING, getPluginId());
list.add(r);
// Type of access
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Access type");
r.addValue(val, IValueMeta.TYPE_STRING, getAccessTypeDesc());
list.add(r);
// Name of database
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Database name");
r.addValue(val, IValueMeta.TYPE_STRING, getDatabaseName());
list.add(r);
// server host name
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Server hostname");
r.addValue(val, IValueMeta.TYPE_STRING, getHostname());
list.add(r);
// Port number
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Service port");
r.addValue(val, IValueMeta.TYPE_STRING, getPort());
list.add(r);
// Username
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Username");
r.addValue(val, IValueMeta.TYPE_STRING, getUsername());
list.add(r);
// Informix server
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Informix server name");
r.addValue(val, IValueMeta.TYPE_STRING, getServername());
list.add(r);
// Other properties...
for (String key : getAttributes().keySet()) {
String value = getAttributes().get(key);
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Extra attribute [" + key + "]");
r.addValue(val, IValueMeta.TYPE_STRING, value);
list.add(r);
}
// driver class
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Driver class");
r.addValue(val, IValueMeta.TYPE_STRING, getDriverClass(variables));
list.add(r);
// URL
String pwd = getPassword();
// Don't give away the password in the URL!
setPassword("password");
String url = "";
try {
url = getURL(variables);
} catch (Exception e) {
url = "";
}
// SAP etc.
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "URL");
r.addValue(val, IValueMeta.TYPE_STRING, url);
list.add(r);
setPassword(pwd);
// SQL: Next sequence value
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "SQL: next sequence value");
r.addValue(val, IValueMeta.TYPE_STRING, getSeqNextvalSql("SEQUENCE"));
list.add(r);
// is set fetch size supported
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "supported: set fetch size");
r.addValue(val, IValueMeta.TYPE_STRING, isFetchSizeSupported() ? "Y" : "N");
list.add(r);
// needs place holder for auto increment
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "auto increment field needs placeholder");
r.addValue(val, IValueMeta.TYPE_STRING, needsPlaceHolder() ? "Y" : "N");
list.add(r);
// Sum function
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "SUM aggregate function");
r.addValue(val, IValueMeta.TYPE_STRING, getFunctionSum());
list.add(r);
// Avg function
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "AVG aggregate function");
r.addValue(val, IValueMeta.TYPE_STRING, getFunctionAverage());
list.add(r);
// Minimum function
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "MIN aggregate function");
r.addValue(val, IValueMeta.TYPE_STRING, getFunctionMinimum());
list.add(r);
// Maximum function
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "MAX aggregate function");
r.addValue(val, IValueMeta.TYPE_STRING, getFunctionMaximum());
list.add(r);
// Count function
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "COUNT aggregate function");
r.addValue(val, IValueMeta.TYPE_STRING, getFunctionCount());
list.add(r);
// Schema-table combination
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Schema / Table combination");
r.addValue(val, IValueMeta.TYPE_STRING, getQuotedSchemaTableCombination(variables, "SCHEMA", "TABLE"));
list.add(r);
// Limit clause
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "LIMIT clause for 100 rows");
r.addValue(val, IValueMeta.TYPE_STRING, getLimitClause(100));
list.add(r);
// add column statement
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Add column statement");
r.addValue(val, IValueMeta.TYPE_STRING, getAddColumnStatement("TABLE", testValue, null, false, null, false));
list.add(r);
// drop column statement
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Drop column statement");
r.addValue(val, IValueMeta.TYPE_STRING, getDropColumnStatement("TABLE", testValue, null, false, null, false));
list.add(r);
// Modify column statement
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Modify column statement");
r.addValue(val, IValueMeta.TYPE_STRING, getModifyColumnStatement("TABLE", testValue, null, false, null, false));
list.add(r);
// List of reserved words
String reserved = "";
if (getReservedWords() != null) {
for (int i = 0; i < getReservedWords().length; i++) {
reserved += (i > 0 ? ", " : "") + getReservedWords()[i];
}
}
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "List of reserved words");
r.addValue(val, IValueMeta.TYPE_STRING, reserved);
list.add(r);
// Quote reserved words?
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Quote reserved words?");
r.addValue(val, IValueMeta.TYPE_STRING, quoteReservedWords() ? "Y" : "N");
list.add(r);
// Start Quote
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "Start quote for reserved words");
r.addValue(val, IValueMeta.TYPE_STRING, getStartQuote());
list.add(r);
// End Quote
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "End quote for reserved words");
r.addValue(val, IValueMeta.TYPE_STRING, getEndQuote());
list.add(r);
// List of table types
String types = "";
String[] slist = getTableTypes();
if (slist != null) {
for (int i = 0; i < slist.length; i++) {
types += (i > 0 ? ", " : "") + slist[i];
}
}
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "List of JDBC table types");
r.addValue(val, IValueMeta.TYPE_STRING, types);
list.add(r);
// List of view types
types = "";
slist = getViewTypes();
if (slist != null) {
for (int i = 0; i < slist.length; i++) {
types += (i > 0 ? ", " : "") + slist[i];
}
}
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "List of JDBC view types");
r.addValue(val, IValueMeta.TYPE_STRING, types);
list.add(r);
// List of synonym types
types = "";
slist = getSynonymTypes();
if (slist != null) {
for (int i = 0; i < slist.length; i++) {
types += (i > 0 ? ", " : "") + slist[i];
}
}
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "List of JDBC synonym types");
r.addValue(val, IValueMeta.TYPE_STRING, types);
list.add(r);
// Use schema-name to get list of tables?
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "use schema name to get table list?");
r.addValue(val, IValueMeta.TYPE_STRING, useSchemaNameForTableList() ? "Y" : "N");
list.add(r);
// supports view?
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "supports views?");
r.addValue(val, IValueMeta.TYPE_STRING, supportsViews() ? "Y" : "N");
list.add(r);
// supports synonyms?
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "supports synonyms?");
r.addValue(val, IValueMeta.TYPE_STRING, supportsSynonyms() ? "Y" : "N");
list.add(r);
// SQL: get list of procedures?
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "SQL: list of procedures");
r.addValue(val, IValueMeta.TYPE_STRING, getSqlListOfProcedures());
list.add(r);
// SQL: get truncate table statement?
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "SQL: truncate table");
String truncateStatement = getTruncateTableStatement(variables, "SCHEMA", "TABLE");
r.addValue(val, IValueMeta.TYPE_STRING, truncateStatement != null ? truncateStatement : "Not supported by this database type");
list.add(r);
// supports float rounding on update?
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "supports floating point rounding on update/insert");
r.addValue(val, IValueMeta.TYPE_STRING, supportsFloatRoundingOnUpdate() ? "Y" : "N");
list.add(r);
// supports time stamp to date conversion
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "supports timestamp-date conversion");
r.addValue(val, IValueMeta.TYPE_STRING, supportsTimeStampToDateConversion() ? "Y" : "N");
list.add(r);
// supports batch updates
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "supports batch updates");
r.addValue(val, IValueMeta.TYPE_STRING, supportsBatchUpdates() ? "Y" : "N");
list.add(r);
// supports boolean values
r = new RowMetaAndData();
r.addValue(par, IValueMeta.TYPE_STRING, "supports boolean data type");
r.addValue(val, IValueMeta.TYPE_STRING, supportsBooleanDataType() ? "Y" : "N");
list.add(r);
}
return list;
}
use of org.apache.hop.core.row.value.ValueMetaString in project hop by apache.
the class DatabaseConnectionPoolParameter method getRowList.
public static final List<RowMetaAndData> getRowList(DatabaseConnectionPoolParameter[] poolParameters, String titleParameter, String titleDefaultValue, String titleDescription) {
IRowMeta rowMeta = new RowMeta();
rowMeta.addValueMeta(new ValueMetaString(titleParameter));
rowMeta.addValueMeta(new ValueMetaString(titleDefaultValue));
rowMeta.addValueMeta(new ValueMetaString(titleDescription));
List<RowMetaAndData> list = new ArrayList<>();
for (int i = 0; i < poolParameters.length; i++) {
DatabaseConnectionPoolParameter p = poolParameters[i];
Object[] row = new Object[rowMeta.size()];
row[0] = p.getParameter();
row[1] = p.getDefaultValue();
row[2] = p.getDescription();
list.add(new RowMetaAndData(rowMeta, row));
}
return list;
}
use of org.apache.hop.core.row.value.ValueMetaString in project hop by apache.
the class ResultFile method getRow.
/**
* @return an output Row for this Result File object.
*/
@JsonIgnore
public RowMetaAndData getRow() {
RowMetaAndData row = new RowMetaAndData();
// First the type
row.addValue(new ValueMetaString("type"), getTypeDesc());
// The filename
row.addValue(new ValueMetaString("filename"), file.getName().getBaseName());
// The path
row.addValue(new ValueMetaString("path"), file.getName().getURI());
// The origin parent
row.addValue(new ValueMetaString("parentorigin"), originParent);
// The origin
row.addValue(new ValueMetaString("origin"), origin);
// The comment
row.addValue(new ValueMetaString("comment"), comment);
// The timestamp
row.addValue(new ValueMetaDate("timestamp"), timestamp);
return row;
}
use of org.apache.hop.core.row.value.ValueMetaString in project hop by apache.
the class TransformErrorMeta method getErrorRowMeta.
public IRowMeta getErrorRowMeta(IVariables variables) {
IRowMeta row = new RowMeta();
String nrErr = variables.resolve(getNrErrorsValuename());
if (!Utils.isEmpty(nrErr)) {
IValueMeta v = new ValueMetaInteger(nrErr);
v.setLength(3);
row.addValueMeta(v);
}
String errDesc = variables.resolve(getErrorDescriptionsValuename());
if (!Utils.isEmpty(errDesc)) {
IValueMeta v = new ValueMetaString(errDesc);
row.addValueMeta(v);
}
String errFields = variables.resolve(getErrorFieldsValuename());
if (!Utils.isEmpty(errFields)) {
IValueMeta v = new ValueMetaString(errFields);
row.addValueMeta(v);
}
String errCodes = variables.resolve(getErrorCodesValuename());
if (!Utils.isEmpty(errCodes)) {
IValueMeta v = new ValueMetaString(errCodes);
row.addValueMeta(v);
}
return row;
}
use of org.apache.hop.core.row.value.ValueMetaString in project hop by apache.
the class GenerateCsvMeta method getFields.
@Override
public void getFields(IRowMeta inputRowMeta, String name, IRowMeta[] info, TransformMeta nextStep, IVariables space, IHopMetadataProvider metadataProvider) {
inputRowMeta.clear();
IValueMeta filenameValueMeta = new ValueMetaString(space.resolve(filenameField));
filenameValueMeta.setOrigin(name);
inputRowMeta.addValueMeta(filenameValueMeta);
IValueMeta fileTypeValueMeta = new ValueMetaString(space.resolve(fileTypeField));
fileTypeValueMeta.setOrigin(name);
inputRowMeta.addValueMeta(fileTypeValueMeta);
}
Aggregations