use of gov.ca.cwds.data.legacy.cms.entity.DeliveredService in project api-core by ca-cwds.
the class DeliveredServiceDao method findByClientId.
public List<DeliveredService> findByClientId(String clientId) {
Session session = this.getSessionFactory().getCurrentSession();
Query<DeliveredService> query = session.createNamedQuery(DeliveredService.FIND_BY_CLIENT, DeliveredService.class);
query.setParameter("clientId", clientId);
return query.list();
}
use of gov.ca.cwds.data.legacy.cms.entity.DeliveredService in project api-core by ca-cwds.
the class DeliveredServiceDaoTest method testFindByChildClientId.
@Test
public void testFindByChildClientId() throws Exception {
cleanAllAndInsert("/dbunit/Client/update/DeliveredService.xml");
executeInTransaction(sessionFactory, sessionFactory1 -> {
Client client = clientDao.find(CLIENT_ID);
assertNotNull(client);
assertEquals(CLIENT_ID, client.getIdentifier());
});
executeInTransaction(sessionFactory, sessionFactory1 -> {
List<DeliveredService> deliveredService = deliveredServiceDao.findByClientId(CLIENT_ID);
assertNotNull(deliveredService);
assertEquals(1, deliveredService.size());
assertEquals(CLIENT_ID, deliveredService.get(0).getIndividualId());
});
}
use of gov.ca.cwds.data.legacy.cms.entity.DeliveredService in project api-core by ca-cwds.
the class DeliveredServiceDaoTest method testFindByWrongChildClientId.
@Test
public void testFindByWrongChildClientId() throws Exception {
cleanAllAndInsert("/dbunit/Client/update/DeliveredService.xml");
executeInTransaction(sessionFactory, sessionFactory1 -> {
Client childClient = clientDao.find(WRONG_CLIENT_ID);
assertNull(childClient);
});
executeInTransaction(sessionFactory, sessionFactory1 -> {
List<DeliveredService> deliveredService = deliveredServiceDao.findByClientId(WRONG_CLIENT_ID);
assertEquals(0, deliveredService.size());
});
}
use of gov.ca.cwds.data.legacy.cms.entity.DeliveredService in project api-core by ca-cwds.
the class R00612Test method getDeliveredService.
private DeliveredService getDeliveredService(LocalDate startDate, String clientId, IndividualType individualType) {
DeliveredService deliveredService = new DeliveredService();
deliveredService.setIndividualType(individualType);
deliveredService.setIndividualId(clientId);
deliveredService.setStartDate(startDate);
return deliveredService;
}
Aggregations