protected static void populateVehiclesCompanies() {
   UnitOfWork uow = acquireUnitOfWork();
   uow.registerNewObject(InheritanceModelExamples.companyExample1());
   uow.registerNewObject(InheritanceModelExamples.companyExample2());
   uow.registerNewObject(InheritanceModelExamples.companyExample3());
   uow.commit();
 }
コード例 #2
0
  /**
   * Call all of the example methods in this system to guarantee that all our objects are registered
   * in the population manager
   */
  public void buildExamples() {
    // First ensure that no previous examples are hanging around.
    PopulationManager.getDefaultManager().getRegisteredObjects().remove(Person.class);

    PopulationManager.getDefaultManager()
        .registerObject(Person.class, InheritanceModelExamples.personExample1(), "e1");
    Engineer engineer = InheritanceModelExamples.personExample2();
    PopulationManager.getDefaultManager().registerObject(Person.class, engineer, "e2");
    PopulationManager.getDefaultManager()
        .registerObject(Person.class, InheritanceModelExamples.personExample3(), "e3");
    PopulationManager.getDefaultManager()
        .registerObject(Person.class, InheritanceModelExamples.personExample4(), "e4");
    PopulationManager.getDefaultManager()
        .registerObject(Person.class, InheritanceModelExamples.personExample5(), "e5");
    PopulationManager.getDefaultManager()
        .registerObject(Person.class, InheritanceModelExamples.personExample6(), "e6");

    PopulationManager.getDefaultManager()
        .registerObject(AAA.class, InheritanceModelExamples.aaaExample1(), "a1");
    PopulationManager.getDefaultManager()
        .registerObject(AAA.class, InheritanceModelExamples.bbbExample1(), "b1");
    PopulationManager.getDefaultManager()
        .registerObject(AAA.class, InheritanceModelExamples.cccExample1(), "c1");
    PopulationManager.getDefaultManager()
        .registerObject(AAA.class, InheritanceModelExamples.cccExample1(), "c2");

    Company company = InheritanceModelExamples.companyExample1();
    engineer.setCompany(company);

    PopulationManager.getDefaultManager().registerObject(Company.class, company, "co1");
    PopulationManager.getDefaultManager()
        .registerObject(Company.class, InheritanceModelExamples.companyExample2(), "co2");
    PopulationManager.getDefaultManager()
        .registerObject(Company.class, InheritanceModelExamples.companyExample3(), "co3");

    PopulationManager.getDefaultManager()
        .registerObject(Computer.class, InheritanceModelExamples.laptopExample1(), "lap1");
    PopulationManager.getDefaultManager()
        .registerObject(Computer.class, InheritanceModelExamples.laptopExample2(), "lap2");
    PopulationManager.getDefaultManager()
        .registerObject(Computer.class, InheritanceModelExamples.desktopExample1(), "desk1");
    PopulationManager.getDefaultManager()
        .registerObject(Computer.class, InheritanceModelExamples.desktopExample2(), "desk2");
  }