<commit_before>package org.slc.sli.test.xmlgen;

import java.io.File;
import java.io.PrintStream;

import org.slc.sli.test.edfi.entities.InterchangeAssessmentMetadata;
import org.slc.sli.test.edfi.entities.InterchangeEducationOrgCalendar;
import org.slc.sli.test.edfi.entities.InterchangeEducationOrganization;
import org.slc.sli.test.edfi.entities.InterchangeMasterSchedule;
import org.slc.sli.test.edfi.entities.InterchangeStaffAssociation;
import org.slc.sli.test.edfi.entities.InterchangeStudent;
import org.slc.sli.test.edfi.entities.InterchangeStudentAssessment;
import org.slc.sli.test.edfi.entities.InterchangeStudentAttendance;
import org.slc.sli.test.edfi.entities.InterchangeStudentCohort;
import org.slc.sli.test.edfi.entities.InterchangeStudentDiscipline;
import org.slc.sli.test.edfi.entities.InterchangeStudentEnrollment;
import org.slc.sli.test.edfi.entities.InterchangeStudentGrade;
import org.slc.sli.test.edfi.entities.InterchangeStudentParent;
import org.slc.sli.test.edfi.entities.InterchangeStudentProgram;
import org.slc.sli.test.edfi.entities.meta.relations.MetaRelations;
import org.slc.sli.test.generators.interchange.InterchangeAssessmentMetadataGenerator;
import org.slc.sli.test.generators.interchange.InterchangeEdOrgCalGenerator;
import org.slc.sli.test.generators.interchange.InterchangeEdOrgGenerator;
import org.slc.sli.test.generators.interchange.InterchangeMasterScheduleGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStaffAssociationGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentAssessmentGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentAttendanceGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentCohortGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentDisciplineGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentEnrollmentGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentGradeGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentParentGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentProgramGenerator;
import org.slc.sli.test.utils.DataUtils;
import org.slc.sli.test.utils.JaxbUtils;
import org.slc.sli.test.utils.ValidateSchema;

/**
 * Code to generate referentially correct interchanges that are built
 * as a depth-first walk of the dependency graph beginning with
 * StateEducationAgency.
 *
 * @author dduran
 *
 */
public class StateEdFiXmlGenerator {

    /**
     * used by interchange generators to determine which entity generator to invoke
     */
    public static String fidelityOfData = "low";

    /**
     * used to determine the output directory for generated interchange and control files
     */
    public static String rootOutputPath = "./data";

