use of gov.ca.cwds.data.persistence.cms.AllegationPerpetratorHistory in project API by ca-cwds.
the class AllegationPerpetratorHistoryDaoIT method testFindEntityNotFoundException.
@Override
@Test
public void testFindEntityNotFoundException() throws Exception {
AllegationPerpetratorHistory found = allegationPerpetratorHistoryDao.find("9999999ZZZ");
assertThat(found, is(nullValue()));
}
use of gov.ca.cwds.data.persistence.cms.AllegationPerpetratorHistory in project API by ca-cwds.
the class AllegationPerpetratorHistoryDaoIT method testDelete.
/**
* Delete JUnit test
*/
@Override
@Test
public void testDelete() throws Exception {
AllegationPerpetratorHistory deleted = allegationPerpetratorHistoryDao.delete(id);
assertThat(deleted.getId(), is(id));
}
use of gov.ca.cwds.data.persistence.cms.AllegationPerpetratorHistory in project API by ca-cwds.
the class AllegationPerpetratorHistoryService 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.AllegationPerpetratorHistory update(Serializable primaryKey, Request request) {
assert primaryKey instanceof String;
assert request instanceof gov.ca.cwds.rest.api.domain.cms.AllegationPerpetratorHistory;
gov.ca.cwds.rest.api.domain.cms.AllegationPerpetratorHistory allegationPerpetratorHistory = (gov.ca.cwds.rest.api.domain.cms.AllegationPerpetratorHistory) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
AllegationPerpetratorHistory managed = new AllegationPerpetratorHistory((String) primaryKey, allegationPerpetratorHistory, lastUpdatedId);
managed = allegationPerpetratorHistoryDao.update(managed);
return new gov.ca.cwds.rest.api.domain.cms.AllegationPerpetratorHistory(managed);
} catch (EntityNotFoundException e) {
LOGGER.info("AllegationPerpetratorHistory not found : {}", allegationPerpetratorHistory);
throw new ServiceException(e);
}
}
use of gov.ca.cwds.data.persistence.cms.AllegationPerpetratorHistory in project API by ca-cwds.
the class AllegationPerpetratorHistoryService method create.
/**
* {@inheritDoc}
*
* @see gov.ca.cwds.rest.services.CrudsService#create(gov.ca.cwds.rest.api.Request)
*/
@Override
public PostedAllegationPerpetratorHistory create(Request request) {
assert request instanceof gov.ca.cwds.rest.api.domain.cms.AllegationPerpetratorHistory;
gov.ca.cwds.rest.api.domain.cms.AllegationPerpetratorHistory allegationPerpetratorHistory = (gov.ca.cwds.rest.api.domain.cms.AllegationPerpetratorHistory) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
AllegationPerpetratorHistory managed = new AllegationPerpetratorHistory(CmsKeyIdGenerator.cmsIdGenertor(lastUpdatedId), allegationPerpetratorHistory, lastUpdatedId);
managed = allegationPerpetratorHistoryDao.create(managed);
return new PostedAllegationPerpetratorHistory(managed);
} catch (EntityExistsException e) {
LOGGER.info("AllegationPerpetratorHistory already exists : {}", allegationPerpetratorHistory);
throw new ServiceException(e);
}
}
use of gov.ca.cwds.data.persistence.cms.AllegationPerpetratorHistory in project API by ca-cwds.
the class AllegationPerpetratorHistoryDaoIT method testCreate.
/**
* Create JUnit test
*/
@Override
@Test
public void testCreate() throws Exception {
gov.ca.cwds.rest.api.domain.cms.AllegationPerpetratorHistory vdaph = validDomainAllegationPerpetratorHistory();
AllegationPerpetratorHistory allegationPerpetratorHistory = new AllegationPerpetratorHistory("1234567ABC", vdaph.getCountySpecificCode(), vdaph.getVictimClientId(), vdaph.getAllegationId(), DomainChef.uncookDateString(vdaph.getPerpetratorUpdateDate()));
AllegationPerpetratorHistory create = allegationPerpetratorHistoryDao.create(allegationPerpetratorHistory);
assertThat(allegationPerpetratorHistory, is(create));
}
Aggregations