//Entities
QuotationProperties qp = null;
QUser quser = null;
Customer customer = null;
Company company = null;
Quotation quotation =null;
EntityManager em = this.emf.createEntityManager();
em.getTransaction().begin();
try {
qp = this.quotationPropertiesFactory();
} catch (IOException | MaxFileSizeException e) {
Assert.fail(e.getMessage());
}
em.persist(qp);
for(int i=0;i<QUSERS;i++){//Usuarios que generarán cotizaciones
quser = podamf.manufacturePojo(QUser.class);
em.persist(quser);
for(int j=0;j<CUSTOMERS;j++){ //información de a quien va dirigida la cotización
customer = podamf.manufacturePojo(Customer.class);
company = podamf.manufacturePojo(Company.class);
em.persist(customer);
em.persist(company);
for(int k=0;k<QUOTATIONS;k++){ //construcción cotización------------
quotation = podamf.manufacturePojo(Quotation.class);
quotation.setUser(quser);
quotation.setCustomer(customer);
quotation.setCompany(company);
quotation.setQuotationProperties(qp);
List<Item> itemList = new ArrayList<Item>();
for(int l=0;l<ITEMS;l++){ //item de la cotización
Item item = podamf.manufacturePojo(Item.class);
em.persist(item);
itemList.add(item);
}
quotation.setItems(itemList);
em.persist(quotation);
}
}
}