Search in sources :

Example 1 with KDBRMetaStoreAttribute

use of org.pentaho.di.repository.kdr.delegates.metastore.KDBRMetaStoreAttribute in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryMetaStoreDelegate method addAttributes.

private void addAttributes(IMetaStoreAttribute parentAttribute, ObjectId elementId, LongObjectId parentAttributeId) throws KettleException {
    Collection<RowMetaAndData> attributeRows = getElementAttributes(elementId, parentAttributeId);
    for (RowMetaAndData attributeRow : attributeRows) {
        KDBRMetaStoreAttribute attribute = parseAttribute(elementId, attributeRow);
        parentAttribute.addChild(attribute);
        // See if this attribute has children...
        addAttributes(attribute, elementId, attribute.getObjectId());
    }
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) KDBRMetaStoreAttribute(org.pentaho.di.repository.kdr.delegates.metastore.KDBRMetaStoreAttribute)

Example 2 with KDBRMetaStoreAttribute

use of org.pentaho.di.repository.kdr.delegates.metastore.KDBRMetaStoreAttribute in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryMetaStoreDelegate method parseAttribute.

private KDBRMetaStoreAttribute parseAttribute(ObjectId elementId, RowMetaAndData attributeRow) throws KettleException {
    try {
        Long attributeId = attributeRow.getInteger(KettleDatabaseRepository.FIELD_ELEMENT_ATTRIBUTE_ID_ELEMENT_ATTRIBUTE);
        String key = attributeRow.getString(KettleDatabaseRepository.FIELD_ELEMENT_ATTRIBUTE_KEY, null);
        String value = attributeRow.getString(KettleDatabaseRepository.FIELD_ELEMENT_ATTRIBUTE_VALUE, null);
        Object object = parseAttributeValue(value);
        KDBRMetaStoreAttribute attribute = new KDBRMetaStoreAttribute(this, key, object);
        attribute.setObjectId(new LongObjectId(attributeId));
        return attribute;
    } catch (Exception e) {
        throw new KettleException("Unable to parse attribute from attribute row: " + attributeRow.toString(), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) LongObjectId(org.pentaho.di.repository.LongObjectId) KDBRMetaStoreAttribute(org.pentaho.di.repository.kdr.delegates.metastore.KDBRMetaStoreAttribute) KettleException(org.pentaho.di.core.exception.KettleException) KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) KettleValueException(org.pentaho.di.core.exception.KettleValueException)

Aggregations

KDBRMetaStoreAttribute (org.pentaho.di.repository.kdr.delegates.metastore.KDBRMetaStoreAttribute)2 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)1 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)1 KettleException (org.pentaho.di.core.exception.KettleException)1 KettleValueException (org.pentaho.di.core.exception.KettleValueException)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 LongObjectId (org.pentaho.di.repository.LongObjectId)1 MetaStoreException (org.pentaho.metastore.api.exceptions.MetaStoreException)1