<commit_before>package model.builder.core

import groovy.transform.TupleConstructor
import model.builder.web.api.API
import org.cytoscape.model.CyNetwork
import org.cytoscape.model.CyTable
import org.cytoscape.model.CyTableFactory
import org.cytoscape.work.AbstractTask
import org.cytoscape.work.TaskMonitor
import static model.builder.core.Util.createColumn

@TupleConstructor
class AddRevisionsTable extends AbstractTask {

    final Map model
    final API api
    final Expando cyRef

    @Override
    void run(TaskMonitor monitor) throws Exception {
        CyTableFactory tableFac = cyRef.cyTableFactory
        CyTable revTable = tableFac.createTable(
                "Revisions - ${model.name}", 'REVISION', Integer.class, true, false)
        createColumn(revTable, 'who', String.class, true)
        createColumn(revTable, 'when', String.class, true)
        createColumn(revTable, 'comment', String.class, true)
        createColumn(revTable, 'uri', String.class, true)
        createColumn(revTable, 'selected', Boolean.class, false)
        cyRef.cyTableManager.addTable(revTable)

        def rev = model.revisions.length() - 1
        model.revisions.each {
            def cyRow = revTable.getRow(rev)
            cyRow.set('who', it.getString('who'))
            cyRow.set('when', it.getString('when'))
            cyRow.set('comment', it.getString('comment'))
            cyRow.set('uri', api.uri(path: "/api/models/${model.id}/revisions/$rev"))
            rev--
        }

        def network = cyRef.cyApplicationManager.currentNetwork
        cyRef.cyNetworkTableManager.setTable(network, CyNetwork.class, 'sdp.revisions', revTable)
    }
}<commit_msg>do not setTable for revisions; never use api<commit_after>package model.builder.core

import groovy.transform.TupleConstructor
import model.builder.web.api.API
import org.cytoscape.model.CyNetwork
import org.cytoscape.model.CyTable
import org.cytoscape.model.CyTableFactory
import org.cytoscape.work.AbstractTask
import org.cytoscape.work.TaskMonitor
import static model.builder.core.Util.createColumn

@TupleConstructor
class AddRevisionsTable extends AbstractTask {

    final Map model
    final API api
    final Expando cyRef

    @Override
    void run(TaskMonitor monitor) throws Exception {
        CyTableFactory tableFac = cyRef.cyTableFactory
        CyTable revTable = tableFac.createTable(
                "Revisions - ${model.name}", 'REVISION', Integer.class, true, false)
        createColumn(revTable, 'who', String.class, true)
        createColumn(revTable, 'when', String.class, true)
        createColumn(revTable, 'comment', String.class, true)
        createColumn(revTable, 'uri', String.class, true)
        createColumn(revTable, 'selected', Boolean.class, false)
        cyRef.cyTableManager.addTable(revTable)

        def rev = model.revisions.length() - 1
        model.revisions.each {
            def cyRow = revTable.getRow(rev)
            cyRow.set('who', it.getString('who'))
            cyRow.set('when', it.getString('when'))
            cyRow.set('comment', it.getString('comment'))
            cyRow.set('uri', api.uri(path: "/api/models/${model.id}/revisions/$rev"))
            rev--
        }
    }
}
{'fraction_non_alphanumeric': 0.11218147917961467, 'fraction_numerical': 0.0006215040397762585, 'mean_word_length': 3.164294954721863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '255377', 'n_tokens_mistral': 954, 'n_tokens_neox': 916, 'n_words': 194}