<commit_before>package com.chequer.axboot.core.model.extract.template;

import com.chequer.axboot.core.model.extract.metadata.Column;
import com.chequer.axboot.core.model.extract.metadata.HibernateField;
import com.chequer.axboot.core.model.extract.metadata.Table;
import com.chequer.axboot.core.model.extract.template.fields.EntityFields;
import com.chequer.axboot.core.model.extract.template.fields.GoEntityFields;
import com.chequer.axboot.core.model.extract.template.fields.KeyFields;
import com.chequer.axboot.core.model.extract.template.fields.VOFields;
import com.chequer.axboot.core.utils.ArrayUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class TemplateBuilder {

    private static final String TAB = "	";
    private static final String TAB_2 = "		";
    private static final String NEW_LINE = System.getProperty("line.separator");

    public static class EntityTemplateBuilder {

        public static EntityFields build(Table table) {
            EntityFields entityFields = new EntityFields();

            StringBuilder code = new StringBuilder();
            List<String> importList = new ArrayList<>();
            List<String> annotations = new ArrayList<>();

            int index = 1;

            for (Column column : table.getColumns()) {
                if (!column.skip()) {
                    HibernateField hibernateField = column.hibernateField();

                    if (ArrayUtils.isNotEmpty(hibernateField.getEntityClassImportList())) {
                        for (String importPackage : hibernateField.getEntityClassImportList()) {
                            String importPackageText = String.format("import %s;", importPackage);
                            if (!importList.contains(importPackageText)) {
                                importList.add(importPackageText);
                            }
                        }
                    }

                    if (ArrayUtils.isNotEmpty(hibernateField.getEntityClassAnnotationList())) {
                        for (String annotation : hibernateField.getEntityClassAnnotationList()) {
                            String annotationText = annotation;
                            if (!annotations.contains(annotationText)) {
                                annotations.add(annotationText);
                            }
                        }
                    }

                    if (column.isKey()) {
                        code.append(NEW_LINE);
                        code.append(TAB + "@Id");
                    }

                    code.append(NEW_LINE);
                    code.append(TAB + hibernateField.getFieldAnnotation());
                    code.append(NEW_LINE);
                    code.append(TAB + String.format("@Comment(value = \"%s\")", column.getRemarks()));

                    if ("YES".equals(column.getIsAutoincrement())) {
                        code.append(NEW_LINE);
                        code.append(TAB + "@GeneratedValue(strategy = GenerationType.IDENTITY)");
                    }

                    //code.append(NEW_LINE);
                    //code.append(TAB + "@ColumnPosition(" + (index++) + ")");
                    //code.append(NEW_LINE);
                    code.append(TAB + String.format("private %s %s;", hibernateField.getJavaType(), hibernateField.getFieldName()));

                    code.append(NEW_LINE);
                }
            }

            entityFields.setCode(code.toString());
            entityFields.setImportPackages(importList.stream().map(String::toString).collect(Collectors.joining(NEW_LINE)));

            if (annotations.size() > 0) {
                entityFields.setAnnotations(NEW_LINE + annotations.stream().map(String::toString).collect(Collectors.joining(NEW_LINE)));
            } else {
                entityFields.setAnnotations("");
            }

            return entityFields;
        }
    }
<commit_msg>Column Position Remove<commit_after>package com.chequer.axboot.core.model.extract.template;

import com.chequer.axboot.core.model.extract.metadata.Column;
import com.chequer.axboot.core.model.extract.metadata.HibernateField;
import com.chequer.axboot.core.model.extract.metadata.Table;
import com.chequer.axboot.core.model.extract.template.fields.EntityFields;
import com.chequer.axboot.core.model.extract.template.fields.GoEntityFields;
import com.chequer.axboot.core.model.extract.template.fields.KeyFields;
import com.chequer.axboot.core.model.extract.template.fields.VOFields;
import com.chequer.axboot.core.utils.ArrayUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class TemplateBuilder {

    private static final String TAB = "	";
    private static final String TAB_2 = "		";
    private static final String NEW_LINE = System.getProperty("line.separator");

    public static class EntityTemplateBuilder {

        public static EntityFields build(Table table) {
            EntityFields entityFields = new EntityFields();

            StringBuilder code = new StringBuilder();
            List<String> importList = new ArrayList<>();
            List<String> annotations = new ArrayList<>();

            int index = 1;

            for (Column column : table.getColumns()) {
                if (!column.skip()) {
                    HibernateField hibernateField = column.hibernateField();

                    if (ArrayUtils.isNotEmpty(hibernateField.getEntityClassImportList())) {
                        for (String importPackage : hibernateField.getEntityClassImportList()) {
                            String importPackageText = String.format("import %s;", importPackage);
                            if (!importList.contains(importPackageText)) {
                                importList.add(importPackageText);
                            }
                        }
                    }

                    if (ArrayUtils.isNotEmpty(hibernateField.getEntityClassAnnotationList())) {
                        for (String annotation : hibernateField.getEntityClassAnnotationList()) {
                            String annotationText = annotation;
                            if (!annotations.contains(annotationText)) {
                                annotations.add(annotationText);
                            }
                        }
                    }

                    if (column.isKey()) {
                        code.append(NEW_LINE);
                        code.append(TAB + "@Id");
                    }

                    code.append(NEW_LINE);
                    code.append(TAB + hibernateField.getFieldAnnotation());
                    code.append(NEW_LINE);
                    code.append(TAB + String.format("@Comment(value = \"%s\")", column.getRemarks()));

                    if ("YES".equals(column.getIsAutoincrement())) {
                        code.append(NEW_LINE);
                        code.append(TAB + "@GeneratedValue(strategy = GenerationType.IDENTITY)");
                    }

                    //code.append(NEW_LINE);
                    //code.append(TAB + "@ColumnPosition(" + (index++) + ")");
                    code.append(NEW_LINE);
                    code.append(TAB + String.format("private %s %s;", hibernateField.getJavaType(), hibernateField.getFieldName()));

                    code.append(NEW_LINE);
                }
            }

            entityFields.setCode(code.toString());
            entityFields.setImportPackages(importList.stream().map(String::toString).collect(Collectors.joining(NEW_LINE)));

            if (annotations.size() > 0) {
                entityFields.setAnnotations(NEW_LINE + annotations.stream().map(String::toString).collect(Collectors.joining(NEW_LINE)));
            } else {
                entityFields.setAnnotations("");
            }

            return entityFields;
        }
    }

{'fraction_non_alphanumeric': 0.10855056038282332, 'fraction_numerical': 0.0007555723460521345, 'mean_word_length': 1.835415922884684, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '381539', 'n_tokens_mistral': 2012, 'n_tokens_neox': 1859, 'n_words': 298}