use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStoreDelegate method parseElementType.
public KDBRMetaStoreElementType parseElementType(String namespace, ObjectId namespaceId, RowMetaAndData elementTypeRow) throws KettleValueException {
Long id = elementTypeRow.getInteger(KettleDatabaseRepository.FIELD_ELEMENT_TYPE_ID_ELEMENT_TYPE);
String name = elementTypeRow.getString(KettleDatabaseRepository.FIELD_ELEMENT_TYPE_NAME, null);
String description = elementTypeRow.getString(KettleDatabaseRepository.FIELD_ELEMENT_TYPE_DESCRIPTION, null);
KDBRMetaStoreElementType type = new KDBRMetaStoreElementType(this, namespace, namespaceId, name, description);
type.setId(new LongObjectId(id));
return type;
}
use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepository method saveConditionStepAttribute.
/**
* This method saves the object ID of the condition object (if not null) in the step attributes
*
* @param id_step
* @param code
* @param condition
*/
public void saveConditionStepAttribute(ObjectId id_transformation, ObjectId id_step, String code, Condition condition) throws KettleException {
ObjectId id = null;
if (condition != null) {
id = saveCondition(condition);
Long id_condition = id == null ? Long.valueOf(-1L) : new LongObjectId(id).longValue();
saveStepAttribute(id_transformation, id_step, code, id_condition);
insertTransStepCondition(id_transformation, id_step, condition.getObjectId());
}
}
use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryCreationHelper method updateJobEntryTypes.
/**
* Update the list in R_JOBENTRY_TYPE
*
* @param create
*
* @exception KettleException
* if something went wrong during the update.
*/
public void updateJobEntryTypes(List<String> statements, boolean dryrun, boolean create) throws KettleException {
synchronized (repository) {
// We should only do an update if something has changed...
PluginRegistry registry = PluginRegistry.getInstance();
List<PluginInterface> jobPlugins = registry.getPlugins(JobEntryPluginType.class);
for (int i = 0; i < jobPlugins.size(); i++) {
PluginInterface jobPlugin = jobPlugins.get(i);
String type_desc = jobPlugin.getIds()[0];
String type_desc_long = jobPlugin.getName();
ObjectId id = null;
if (!create) {
id = repository.jobEntryDelegate.getJobEntryTypeID(type_desc);
}
if (id == null) {
// Not found, we need to add this one...
// We need to add this one ...
id = new LongObjectId(i + 1);
if (!create) {
id = repository.connectionDelegate.getNextJobEntryTypeID();
}
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_ID_JOBENTRY_TYPE), id);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_CODE), type_desc);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_DESCRIPTION), type_desc_long);
if (dryrun) {
String sql = database.getSQLOutput(null, KettleDatabaseRepository.TABLE_R_JOBENTRY_TYPE, table.getRowMeta(), table.getData(), null);
statements.add(sql);
} else {
database.prepareInsert(table.getRowMeta(), null, KettleDatabaseRepository.TABLE_R_JOBENTRY_TYPE);
database.setValuesInsert(table);
database.insertRow();
database.closeInsert();
}
}
}
}
}
use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryCreationHelper method updateDatabaseTypes.
/**
* Update the list in R_DATABASE_TYPE using the database plugin entries
*
* @throws KettleException
* if the update didn't go as planned.
*/
public List<String> updateDatabaseTypes(List<String> statements, boolean dryrun, boolean create) throws KettleException {
synchronized (repository) {
// We should only do an update if something has changed...
//
List<PluginInterface> plugins = pluginRegistry.getPlugins(DatabasePluginType.class);
for (int i = 0; i < plugins.size(); i++) {
PluginInterface plugin = plugins.get(i);
ObjectId id = null;
if (!create) {
id = repository.databaseDelegate.getDatabaseTypeID(plugin.getIds()[0]);
}
if (id == null) {
// Not found, we need to add this one...
// We need to add this one ...
id = new LongObjectId(i + 1);
if (!create) {
id = repository.connectionDelegate.getNextDatabaseTypeID();
}
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_DATABASE_TYPE_ID_DATABASE_TYPE), id);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_DATABASE_TYPE_CODE), plugin.getIds()[0]);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_DATABASE_TYPE_DESCRIPTION), plugin.getName());
if (dryrun) {
String sql = database.getSQLOutput(null, KettleDatabaseRepository.TABLE_R_DATABASE_TYPE, table.getRowMeta(), table.getData(), null);
statements.add(sql);
} else {
database.prepareInsert(table.getRowMeta(), null, KettleDatabaseRepository.TABLE_R_DATABASE_TYPE);
database.setValuesInsert(table);
database.insertRow();
database.closeInsert();
}
}
}
}
return statements;
}
use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.
the class MemoryRepository method saveDatabaseMetaJobEntryAttribute.
@Override
public void saveDatabaseMetaJobEntryAttribute(ObjectId id_job, ObjectId id_jobentry, int nr, String nameCode, String idCode, DatabaseMeta database) throws KettleException {
ObjectId id = null;
if (database != null) {
id = database.getObjectId();
Long id_database = id == null ? Long.valueOf(-1L) : new LongObjectId(id).longValue();
// Save both the ID and the name of the database connection...
//
saveJobEntryAttribute(id_job, id_jobentry, nr, idCode, id_database);
saveJobEntryAttribute(id_job, id_jobentry, nr, nameCode, id_database);
insertJobEntryDatabase(id_job, id_jobentry, id);
}
}
Aggregations