use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryTransDelegate method insertDependency.
private synchronized ObjectId insertDependency(ObjectId id_transformation, ObjectId id_database, String tablename, String fieldname) throws KettleException {
ObjectId id = repository.connectionDelegate.getNextDepencencyID();
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_DEPENDENCY_ID_DEPENDENCY), id);
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_DEPENDENCY_ID_TRANSFORMATION), id_transformation);
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_DEPENDENCY_ID_DATABASE), id_database);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_DEPENDENCY_TABLE_NAME), tablename);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_DEPENDENCY_FIELD_NAME), fieldname);
repository.connectionDelegate.getDatabase().prepareInsert(table.getRowMeta(), KettleDatabaseRepository.TABLE_R_DEPENDENCY);
repository.connectionDelegate.getDatabase().setValuesInsert(table);
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
return id;
}
use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryUserDelegate method loadUserInfo.
// Load user with login from repository, don't verify password...
public IUser loadUserInfo(IUser userInfo, String login) throws KettleException {
try {
userInfo.setObjectId(getUserID(login));
if (userInfo.getObjectId() != null) {
RowMetaAndData r = getUser(userInfo.getObjectId());
if (r != null) {
userInfo.setLogin(r.getString("LOGIN", null));
userInfo.setPassword(Encr.decryptPassword(r.getString("PASSWORD", null)));
userInfo.setUsername(r.getString("NAME", null));
userInfo.setDescription(r.getString("DESCRIPTION", null));
userInfo.setEnabled(r.getBoolean("ENABLED", false));
return userInfo;
} else {
throw new KettleDatabaseException(BaseMessages.getString(PKG, "UserInfo.Error.UserNotFound", login));
}
} else {
throw new KettleDatabaseException(BaseMessages.getString(PKG, "UserInfo.Error.UserNotFound", login));
}
} catch (KettleDatabaseException dbe) {
throw new KettleException(BaseMessages.getString(PKG, "UserInfo.Error.UserNotLoaded", login, ""), dbe);
}
}
use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method getElements.
@Override
public List<IMetaStoreElement> getElements(String namespace, IMetaStoreElementType elementType) throws MetaStoreException {
try {
IMetaStoreElementType type = getElementTypeByName(namespace, elementType.getName());
if (type == null) {
return new ArrayList<IMetaStoreElement>();
}
Collection<RowMetaAndData> elementRows = delegate.getElements(new LongObjectId(new StringObjectId(type.getId())));
List<IMetaStoreElement> elements = new ArrayList<IMetaStoreElement>();
for (RowMetaAndData elementRow : elementRows) {
IMetaStoreElement element = delegate.parseElement(elementType, elementRow);
elements.add(element);
}
return elements;
} catch (Exception e) {
throw new MetaStoreException("Unable to get list of elements from namespace '" + namespace + "' and for element type '" + elementType.getName() + "'", e);
}
}
use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method getNamespaces.
// Handle namespaces...
@Override
public List<String> getNamespaces() throws MetaStoreException {
try {
List<String> namespaces = new ArrayList<String>();
Collection<RowMetaAndData> namespaceRows = delegate.getNamespaces();
for (RowMetaAndData namespaceRow : namespaceRows) {
String namespace = namespaceRow.getString(KettleDatabaseRepository.FIELD_NAMESPACE_NAME, null);
if (!Utils.isEmpty(namespace)) {
namespaces.add(namespace);
}
}
return namespaces;
} catch (Exception e) {
throw new MetaStoreException(e);
}
}
use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method getElementByName.
@Override
public IMetaStoreElement getElementByName(String namespace, IMetaStoreElementType elementType, String name) throws MetaStoreException {
try {
LongObjectId namespaceId = delegate.getNamespaceId(namespace);
if (namespaceId == null) {
return null;
}
LongObjectId elementTypeId = delegate.getElementTypeId(namespaceId, elementType.getName());
if (elementTypeId == null) {
return null;
}
LongObjectId elementId = delegate.getElementId(elementTypeId, name);
if (elementId == null) {
return null;
}
RowMetaAndData elementRow = delegate.getElement(elementId);
if (elementRow == null) {
return null;
}
return delegate.parseElement(elementType, elementRow);
} catch (Exception e) {
throw new MetaStoreException("Unable to get element by name '" + name + "' from namespace '" + namespace + "'", e);
}
}
Aggregations