Search in sources :

Example 1 with BaseLogTable

use of org.pentaho.di.core.logging.BaseLogTable in project pentaho-kettle by pentaho.

the class XmlExportHelper method swapTables.

/**
 * @param jobMeta
 *            contains log tables to be refactored before export
 */
public static void swapTables(JobMeta jobMeta) {
    JobLogTable jobLogTable = jobMeta.getJobLogTable();
    if (jobLogTable != null) {
        JobLogTable cloneJobLogTable = (JobLogTable) jobLogTable.clone();
        cloneJobLogTable.setAllGlobalParametersToNull();
        jobMeta.setJobLogTable(cloneJobLogTable);
    }
    JobEntryLogTable jobEntryLogTable = jobMeta.getJobEntryLogTable();
    if (jobEntryLogTable != null) {
        JobEntryLogTable cloneEntryLogTable = (JobEntryLogTable) jobEntryLogTable.clone();
        cloneEntryLogTable.setAllGlobalParametersToNull();
        jobMeta.setJobEntryLogTable(cloneEntryLogTable);
    }
    ChannelLogTable channelLogTable = jobMeta.getChannelLogTable();
    if (channelLogTable != null) {
        ChannelLogTable cloneChannelLogTable = (ChannelLogTable) channelLogTable.clone();
        cloneChannelLogTable.setAllGlobalParametersToNull();
        jobMeta.setChannelLogTable(cloneChannelLogTable);
    }
    List<LogTableInterface> extraLogTables = jobMeta.getExtraLogTables();
    if (extraLogTables != null) {
        List<LogTableInterface> cloneExtraLogTables = new ArrayList<>();
        for (LogTableInterface logTable : extraLogTables) {
            if (logTable instanceof BaseLogTable) {
                if (logTable instanceof Cloneable) {
                    BaseLogTable cloneExtraLogTable = (BaseLogTable) logTable.clone();
                    cloneExtraLogTable.setAllGlobalParametersToNull();
                    cloneExtraLogTables.add((LogTableInterface) cloneExtraLogTable);
                }
            }
        }
        jobMeta.setExtraLogTables(cloneExtraLogTables);
    }
}
Also used : LogTableInterface(org.pentaho.di.core.logging.LogTableInterface) JobLogTable(org.pentaho.di.core.logging.JobLogTable) BaseLogTable(org.pentaho.di.core.logging.BaseLogTable) ChannelLogTable(org.pentaho.di.core.logging.ChannelLogTable) ArrayList(java.util.ArrayList) JobEntryLogTable(org.pentaho.di.core.logging.JobEntryLogTable)

Aggregations

ArrayList (java.util.ArrayList)1 BaseLogTable (org.pentaho.di.core.logging.BaseLogTable)1 ChannelLogTable (org.pentaho.di.core.logging.ChannelLogTable)1 JobEntryLogTable (org.pentaho.di.core.logging.JobEntryLogTable)1 JobLogTable (org.pentaho.di.core.logging.JobLogTable)1 LogTableInterface (org.pentaho.di.core.logging.LogTableInterface)1