use of gov.ca.cwds.data.persistence.ns.Address in project API by ca-cwds.
the class AddressDaoIT method testUpdate.
@Override
@Test
public void testUpdate() {
Address address = new Address(1L, "123 Main Street", "SAC", "CA", 95757, "Home");
Address updated = addressDao.update(address);
assertThat(updated, is(address));
}
use of gov.ca.cwds.data.persistence.ns.Address in project API by ca-cwds.
the class AddressDaoIT method testFind.
@Override
@Test
public void testFind() {
long id = 1;
Address found = addressDao.find(id);
assertThat(found.getId(), is(id));
}
use of gov.ca.cwds.data.persistence.ns.Address in project API by ca-cwds.
the class AddressDaoIT method testDeleteEntityNotFoundException.
@Override
@Test
public void testDeleteEntityNotFoundException() throws Exception {
Address updated = addressDao.delete((long) 99);
assertThat(updated, is(nullValue()));
}
use of gov.ca.cwds.data.persistence.ns.Address in project API by ca-cwds.
the class AddressDaoIT method testCreate.
@Override
@Test
public void testCreate() {
Address address = new Address(null, "123 Main Street", "SAC", "CA", 95757, "Home");
Address created = addressDao.create(address);
assertThat(created, is(address));
}
use of gov.ca.cwds.data.persistence.ns.Address in project API by ca-cwds.
the class ScreeningService method update.
/**
* {@inheritDoc}
*
* @see gov.ca.cwds.rest.services.CrudsService#update(java.io.Serializable,
* gov.ca.cwds.rest.api.Request)
*/
@Override
public ScreeningResponse update(Serializable primaryKey, Request request) {
assert primaryKey instanceof Long;
assert request instanceof ScreeningRequest;
ScreeningRequest screeningRequest = (ScreeningRequest) request;
Set<gov.ca.cwds.data.persistence.ns.Participant> participants = new HashSet<>();
Address address = new Address(screeningRequest.getAddress(), null, null);
gov.ca.cwds.data.persistence.ns.Screening screening = new gov.ca.cwds.data.persistence.ns.Screening((Long) primaryKey, screeningRequest, address, participants, null, null);
screening = screeningDao.update(screening);
if (screeningDao.getSessionFactory() != null) {
screeningDao.getSessionFactory().getCurrentSession().flush();
screeningDao.getSessionFactory().getCurrentSession().refresh(screening);
}
return new ScreeningResponse(screening, screening.getParticipants());
}
Aggregations