Example #1
0
 private List<Company> createCompanies(Random r) {
   List<Company> result = new ArrayList<Company>();
   for (int i = 0; i < 50; i++) {
     Company com = new Company(String.valueOf(i), "Company " + (i + 1));
     com.setFocusedSectors(new ArrayList<Sector>());
     Set<Person> uniqueWorkers = new HashSet<Person>();
     for (int j = 0; j < r.nextInt(20); j++) {
       Person worker = persons.get(r.nextInt(persons.size()));
       worker.getCompanies().add(com);
       uniqueWorkers.add(worker);
     }
     com.setWorkers(new ArrayList<Person>(uniqueWorkers));
     result.add(com);
   }
   return result;
 }
Example #2
0
 private List<Sector> createSectors(Random r) {
   List<Sector> result = new ArrayList<Sector>();
   Sector root = new Sector(String.valueOf(0), null, "Root");
   result.add(root);
   for (int i = 1; i < 60; i++) {
     Sector sec =
         new Sector(
             String.valueOf(i), result.get(r.nextInt(result.size())).getId(), "Sector " + (i + 1));
     result.get(Integer.valueOf(sec.getParentId())).getSubSectors().add(sec);
     Set<Company> uniqueCompaniess = new HashSet<Company>();
     for (int j = 0; j < r.nextInt(20); j++) {
       Company com = companies.get(r.nextInt(companies.size()));
       com.getFocusedSectors().add(sec);
       uniqueCompaniess.add(com);
     }
     sec.setFocusedCompanies(new ArrayList<Company>(uniqueCompaniess));
     result.add(sec);
   }
   return result;
 }