Search in sources :

Example 6 with ModelContent

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

the class DatabaseQueryConnectionSettings method createConnectionModel.

/**
 * {@inheritDoc}
 */
@Override
public ModelContentRO createConnectionModel() {
    ModelContent cont = new ModelContent("database_query_connection_model");
    saveConnection(cont);
    return cont;
}
Also used : ModelContent(org.knime.core.node.ModelContent)

Example 7 with ModelContent

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

the class AbstractSimplePortObjectSpec method hashCode.

/**
 * {@inheritDoc}
 */
@Override
public int hashCode() {
    ModelContent tcont = new ModelContent("ignored");
    this.save(tcont);
    return tcont.hashCode();
}
Also used : ModelContent(org.knime.core.node.ModelContent)

Example 8 with ModelContent

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

the class AbstractSimplePortObject method equals.

/**
 * Method compares both <code>ModelContent</code> objects that first need
 * to be saved by calling {@link #save(ModelContentWO, ExecutionMonitor)}.
 * Override this method in order to compare both objects more efficiently.
 *
 * {@inheritDoc}
 */
@Override
public boolean equals(final Object oport) {
    if (oport == this) {
        return true;
    }
    if (oport == null) {
        return false;
    }
    if (!this.getClass().equals(oport.getClass())) {
        return false;
    }
    ModelContent tcont = new ModelContent("ignored");
    ModelContent ocont = new ModelContent("ignored");
    try {
        this.save(tcont, new ExecutionMonitor());
        ((AbstractSimplePortObject) oport).save(ocont, new ExecutionMonitor());
    } catch (CanceledExecutionException cee) {
    // ignored, should not happen
    }
    return tcont.equals(ocont);
}
Also used : CanceledExecutionException(org.knime.core.node.CanceledExecutionException) ModelContent(org.knime.core.node.ModelContent) ExecutionMonitor(org.knime.core.node.ExecutionMonitor)

Example 9 with ModelContent

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

the class DatabaseConnectionSettings method createConnectionModel.

/**
 * Create connection model with all settings used to create a database
 * connection.
 * @return database connection model
 */
public ModelContentRO createConnectionModel() {
    ModelContent cont = new ModelContent("database_connection_model");
    saveConnection(cont);
    return cont;
}
Also used : ModelContent(org.knime.core.node.ModelContent)

Example 10 with ModelContent

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

the class FilterDefinitionHandlerPortObject method getViews.

/**
 * {@inheritDoc}
 */
@Override
public JComponent[] getViews() {
    ModelContent model = new ModelContent("FilterDefinition");
    Config columnConfig = model.addConfig("Column");
    getSpec().forEach(col -> col.getFilterHandler().ifPresent(handler -> handler.save(columnConfig.addConfig(col.getName()))));
    return new JComponent[] { new ModelContentOutPortView(model) };
}
Also used : JComponent(javax.swing.JComponent) PortTypeRegistry(org.knime.core.node.port.PortTypeRegistry) ModelContent(org.knime.core.node.ModelContent) ModelContentOutPortView(org.knime.core.node.workflow.ModelContentOutPortView) DataTableSpec(org.knime.core.data.DataTableSpec) Config(org.knime.core.node.config.Config) PortType(org.knime.core.node.port.PortType) ModelContent(org.knime.core.node.ModelContent) Config(org.knime.core.node.config.Config) JComponent(javax.swing.JComponent) ModelContentOutPortView(org.knime.core.node.workflow.ModelContentOutPortView)

Aggregations

ModelContent (org.knime.core.node.ModelContent)29 File (java.io.File)15 FileOutputStream (java.io.FileOutputStream)15 BufferedOutputStream (java.io.BufferedOutputStream)12 GZIPOutputStream (java.util.zip.GZIPOutputStream)11 ModelContentWO (org.knime.core.node.ModelContentWO)7 JComponent (javax.swing.JComponent)6 ModelContentOutPortView (org.knime.core.node.workflow.ModelContentOutPortView)6 DataTableSpec (org.knime.core.data.DataTableSpec)3 ZipEntry (java.util.zip.ZipEntry)2 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)2 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 OutputStream (java.io.OutputStream)1 LinkedHashSet (java.util.LinkedHashSet)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 DataColumnSpec (org.knime.core.data.DataColumnSpec)1 DataColumnSpecCreator (org.knime.core.data.DataColumnSpecCreator)1 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)1