<commit_before>package brix.plugin.site.admin;

import java.util.Collection;

import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import brix.BrixRequestCycle.Locator;
import brix.auth.Action;
import brix.auth.impl.ConvertNodeActionImpl;
import brix.jcr.api.JcrNode;
import brix.plugin.site.SiteNavigationTreeNode;
import brix.plugin.site.SiteNodePlugin;
import brix.plugin.site.SitePlugin;
import brix.web.admin.navigation.NavigationTreeNode;
import brix.web.util.TextLink;

public class ConvertNodePanel extends NodeManagerPanel
{

    public ConvertNodePanel(String id, IModel<JcrNode> nodeModel)
    {
        super(id, nodeModel);

        RepeatingView converters = new RepeatingView("converters");
        add(converters);

        JcrNode node = getNode();
        Collection<SiteNodePlugin> plugins = SitePlugin.get().getNodePlugins();

        boolean found = false;

        for (SiteNodePlugin plugin : plugins)
        {
            if (plugin.getConverterForNode(node) != null)
            {

                Action action = new ConvertNodeActionImpl(Action.Context.ADMINISTRATION, node,
                        plugin.getNodeType());

                if (Locator.getBrix().getAuthorizationStrategy().isActionAuthorized(action))
                {

                    found = true;

                    WebMarkupContainer item = new WebMarkupContainer(converters.newChildId());
                    converters.add(item);

                    Model typeName = new Model(plugin.getNodeType());
                    item.add(new TextLink("convert", typeName, new Model(plugin.getName()))
                    {

                        @Override
                        public void onClick()
                        {
                            final String type = (String)getModelObject();
                            convertToType(type);
                        }

                    });
                }
            }
        }

        setVisible(found);
    }

    private void convertToType(String type)
    {
        final JcrNode node = getNode();

        node.checkout();
        SitePlugin.get().getNodePluginForType(type).getConverterForNode(getNode()).convert(node);
        node.save();
        node.checkin();

        NavigationTreeNode treeNode = new SiteNavigationTreeNode(node);
        getNavigation().selectNode(treeNode);

    }

}<commit_msg>make conversion and upload work<commit_after>package brix.plugin.site.admin;

import java.util.Collection;

import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import brix.BrixRequestCycle.Locator;
import brix.auth.Action;
import brix.auth.impl.ConvertNodeActionImpl;
import brix.jcr.api.JcrNode;
import brix.plugin.site.SiteNavigationTreeNode;
import brix.plugin.site.SiteNodePlugin;
import brix.plugin.site.SitePlugin;
import brix.web.admin.navigation.NavigationTreeNode;
import brix.web.util.TextLink;

public class ConvertNodePanel extends NodeManagerPanel
{

    public ConvertNodePanel(String id, IModel<JcrNode> nodeModel)
    {
        super(id, nodeModel);

        RepeatingView converters = new RepeatingView("converters");
        add(converters);

        JcrNode node = getNode();
        Collection<SiteNodePlugin> plugins = SitePlugin.get().getNodePlugins();

        boolean found = false;

        for (SiteNodePlugin plugin : plugins)
        {
            if (plugin.getConverterForNode(node) != null)
            {

                Action action = new ConvertNodeActionImpl(Action.Context.ADMINISTRATION, node,
                        plugin.getNodeType());

                if (Locator.getBrix().getAuthorizationStrategy().isActionAuthorized(action))
                {

                    found = true;

                    WebMarkupContainer item = new WebMarkupContainer(converters.newChildId());
                    converters.add(item);

                    Model typeName = new Model(plugin.getNodeType());
                    item.add(new TextLink("convert", typeName, new Model(plugin.getName()))
                    {

                        @Override
                        public void onClick()
                        {
                            final String type = (String)getModelObject();
                            convertToType(type);
                        }

                    });
                }
            }
        }

        setVisible(found);
    }

    private void convertToType(String type)
    {
        final JcrNode node = getNode();

        node.checkout();
        SitePlugin.get().getNodePluginForType(type).getConverterForNode(getNode()).convert(node);
        node.save();
        node.checkin();
        
        getModel().detach();

        NavigationTreeNode treeNode = new SiteNavigationTreeNode(getNode());
        getNavigation().selectNode(treeNode);

    }

}
{'fraction_non_alphanumeric': 0.0966411314083677, 'fraction_numerical': 0.0, 'mean_word_length': 2.0935601458080195, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3436789', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1326, 'n_words': 233}