Search in sources :

Example 21 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class DefaultTableStoreWriter method writeMetaInfoAfterWrite.

/**
 * {@inheritDoc}
 */
@Override
public void writeMetaInfoAfterWrite(final NodeSettingsWO settings) {
    settings.addString(DefaultTableStoreFormat.CFG_COMPRESSION, m_compressionFormat.name());
    // unreported bug fix: NPE when the table only contains missing values.
    if (m_typeShortCuts == null) {
        m_typeShortCuts = new HashMap<CellClassInfo, Byte>();
    }
    CellClassInfo[] shortCutsLookup = new CellClassInfo[m_typeShortCuts.size()];
    for (Map.Entry<CellClassInfo, Byte> e : m_typeShortCuts.entrySet()) {
        byte shortCut = e.getValue();
        CellClassInfo type = e.getKey();
        shortCutsLookup[shortCut - BYTE_TYPE_START] = type;
    }
    m_shortCutsLookup = shortCutsLookup;
    NodeSettingsWO typeSubSettings = settings.addNodeSettings(DefaultTableStoreFormat.CFG_CELL_CLASSES);
    for (int i = 0; i < shortCutsLookup.length; i++) {
        CellClassInfo info = shortCutsLookup[i];
        NodeSettingsWO single = typeSubSettings.addNodeSettings("element_" + i);
        single.addString(DefaultTableStoreFormat.CFG_CELL_SINGLE_CLASS, info.getCellClass().getName());
        DataType elementType = info.getCollectionElementType();
        if (elementType != null) {
            NodeSettingsWO subTypeConfig = single.addNodeSettings(DefaultTableStoreFormat.CFG_CELL_SINGLE_ELEMENT_TYPE);
            elementType.save(subTypeConfig);
        }
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO) DataType(org.knime.core.data.DataType) HashMap(java.util.HashMap) Map(java.util.Map)

Example 22 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class JoinedTable method saveToFile.

/**
 * {@inheritDoc}
 */
@Override
public void saveToFile(final File f, final NodeSettingsWO settings, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
    NodeSettingsWO internals = settings.addNodeSettings(CFG_INTERNAL_META);
    internals.addInt(CFG_LEFT_TABLE_ID, m_leftTable.getBufferedTableId());
    internals.addInt(CFG_RIGHT_TABLE_ID, m_rightTable.getBufferedTableId());
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 23 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class RearrangeColumnsTable method saveToFile.

/**
 * {@inheritDoc}
 */
@Override
public void saveToFile(final File f, final NodeSettingsWO s, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
    NodeSettingsWO subSettings = s.addNodeSettings(CFG_INTERNAL_META);
    subSettings.addInt(CFG_REFERENCE_ID, m_reference.getBufferedTableId());
    subSettings.addIntArray(CFG_MAP, m_map);
    subSettings.addBooleanArray(CFG_FLAGS, m_isFromRefTable);
    if (m_appendTable != null) {
        // subSettings argument is ignored in ContainerTable
        m_appendTable.saveToFile(f, subSettings, exec);
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 24 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class NodeExecutionJobManagerPool method saveJobManager.

/**
 * Saves the argument job manager to a settings object.
 *
 * @param jobManager The job manager to save.
 * @param settings To save to.
 */
public static void saveJobManager(final NodeExecutionJobManager jobManager, final NodeSettingsWO settings) {
    settings.addString(CFG_JOB_MANAGER_FACTORY_ID, jobManager.getID());
    NodeSettingsWO sub = settings.addNodeSettings(CFG_JOB_MANAGER_SETTINGS);
    jobManager.save(sub);
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 25 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class CreateTempDirectoryConfiguration method save.

void save(final NodeSettingsWO settings) {
    settings.addString("baseName", m_baseName);
    settings.addString("variableName", m_variableName);
    settings.addBoolean("deleteOnReset", m_deleteOnReset);
    NodeSettingsWO pairs = settings.addNodeSettings("variable_name_pairs");
    if (m_pairs != null) {
        for (VarNameFileNamePair v : m_pairs) {
            NodeSettingsWO p = pairs.addNodeSettings(v.getVariableName());
            p.addString("variableName", v.getVariableName());
            p.addString("fileName", v.getFileName());
        }
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Aggregations

NodeSettingsWO (org.knime.core.node.NodeSettingsWO)111 NodeSettings (org.knime.core.node.NodeSettings)16 Map (java.util.Map)11 File (java.io.File)9 FileOutputStream (java.io.FileOutputStream)9 LinkedHashMap (java.util.LinkedHashMap)9 HashMap (java.util.HashMap)8 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)8 RowKey (org.knime.core.data.RowKey)6 DataCell (org.knime.core.data.DataCell)5 BufferedOutputStream (java.io.BufferedOutputStream)4 NodeSettingsRO (org.knime.core.node.NodeSettingsRO)4 HashSet (java.util.HashSet)3 GZIPOutputStream (java.util.zip.GZIPOutputStream)3 DataRow (org.knime.core.data.DataRow)3 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)3 AbstractQuickFormConfiguration (org.knime.core.quickform.AbstractQuickFormConfiguration)3 AbstractQuickFormValueInConfiguration (org.knime.core.quickform.AbstractQuickFormValueInConfiguration)3 QuickFormInputNode (org.knime.core.quickform.in.QuickFormInputNode)3 MutableInteger (org.knime.core.util.MutableInteger)3