company.setReceiveNewsLetter(false);
company.setReceiveNotifications(false);
company.setLastLoginOn(calendar.getTime());
companyDAO.put(company);
for (int j = 0; j < 2; j++) {
Publisher publisher = new Publisher();
publisher.setAccessLevel(AccessLevels.Publisher);
publisher.setLogin("publisher" + j + "@company" + i + ".com");
publisher.setService(AuthTypes.GOOGLE);
publisher.setUniqueId(publisher.getLogin() + "-" + publisher.getService());
publisher.setFirstname("Publisher");
publisher.setLastname(j + "-" + i);
publisher.setPhone("+212522" + (100000 + rand.nextInt(999999)));
publisher.setEmail("publisher" + j + "@company" + i + ".com");
ArrayList<Long> products = new ArrayList<Long>();
ArrayList<Long> slots = new ArrayList<Long>();
publisherDAO.put(publisher);
publisher.setCompanyId(company.getId());
for (int k = 0; k < 5; k++) {
Product product = new Product();
product.setName("Product" + k + "-" + j + "-" + i);
product.setSlogan("Slogan");
product.setText("Text");
product.setLink("Link");
productDAO.put(product);
product.setPublisherId(publisher.getId());
products.add(product.getId());
for (int n = 0; n < 10; n++) {
Resource resource = new Resource();
resource.setFilename("resource" + n + ".jpeg");
resource.setImageURL("https://lh3.googleusercontent.com/-hQtlZHxpmA0/SMv3w4UUqcI/AAAAAAAACAQ/nPEx0-f9L6Y/s912/DSC02207.JPG");
resource.setUUID((UUID.randomUUID().toString()));
resource.setProductId(product.getId());
resourceDAO.put(resource);
}
productDAO.put(product);
}
for (int n = 0; n < 5; n++) {
start = calendar.getTime();
calendar.add(Calendar.HOUR, 12);
end = calendar.getTime();
Slot slot = new Slot(1, 10, start, end, publisher.getId());
for (int p = 0; p < slot.getNbSlots(); p++) {
slot.getProductIds().add(products.get(rand.nextInt(products.size())));
}
slot.setStatus(rand.nextInt(1));
slotDAO.put(slot);
slot.setOwnerId(publisher.getId());
slots.add(slot.getId());
}
publisherDAO.put(publisher);
}
companyDAO.put(company);