Search in sources :

Example 36 with ObjectId

use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.

the class KettleDatabaseRepository method deleteCondition.

public synchronized void deleteCondition(ObjectId id_condition) throws KettleException {
    boolean ok = true;
    ObjectId[] ids = getSubConditionIDs(id_condition);
    if (ids.length > 0) {
        // Delete the sub-conditions...
        for (int i = 0; i < ids.length && ok; i++) {
            deleteCondition(ids[i]);
        }
        // Then delete the main condition
        deleteCondition(id_condition);
    } else {
        connectionDelegate.performDelete("DELETE FROM " + quoteTable(KettleDatabaseRepository.TABLE_R_CONDITION) + " WHERE " + quote(KettleDatabaseRepository.FIELD_CONDITION_ID_CONDITION) + " = ? ", id_condition);
    }
}
Also used : LongObjectId(org.pentaho.di.repository.LongObjectId) ObjectId(org.pentaho.di.repository.ObjectId) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 37 with ObjectId

use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.

the class KettleDatabaseRepository method delTransNotes.

public synchronized void delTransNotes(ObjectId id_transformation) throws KettleException {
    ObjectId[] ids = getTransNoteIDs(id_transformation);
    for (int i = 0; i < ids.length; i++) {
        connectionDelegate.performDelete("DELETE FROM " + quoteTable(KettleDatabaseRepository.TABLE_R_NOTE) + " WHERE " + quote(KettleDatabaseRepository.FIELD_NOTE_ID_NOTE) + " = ? ", ids[i]);
    }
    connectionDelegate.performDelete("DELETE FROM " + quoteTable(KettleDatabaseRepository.TABLE_R_TRANS_NOTE) + " WHERE " + quote(KettleDatabaseRepository.FIELD_TRANS_NOTE_ID_TRANSFORMATION) + " = ? ", id_transformation);
}
Also used : LongObjectId(org.pentaho.di.repository.LongObjectId) ObjectId(org.pentaho.di.repository.ObjectId) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 38 with ObjectId

use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.

the class KettleDatabaseRepository method readDatabases.

/**
 * Read all the databases defined in the repository
 *
 * @return a list of all the databases defined in the repository
 * @throws KettleException
 */
public List<DatabaseMeta> readDatabases() throws KettleException {
    List<DatabaseMeta> databases = new ArrayList<>();
    ObjectId[] ids = getDatabaseIDs(false);
    for (int i = 0; i < ids.length; i++) {
        // reads last
        DatabaseMeta databaseMeta = loadDatabaseMeta(ids[i], null);
        // versions
        databases.add(databaseMeta);
    }
    return databases;
}
Also used : LongObjectId(org.pentaho.di.repository.LongObjectId) ObjectId(org.pentaho.di.repository.ObjectId) ArrayList(java.util.ArrayList) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 39 with ObjectId

use of org.pentaho.di.repository.ObjectId 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());
    }
}
Also used : LongObjectId(org.pentaho.di.repository.LongObjectId) ObjectId(org.pentaho.di.repository.ObjectId) LongObjectId(org.pentaho.di.repository.LongObjectId)

Example 40 with ObjectId

use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.

the class KettleDatabaseRepository method delJobNotes.

public synchronized void delJobNotes(ObjectId id_job) throws KettleException {
    ObjectId[] ids = getJobNoteIDs(id_job);
    for (int i = 0; i < ids.length; i++) {
        connectionDelegate.performDelete("DELETE FROM " + quoteTable(KettleDatabaseRepository.TABLE_R_NOTE) + " WHERE " + quote(KettleDatabaseRepository.FIELD_NOTE_ID_NOTE) + " = ? ", ids[i]);
    }
    connectionDelegate.performDelete("DELETE FROM " + quoteTable(KettleDatabaseRepository.TABLE_R_JOB_NOTE) + " WHERE " + quote(KettleDatabaseRepository.FIELD_JOB_NOTE_ID_JOB) + " = ? ", id_job);
}
Also used : LongObjectId(org.pentaho.di.repository.LongObjectId) ObjectId(org.pentaho.di.repository.ObjectId) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Aggregations

ObjectId (org.pentaho.di.repository.ObjectId)200 KettleException (org.pentaho.di.core.exception.KettleException)91 LongObjectId (org.pentaho.di.repository.LongObjectId)76 StringObjectId (org.pentaho.di.repository.StringObjectId)52 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)49 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)36 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)33 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)32 ArrayList (java.util.ArrayList)28 Test (org.junit.Test)28 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)28 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)25 MessageBox (org.eclipse.swt.widgets.MessageBox)24 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)18 SlaveServer (org.pentaho.di.cluster.SlaveServer)15 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)14 Matchers.anyString (org.mockito.Matchers.anyString)13 MetaStoreException (org.pentaho.metastore.api.exceptions.MetaStoreException)13 MetaStoreNamespaceExistsException (org.pentaho.metastore.api.exceptions.MetaStoreNamespaceExistsException)13 KettleFileException (org.pentaho.di.core.exception.KettleFileException)12