Search in sources :

Example 1 with ClientUc

use of gov.ca.cwds.data.persistence.cms.ClientUc in project API by ca-cwds.

the class ClientUcService method update.

/**
   * {@inheritDoc}
   * 
   * @see gov.ca.cwds.rest.services.CrudsService#update(java.io.Serializable,
   *      gov.ca.cwds.rest.api.Request)
   */
@Override
public gov.ca.cwds.rest.api.domain.cms.ClientUc update(Serializable primaryKey, Request request) {
    assert request instanceof gov.ca.cwds.rest.api.domain.cms.ClientUc;
    gov.ca.cwds.rest.api.domain.cms.ClientUc clientUc = (gov.ca.cwds.rest.api.domain.cms.ClientUc) request;
    try {
        String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
        ClientUc managed = new ClientUc(clientUc, lastUpdatedId);
        managed = clientucDao.update(managed);
        return new gov.ca.cwds.rest.api.domain.cms.ClientUc(managed);
    } catch (EntityNotFoundException e) {
        LOGGER.info("Client not found : {}", clientUc);
        throw new ServiceException(e);
    }
}
Also used : ServiceException(gov.ca.cwds.rest.services.ServiceException) ClientUc(gov.ca.cwds.data.persistence.cms.ClientUc) EntityNotFoundException(javax.persistence.EntityNotFoundException)

Example 2 with ClientUc

use of gov.ca.cwds.data.persistence.cms.ClientUc in project API by ca-cwds.

the class ClientUcDaoIT method testDeleteEntityNotFoundException.

@Override
@Test
public void testDeleteEntityNotFoundException() throws Exception {
    ClientUc deleted = clientUcDao.delete("9999999ZZZ");
    assertThat(deleted, is(nullValue()));
}
Also used : ClientUc(gov.ca.cwds.data.persistence.cms.ClientUc) Test(org.junit.Test)

Example 3 with ClientUc

use of gov.ca.cwds.data.persistence.cms.ClientUc in project API by ca-cwds.

the class ClientUcDaoIT method testCreateExistingEntityException.

@Override
@Test
public void testCreateExistingEntityException() throws Exception {
    thrown.expect(EntityExistsException.class);
    gov.ca.cwds.rest.api.domain.cms.ClientUc vcluc = validDomainClientUc();
    ClientUc clientUc = new ClientUc(id, vcluc.getSourceTableCode(), vcluc.getCommonFirstName(), vcluc.getCommonLastName(), vcluc.getCommonMiddleName());
    clientUcDao.create(clientUc);
}
Also used : ClientUc(gov.ca.cwds.data.persistence.cms.ClientUc) Test(org.junit.Test)

Example 4 with ClientUc

use of gov.ca.cwds.data.persistence.cms.ClientUc in project API by ca-cwds.

the class ClientUcDaoIT method testUpdate.

@Override
@Test
public void testUpdate() throws Exception {
    gov.ca.cwds.rest.api.domain.cms.ClientUc vcluc = validDomainClientUc();
    ClientUc clientUc = new ClientUc(id, vcluc.getSourceTableCode(), vcluc.getCommonFirstName(), vcluc.getCommonLastName(), vcluc.getCommonMiddleName());
    ClientUc updated = clientUcDao.update(clientUc);
    assertThat(clientUc, is(updated));
}
Also used : ClientUc(gov.ca.cwds.data.persistence.cms.ClientUc) Test(org.junit.Test)

Example 5 with ClientUc

use of gov.ca.cwds.data.persistence.cms.ClientUc in project API by ca-cwds.

the class ClientUcDaoIT method testFind.

@Override
@Test
public void testFind() throws Exception {
    ClientUc found = clientUcDao.find(id);
    assertThat(found.getPktableId(), is(equalTo(id)));
}
Also used : ClientUc(gov.ca.cwds.data.persistence.cms.ClientUc) Test(org.junit.Test)

Aggregations

ClientUc (gov.ca.cwds.data.persistence.cms.ClientUc)10 Test (org.junit.Test)8 ServiceException (gov.ca.cwds.rest.services.ServiceException)2 EntityExistsException (javax.persistence.EntityExistsException)1 EntityNotFoundException (javax.persistence.EntityNotFoundException)1