    /**
     * Currently generates:
     * - edOrg
     * - edOrgCalendar
     * - masterSchedule
     * - staffAssociation
     * - student
     * - studentEnrollment
     *
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {

        processProgramArguments(args);

        MetaRelations.construct();

        generateAndMarshalInterchanges();

        ValidateSchema.check(rootOutputPath);

    }

    private static void processProgramArguments(String[] args) {

        if (args.length > 0 && ("low".equals(args[0]) || "medium".equals(args[0]))) {
            fidelityOfData = args[0];
        }
        if (args.length > 1) {
            rootOutputPath = args[1];
        }
        System.out.println("will use " + fidelityOfData + " fidelity data generators.");

        if (new File(rootOutputPath).mkdirs()) {
            System.out.println("created directory: " + rootOutputPath);
        }
        System.out.println("root output path: " + rootOutputPath);
    }

    private static void generateAndMarshalInterchanges() throws Exception {

       edOrg();

       edOrgCalendar();

       masterSchedule();

       staffAssociation();

       studentEnrollment();

       studentProgram();

       studentCohort();

       studentDiscipline();

       studentAttendance();

       assessmentMetaData();

       studentAssessment();

       studentGrade();
       
       studentParent();

    }

    /**
     * Generate InterchangeEducationOrganization data and use Jaxb to output the XML file.
     *
     * @throws Exception
     */
    private static void edOrg() throws Exception {

        InterchangeEducationOrganization edOrg = InterchangeEdOrgGenerator.generate();

        String xmlFilePath = rootOutputPath + "/InterchangeEducationOrganization.xml";

        JaxbUtils.marshal(edOrg, new PrintStream(xmlFilePath));

        DataUtils.writeControlFile(rootOutputPath + "/MainControlFile.ctl", "EducationOrganization", xmlFilePath);
    }<commit_msg>changed order of Interchange Generation in Test Data<commit_after>package org.slc.sli.test.xmlgen;

import java.io.File;
import java.io.PrintStream;

import org.slc.sli.test.edfi.entities.InterchangeAssessmentMetadata;
import org.slc.sli.test.edfi.entities.InterchangeEducationOrgCalendar;
import org.slc.sli.test.edfi.entities.InterchangeEducationOrganization;
import org.slc.sli.test.edfi.entities.InterchangeMasterSchedule;
import org.slc.sli.test.edfi.entities.InterchangeStaffAssociation;
import org.slc.sli.test.edfi.entities.InterchangeStudent;
import org.slc.sli.test.edfi.entities.InterchangeStudentAssessment;
import org.slc.sli.test.edfi.entities.InterchangeStudentAttendance;
import org.slc.sli.test.edfi.entities.InterchangeStudentCohort;
import org.slc.sli.test.edfi.entities.InterchangeStudentDiscipline;
import org.slc.sli.test.edfi.entities.InterchangeStudentEnrollment;
import org.slc.sli.test.edfi.entities.InterchangeStudentGrade;
import org.slc.sli.test.edfi.entities.InterchangeStudentParent;
import org.slc.sli.test.edfi.entities.InterchangeStudentProgram;
import org.slc.sli.test.edfi.entities.meta.relations.MetaRelations;
import org.slc.sli.test.generators.interchange.InterchangeAssessmentMetadataGenerator;
import org.slc.sli.test.generators.interchange.InterchangeEdOrgCalGenerator;
import org.slc.sli.test.generators.interchange.InterchangeEdOrgGenerator;
import org.slc.sli.test.generators.interchange.InterchangeMasterScheduleGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStaffAssociationGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentAssessmentGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentAttendanceGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentCohortGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentDisciplineGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentEnrollmentGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentGradeGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentParentGenerator;
import org.slc.sli.test.generators.interchange.InterchangeStudentProgramGenerator;
import org.slc.sli.test.utils.DataUtils;
import org.slc.sli.test.utils.JaxbUtils;
import org.slc.sli.test.utils.ValidateSchema;

/**
 * Code to generate referentially correct interchanges that are built
 * as a depth-first walk of the dependency graph beginning with
 * StateEducationAgency.
 *
 * @author dduran
 *
 */
public class StateEdFiXmlGenerator {

    /**
     * used by interchange generators to determine which entity generator to invoke
     */
    public static String fidelityOfData = "low";

    /**
     * used to determine the output directory for generated interchange and control files
     */
    public static String rootOutputPath = "./data";

    /**
     * Currently generates:
     * - edOrg
     * - edOrgCalendar
     * - masterSchedule
     * - staffAssociation
     * - student
     * - studentEnrollment
     *
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {

        processProgramArguments(args);

        MetaRelations.construct();

        generateAndMarshalInterchanges();

        ValidateSchema.check(rootOutputPath);

    }

    private static void processProgramArguments(String[] args) {

        if (args.length > 0 && ("low".equals(args[0]) || "medium".equals(args[0]))) {
            fidelityOfData = args[0];
        }
        if (args.length > 1) {
            rootOutputPath = args[1];
        }
        System.out.println("will use " + fidelityOfData + " fidelity data generators.");

        if (new File(rootOutputPath).mkdirs()) {
            System.out.println("created directory: " + rootOutputPath);
        }
        System.out.println("root output path: " + rootOutputPath);
    }

    private static void generateAndMarshalInterchanges() throws Exception {

       edOrg();

       edOrgCalendar();

       masterSchedule();

       staffAssociation();
       
       studentParent();
       
       studentEnrollment();

       studentProgram();

       studentCohort();

       studentDiscipline();

       studentAttendance();

       assessmentMetaData();

       studentAssessment();

       studentGrade();
       
    }

    /**
     * Generate InterchangeEducationOrganization data and use Jaxb to output the XML file.
     *
     * @throws Exception
     */
    private static void edOrg() throws Exception {

        InterchangeEducationOrganization edOrg = InterchangeEdOrgGenerator.generate();

        String xmlFilePath = rootOutputPath + "/InterchangeEducationOrganization.xml";

        JaxbUtils.marshal(edOrg, new PrintStream(xmlFilePath));

        DataUtils.writeControlFile(rootOutputPath + "/MainControlFile.ctl", "EducationOrganization", xmlFilePath);
    }
{'fraction_non_alphanumeric': 0.09882494727327508, 'fraction_numerical': 0.0012051822838204278, 'mean_word_length': 3.9151036525172755, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '3317587', 'n_tokens_mistral': 2985, 'n_tokens_neox': 2863, 'n_words': 479}