@Test public void testsaveDrugPurchaseOrder() { DrugPurchaseOrder dpOrder = new DrugPurchaseOrder(); Provider provider = new Provider(1); provider.setDateCreated(new Date()); Location location = new Location(1); location.setDateCreated(new Date()); dpOrder.setName("TestList4"); dpOrder.setDescription("Third Test List"); dpOrder.setCreator(Context.getUserContext().getAuthenticatedUser()); dpOrder.setDateCreated(new java.util.Date()); dpOrder.setDrugPurchaseOrderDate(new Date()); dpOrder.setUuid("68547121-1b70-465c-99ee-c9dfd95e7d30"); dpOrder.setRetired(Boolean.FALSE); dpOrder.setProviderId(new Integer(3)); dpOrder.setDispenseLocationId(1); dpOrder.setStockLocationId(2); dpOrder.setProvider(provider); dpOrder.setDispenseLocation(Context.getLocationService().getLocation(1)); dpOrder.setStockLocation(Context.getLocationService().getLocation(2)); dao.saveDrugPurchaseOrder(dpOrder); DrugPurchaseOrder result = dao.getDrugPurchaseOrderByUuid("68547121-1b70-465c-99ee-c9dfd95e7d30"); String uuid = result.getUuid(); assertEquals(uuid, "68547121-1b70-465c-99ee-c9dfd95e7d30"); }
public DrugPurchaseOrder saveDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder) { sessionFactory.getCurrentSession().saveOrUpdate(drugPurchaseOrder); return drugPurchaseOrder; }
HibernateDrugPurchaseOrderDAO implements DrugPurchaseOrderDAO { public DrugPurchaseOrder saveDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder) { sessionFactory.getCurrentSession().saveOrUpdate(drugPurchaseOrder); return drugPurchaseOrder; } }
HibernateDrugPurchaseOrderDAO implements DrugPurchaseOrderDAO { public DrugPurchaseOrder saveDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder) { sessionFactory.getCurrentSession().saveOrUpdate(drugPurchaseOrder); return drugPurchaseOrder; }  }
HibernateDrugPurchaseOrderDAO implements DrugPurchaseOrderDAO { public DrugPurchaseOrder saveDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder) { sessionFactory.getCurrentSession().saveOrUpdate(drugPurchaseOrder); return drugPurchaseOrder; }  void setSessionFactory(SessionFactory sessionFactory); DrugPurchaseOrder saveDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder); DrugPurchaseOrder getDrugPurchaseOrderByUuid(String uuid); List<DrugPurchaseOrder> getAllDrugPurchaseOrders(); List<DrugPurchaseOrder> getAllDrugPurchaseOrdersNotReceived(); DrugPurchaseOrder updateDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder); void deleteDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder); List<DrugPurchaseOrder> getDrugPurchaseOrderByProvider(Integer providerId); @Override List<DrugPurchaseOrder> getDrugPurchaseOrderByDispenseLocation(Integer dispenseLocation); @Override List<DrugPurchaseOrder> getDrugPurchaseOrderByStockLocation(Integer stockLocation); }
HibernateDrugPurchaseOrderDAO implements DrugPurchaseOrderDAO { public DrugPurchaseOrder saveDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder) { sessionFactory.getCurrentSession().saveOrUpdate(drugPurchaseOrder); return drugPurchaseOrder; }  void setSessionFactory(SessionFactory sessionFactory); DrugPurchaseOrder saveDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder); DrugPurchaseOrder getDrugPurchaseOrderByUuid(String uuid); List<DrugPurchaseOrder> getAllDrugPurchaseOrders(); List<DrugPurchaseOrder> getAllDrugPurchaseOrdersNotReceived(); DrugPurchaseOrder updateDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder); void deleteDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder); List<DrugPurchaseOrder> getDrugPurchaseOrderByProvider(Integer providerId); @Override List<DrugPurchaseOrder> getDrugPurchaseOrderByDispenseLocation(Integer dispenseLocation); @Override List<DrugPurchaseOrder> getDrugPurchaseOrderByStockLocation(Integer stockLocation);  }