Search in sources :

Example 1 with DeliveredService

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();
}
Also used : DeliveredService(gov.ca.cwds.data.legacy.cms.entity.DeliveredService) Session(org.hibernate.Session)

Example 2 with DeliveredService

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());
    });
}
Also used : DeliveredService(gov.ca.cwds.data.legacy.cms.entity.DeliveredService) Client(gov.ca.cwds.data.legacy.cms.entity.Client) BaseCwsCmsInMemoryPersistenceTest(gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest) Test(org.junit.Test)

Example 3 with DeliveredService

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());
    });
}
Also used : DeliveredService(gov.ca.cwds.data.legacy.cms.entity.DeliveredService) Client(gov.ca.cwds.data.legacy.cms.entity.Client) BaseCwsCmsInMemoryPersistenceTest(gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest) Test(org.junit.Test)

Example 4 with DeliveredService

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;
}
Also used : DeliveredService(gov.ca.cwds.data.legacy.cms.entity.DeliveredService)

Aggregations

DeliveredService (gov.ca.cwds.data.legacy.cms.entity.DeliveredService)4 Client (gov.ca.cwds.data.legacy.cms.entity.Client)2 BaseCwsCmsInMemoryPersistenceTest (gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest)2 Test (org.junit.Test)2 Session (org.hibernate.Session)1