<commit_before>package com.angkorteam.mbaas.server.page.rest;

import com.angkorteam.framework.extension.wicket.markup.html.form.Button;
import com.angkorteam.framework.extension.wicket.markup.html.form.Form;
import com.angkorteam.framework.extension.wicket.markup.html.form.select2.Select2MultipleChoice;
import com.angkorteam.framework.extension.wicket.markup.html.form.select2.Select2SingleChoice;
import com.angkorteam.framework.extension.wicket.markup.html.panel.TextFeedbackPanel;
import com.angkorteam.mbaas.plain.enums.TypeEnum;
import com.angkorteam.mbaas.server.renderer.HttpHeaderRenderer;
import com.angkorteam.mbaas.server.renderer.HttpQueryRenderer;
import com.angkorteam.mbaas.server.renderer.JsonChoiceRenderer;
import com.angkorteam.mbaas.server.select2.EnumChoiceProvider;
import com.angkorteam.mbaas.server.select2.HttpHeaderChoiceProvider;
import com.angkorteam.mbaas.server.select2.HttpQueryChoiceProvider;
import com.angkorteam.mbaas.server.select2.JsonChoiceProvider;
import com.angkorteam.mbaas.server.wicket.MasterPage;
import com.angkorteam.mbaas.server.wicket.Mount;
import com.angkorteam.mbaas.server.wicket.OnChangeAjaxBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.PropertyModel;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * Created by socheat on 8/3/16.
 */
@AuthorizeInstantiation({"administrator"})
@Mount("/rest/create")
public class RestCreatePage extends MasterPage {

    private String requestPath;
    private TextField<String> requestPathField;
    private TextFeedbackPanel requestPathFeedback;

    private List<String> methods;
    private String method;
    private DropDownChoice<String> methodField;
    private TextFeedbackPanel methodFeedback;

    private List<String> requestContentTypes;
    private String requestContentType;
    private DropDownChoice<String> requestContentTypeField;
    private TextFeedbackPanel requestContentTypeFeedback;

    private List<String> requestBodyTypes;
    private String requestBodyType;
    private DropDownChoice<String> requestBodyTypeField;
    private TextFeedbackPanel requestBodyTypeFeedback;

    private List<String> requestBodySubTypes;
    private String requestBodySubType;
    private DropDownChoice<String> requestBodySubTypeField;
    private TextFeedbackPanel requestBodySubTypeFeedback;

    private Map<String, Object> requestBodyMapJson;
    private Select2SingleChoice<Map<String, Object>> requestBodyMapJsonField;
    private TextFeedbackPanel requestBodyMapJsonFeedback;

    private Map<String, Object> requestBodyEnum;
    private Select2SingleChoice<Map<String, Object>> requestBodyEnumField;
    private TextFeedbackPanel requestBodyEnumFeedback;

    private List<Map<String, Object>> requestHeaderRequired;
    private Select2MultipleChoice<Map<String, Object>> requestHeaderRequiredField;
    private TextFeedbackPanel requestHeaderRequiredFeedback;

    private List<Map<String, Object>> requestHeaderOptional;
    private Select2MultipleChoice<Map<String, Object>> requestHeaderOptionalField;
    private TextFeedbackPanel requestHeaderOptionalFeedback;

    private List<Map<String, Object>> requestQueryRequired;
    private Select2MultipleChoice<Map<String, Object>> requestQueryRequiredField;
    private TextFeedbackPanel requestQueryRequiredFeedback;

    private List<Map<String, Object>> requestQueryOptional;
    private Select2MultipleChoice<Map<String, Object>> requestQueryOptionalField;
    private TextFeedbackPanel requestQueryOptionalFeedback;

    private List<String> responseContentTypes;
    private String responseContentType;
    private DropDownChoice<String> responseContentTypeField;
    private TextFeedbackPanel responseContentTypeFeedback;

    private List<String> responseBodyTypes;
    private String responseBodyType;
    private DropDownChoice<String> responseBodyTypeField;
    private TextFeedbackPanel responseBodyTypeFeedback;

    private List<String> responseBodySubTypes;
    private String responseBodySubType;
    private DropDownChoice<String> responseBodySubTypeField;
    private TextFeedbackPanel responseBodySubTypeFeedback;

