Search in sources :

Example 81 with NodeSettings

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

the class SingleNodeContainer method saveNodeSettingsToDefault.

/**
 * Implementation of {@link WorkflowManager#saveNodeSettingsToDefault(NodeID)}.
 */
void saveNodeSettingsToDefault() {
    NodeSettings modelSettings = new NodeSettings("model");
    NodeContext.pushContext(this);
    try {
        performSaveModelSettingsTo(modelSettings);
    } finally {
        NodeContext.removeLastContext();
    }
    m_settings.setModelSettings(modelSettings);
}
Also used : NodeSettings(org.knime.core.node.NodeSettings)

Example 82 with NodeSettings

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

the class DBPivotNodeModel method loadValidatedSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadValidatedSettingsFrom(final NodeSettingsRO settings) throws InvalidSettingsException {
    super.loadValidatedSettingsFrom(settings);
    m_groupByCols.loadSettingsFrom(settings);
    m_pivotCols.loadSettingsFrom(settings);
    m_columnNamePolicy.loadSettingsFrom(settings);
    m_settings = new NodeSettings("copy");
    settings.copyTo(m_settings);
}
Also used : NodeSettings(org.knime.core.node.NodeSettings)

Example 83 with NodeSettings

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

the class ReadSysPropertyNodeModel method configure.

/**
 * {@inheritDoc}
 */
@Override
protected DataTableSpec[] configure(final DataTableSpec[] inSpecs) throws InvalidSettingsException {
    if (m_config == null) {
        m_config = new ReadSysPropertyConfiguration();
        m_config.loadSettingsNoFail(new NodeSettings("empty"));
        setWarningMessage("Auto-configuration: " + "extracting all available properties");
    }
    Result result = m_config.createResult();
    String message = result.getWarningMessage();
    if (message != null) {
        setWarningMessage(message);
    }
    DataTable table = result.getTable();
    return new DataTableSpec[] { table.getDataTableSpec() };
}
Also used : DataTable(org.knime.core.data.DataTable) BufferedDataTable(org.knime.core.node.BufferedDataTable) NodeSettings(org.knime.core.node.NodeSettings) DataTableSpec(org.knime.core.data.DataTableSpec) Result(org.knime.base.node.io.extractsysprop.ReadSysPropertyConfiguration.Result)

Example 84 with NodeSettings

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

the class Statistics2NodeModel method saveInternals.

/**
 * {@inheritDoc}
 */
@Override
protected void saveInternals(final File internDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
    NodeSettings sett = new NodeSettings("statistic.xml.gz");
    m_statTable.save(sett);
    sett.saveToXML(new FileOutputStream(new File(internDir, sett.getKey())));
}
Also used : NodeSettings(org.knime.core.node.NodeSettings) FileOutputStream(java.io.FileOutputStream) File(java.io.File)

Example 85 with NodeSettings

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

the class AggregationOperator method equals.

/**
 * {@inheritDoc}
 */
@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    AggregationOperator other = (AggregationOperator) obj;
    if (m_operatorData == null) {
        if (other.m_operatorData != null) {
            return false;
        }
    } else if (!m_operatorData.equals(other.m_operatorData)) {
        return false;
    }
    if (m_globalSettings == null) {
        if (other.m_globalSettings != null) {
            return false;
        }
    } else if (!m_globalSettings.equals(other.m_globalSettings)) {
        return false;
    }
    if (m_opColSettings == null) {
        if (other.m_opColSettings != null) {
            return false;
        }
    } else if (!m_opColSettings.equals(other.m_opColSettings)) {
        return false;
    }
    if (m_skipMsg == null) {
        if (other.m_skipMsg != null) {
            return false;
        }
    } else if (!m_skipMsg.equals(other.m_skipMsg)) {
        return false;
    }
    if (m_skipped != other.m_skipped) {
        return false;
    }
    if (other.hasOptionalSettings()) {
        if (hasOptionalSettings()) {
            // check the optional settings as well
            // USE THE SAME KEY FOR BOTH SETTINGS!
            final String key = "key";
            final NodeSettings s1 = new NodeSettings(key);
            other.saveSettingsTo(s1);
            final NodeSettings s2 = new NodeSettings(key);
            saveSettingsTo(s2);
            return s1.equals(s2);
        } else {
            return true;
        }
    }
    return true;
}
Also used : NodeSettings(org.knime.core.node.NodeSettings)

Aggregations

NodeSettings (org.knime.core.node.NodeSettings)156 File (java.io.File)58 FileOutputStream (java.io.FileOutputStream)57 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)37 GZIPOutputStream (java.util.zip.GZIPOutputStream)27 NodeSettingsRO (org.knime.core.node.NodeSettingsRO)17 Test (org.junit.Test)16 NodeSettingsWO (org.knime.core.node.NodeSettingsWO)16 DefaultHiLiteMapper (org.knime.core.node.property.hilite.DefaultHiLiteMapper)16 IOException (java.io.IOException)14 OutputStream (java.io.OutputStream)12 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)11 BufferedOutputStream (java.io.BufferedOutputStream)9 Map (java.util.Map)8 RowKey (org.knime.core.data.RowKey)8 Config (org.knime.core.node.config.Config)8 LinkedHashMap (java.util.LinkedHashMap)7 DataTableSpec (org.knime.core.data.DataTableSpec)7 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)6 ArrayList (java.util.ArrayList)5