    private Map<String, Object> responseBodyMapJson;
    private Select2SingleChoice<Map<String, Object>> responseBodyMapJsonField;
    private TextFeedbackPanel responseBodyMapJsonFeedback;

    private Map<String, Object> responseBodyEnum;
    private Select2SingleChoice<Map<String, Object>> responseBodyEnumField;
    private TextFeedbackPanel responseBodyEnumFeedback;

    private List<Map<String, Object>> responseHeaderRequired;
    private Select2MultipleChoice<Map<String, Object>> responseHeaderRequiredField;
    private TextFeedbackPanel responseHeaderRequiredFeedback;

    private List<Map<String, Object>> responseHeaderOptional;
    private Select2MultipleChoice<Map<String, Object>> responseHeaderOptionalField;
    private TextFeedbackPanel responseHeaderOptionalFeedback;

    private String script;
    private TextField<String> scriptField;
    private TextFeedbackPanel scriptFeedback;

    private Form<Void> form;
    private Button saveButton;

    @Override
    protected void onInitialize() {
        super.onInitialize();

        this.form = new Form<>("form");
        this.add(this.form);

        this.methods = Arrays.asList(HttpMethod.GET.name(), HttpMethod.DELETE.name(), HttpMethod.POST.name(), HttpMethod.PUT.name());
        this.methodField = new DropDownChoice<>("methodField", new PropertyModel<>(this, "method"), new PropertyModel<>(this, "methods"));
        this.methodField.setOutputMarkupId(true);
        this.methodField.setRequired(true);
        this.methodField.add(new OnChangeAjaxBehavior(this::methodFieldAjaxUpdate));
        this.form.add(this.methodField);
        this.methodFeedback = new TextFeedbackPanel("methodFeedback", this.methodField);
        this.form.add(this.methodFeedback);<commit_msg>more code for swagger api<commit_after>package com.angkorteam.mbaas.server.page.rest;

import com.angkorteam.framework.extension.wicket.markup.html.form.Button;
import com.angkorteam.framework.extension.wicket.markup.html.form.Form;
import com.angkorteam.framework.extension.wicket.markup.html.form.JavascriptTextArea;
import com.angkorteam.framework.extension.wicket.markup.html.form.select2.Select2MultipleChoice;
import com.angkorteam.framework.extension.wicket.markup.html.form.select2.Select2SingleChoice;
import com.angkorteam.framework.extension.wicket.markup.html.panel.TextFeedbackPanel;
import com.angkorteam.mbaas.plain.enums.TypeEnum;
import com.angkorteam.mbaas.server.renderer.HttpHeaderRenderer;
import com.angkorteam.mbaas.server.renderer.HttpQueryRenderer;
import com.angkorteam.mbaas.server.renderer.JsonChoiceRenderer;
import com.angkorteam.mbaas.server.select2.EnumChoiceProvider;
import com.angkorteam.mbaas.server.select2.HttpHeaderChoiceProvider;
import com.angkorteam.mbaas.server.select2.HttpQueryChoiceProvider;
import com.angkorteam.mbaas.server.select2.JsonChoiceProvider;
import com.angkorteam.mbaas.server.wicket.MasterPage;
import com.angkorteam.mbaas.server.wicket.Mount;
import com.angkorteam.mbaas.server.wicket.OnChangeAjaxBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.PropertyModel;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * Created by socheat on 8/3/16.
 */
@AuthorizeInstantiation({"administrator"})
@Mount("/rest/create")
public class RestCreatePage extends MasterPage {

    private String requestPath;
    private TextField<String> requestPathField;
    private TextFeedbackPanel requestPathFeedback;

    private List<String> methods;
    private String method;
    private DropDownChoice<String> methodField;
    private TextFeedbackPanel methodFeedback;

    private List<String> requestContentTypes;
    private String requestContentType;
    private DropDownChoice<String> requestContentTypeField;
    private TextFeedbackPanel requestContentTypeFeedback;

    private List<String> requestBodyTypes;
    private String requestBodyType;
    private DropDownChoice<String> requestBodyTypeField;
    private TextFeedbackPanel requestBodyTypeFeedback;

    private List<String> requestBodySubTypes;
    private String requestBodySubType;
    private DropDownChoice<String> requestBodySubTypeField;
    private TextFeedbackPanel requestBodySubTypeFeedback;

    private Map<String, Object> requestBodyMapJson;
    private Select2SingleChoice<Map<String, Object>> requestBodyMapJsonField;
    private TextFeedbackPanel requestBodyMapJsonFeedback;

    private Map<String, Object> requestBodyEnum;
    private Select2SingleChoice<Map<String, Object>> requestBodyEnumField;
    private TextFeedbackPanel requestBodyEnumFeedback;

    private List<Map<String, Object>> requestHeaderRequired;
    private Select2MultipleChoice<Map<String, Object>> requestHeaderRequiredField;
    private TextFeedbackPanel requestHeaderRequiredFeedback;

    private List<Map<String, Object>> requestHeaderOptional;
    private Select2MultipleChoice<Map<String, Object>> requestHeaderOptionalField;
    private TextFeedbackPanel requestHeaderOptionalFeedback;

    private List<Map<String, Object>> requestQueryRequired;
    private Select2MultipleChoice<Map<String, Object>> requestQueryRequiredField;
    private TextFeedbackPanel requestQueryRequiredFeedback;

    private List<Map<String, Object>> requestQueryOptional;
    private Select2MultipleChoice<Map<String, Object>> requestQueryOptionalField;
    private TextFeedbackPanel requestQueryOptionalFeedback;

    private List<String> responseContentTypes;
    private String responseContentType;
    private DropDownChoice<String> responseContentTypeField;
    private TextFeedbackPanel responseContentTypeFeedback;

    private List<String> responseBodyTypes;
    private String responseBodyType;
    private DropDownChoice<String> responseBodyTypeField;
    private TextFeedbackPanel responseBodyTypeFeedback;

    private List<String> responseBodySubTypes;
    private String responseBodySubType;
    private DropDownChoice<String> responseBodySubTypeField;
    private TextFeedbackPanel responseBodySubTypeFeedback;

    private Map<String, Object> responseBodyMapJson;
    private Select2SingleChoice<Map<String, Object>> responseBodyMapJsonField;
    private TextFeedbackPanel responseBodyMapJsonFeedback;

    private Map<String, Object> responseBodyEnum;
    private Select2SingleChoice<Map<String, Object>> responseBodyEnumField;
    private TextFeedbackPanel responseBodyEnumFeedback;

    private List<Map<String, Object>> responseHeaderRequired;
    private Select2MultipleChoice<Map<String, Object>> responseHeaderRequiredField;
    private TextFeedbackPanel responseHeaderRequiredFeedback;

    private List<Map<String, Object>> responseHeaderOptional;
    private Select2MultipleChoice<Map<String, Object>> responseHeaderOptionalField;
    private TextFeedbackPanel responseHeaderOptionalFeedback;

    private String script;
    private JavascriptTextArea scriptField;
    private TextFeedbackPanel scriptFeedback;

    private Form<Void> form;
    private Button saveButton;

    @Override
    protected void onInitialize() {
        super.onInitialize();

        this.form = new Form<>("form");
        this.add(this.form);

        this.methods = Arrays.asList(HttpMethod.GET.name(), HttpMethod.DELETE.name(), HttpMethod.POST.name(), HttpMethod.PUT.name());
        this.methodField = new DropDownChoice<>("methodField", new PropertyModel<>(this, "method"), new PropertyModel<>(this, "methods"));
        this.methodField.setOutputMarkupId(true);
        this.methodField.setRequired(true);
        this.methodField.add(new OnChangeAjaxBehavior(this::methodFieldAjaxUpdate));
        this.form.add(this.methodField);
        this.methodFeedback = new TextFeedbackPanel("methodFeedback", this.methodField);
        this.form.add(this.methodFeedback);
{'fraction_non_alphanumeric': 0.08033944008248077, 'fraction_numerical': 0.0034895709413910697, 'mean_word_length': 5.986149584487535, 'pattern_counts': {'":': 0, '<': 116, '<?xml version=': 0, '>': 116, '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': '4744294', 'n_tokens_mistral': 3465, 'n_tokens_neox': 3425, 'n_words': 643}