use of gov.ca.cwds.data.persistence.cms.ChildClient in project API by ca-cwds.
the class ChildClientService method create.
/**
* {@inheritDoc}
*
* @see gov.ca.cwds.rest.services.CrudsService#create(gov.ca.cwds.rest.api.Request)
*/
@Override
public gov.ca.cwds.rest.api.domain.cms.ChildClient create(Request request) {
assert request instanceof gov.ca.cwds.rest.api.domain.cms.ChildClient;
gov.ca.cwds.rest.api.domain.cms.ChildClient childClient = (gov.ca.cwds.rest.api.domain.cms.ChildClient) request;
if (childClient.getVictimClientId() == null) {
LOGGER.info("ChildClient cannot be created with null or empty VictimClientId");
throw new ServiceException("ChildClient cannot be created with null or empty VictimClientId");
}
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
ChildClient managed = new ChildClient(childClient.getVictimClientId(), childClient, lastUpdatedId);
managed = childClientDao.create(managed);
return new gov.ca.cwds.rest.api.domain.cms.ChildClient(managed);
} catch (EntityExistsException e) {
LOGGER.info("ChildClient already exists : {}", childClient);
throw new ServiceException("ChildClient already exists : {}" + childClient, e);
}
}
use of gov.ca.cwds.data.persistence.cms.ChildClient in project API by ca-cwds.
the class ChildClientService 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.ChildClient update(Serializable primaryKey, Request request) {
assert request instanceof gov.ca.cwds.rest.api.domain.cms.ChildClient;
gov.ca.cwds.rest.api.domain.cms.ChildClient childClient = (gov.ca.cwds.rest.api.domain.cms.ChildClient) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
ChildClient managed = new ChildClient(childClient.getVictimClientId(), childClient, lastUpdatedId);
managed = childClientDao.update(managed);
return new gov.ca.cwds.rest.api.domain.cms.ChildClient(managed);
} catch (EntityNotFoundException e) {
LOGGER.info("childClient not found : {}", childClient);
throw new ServiceException(e);
}
}
use of gov.ca.cwds.data.persistence.cms.ChildClient in project API by ca-cwds.
the class ChildClientDaoIT method testFind.
/**
* Find JUnit test
*/
@Override
@Test
public void testFind() throws Exception {
ChildClient found = childClientDao.find(victimId);
assertThat(found.getVictimClientId(), is(equalTo(victimId)));
}
use of gov.ca.cwds.data.persistence.cms.ChildClient in project API by ca-cwds.
the class ChildClientDaoIT method testCreateExistingEntityException.
@Override
@Test
public void testCreateExistingEntityException() throws Exception {
thrown.expect(EntityExistsException.class);
ChildClient vchc = validChildClient();
ChildClient pers = new ChildClient("AazXkWY06s", vchc.getAdoptableCode(), vchc.getAdoptedAge(), vchc.getAfdcFcEligibilityIndicatorVar(), vchc.getAllEducationInfoOnFileIndicator(), vchc.getAllHealthInfoOnFileIndicator(), vchc.getAttemptToAcquireEducInfoDesc(), vchc.getAttemptToAcquireHlthInfoDesc(), vchc.getAwolAbductedCode(), vchc.getBirthHistoryIndicatorVar(), vchc.getChildIndianAncestryIndicator(), vchc.getCollegeIndicator(), vchc.getCurrentCaseId(), vchc.getDeathCircumstancesType(), vchc.getDisabilityDiagnosedCode(), vchc.getDrmsHePassportDocOld(), vchc.getDrmsHealthEducPassportDoc(), vchc.getDrmsVoluntaryPlcmntAgrmntDoc(), vchc.getFc2EligApplicationIndicatorVar(), vchc.getFoodStampsApplicationDate(), vchc.getFoodStampsApplicationIndicator(), vchc.getIcwaEligibilityCode(), vchc.getIntercountryAdoptDisruptedIndicator(), vchc.getIntercountryAdoptDissolvedIndicator(), vchc.getMedEligibilityApplicationIndicatorVar(), vchc.getMinorNmdParentIndicator(), vchc.getParentalRightsLimitedIndicator(), vchc.getParentalRightsTermintnIndicatorVar(), vchc.getPaternityIndividualIndicatorVar(), vchc.getPostsecVocIndicator(), vchc.getPreviouslyAdoptedCode(), vchc.getSafelySurrendedBabiesIndicatorVar(), vchc.getSaw1EligApplicationIndicatorVar(), vchc.getSawsCaseSerialNumber(), vchc.getSijsScheduledInterviewDate(), vchc.getSiiNextScreeningDueDate(), vchc.getSsiSspApplicationIndicator(), vchc.getTribalAncestryNotifctnIndicatorVar(), vchc.getTribalCustomaryAdoptionDate(), vchc.getTribalCustomaryAdoptionIndicator());
childClientDao.create(pers);
}
use of gov.ca.cwds.data.persistence.cms.ChildClient in project API by ca-cwds.
the class ChildClientDaoIT method testUpdate.
@Override
@Test
public void testUpdate() throws Exception {
ChildClient vchc = validChildClient();
ChildClient pers = new ChildClient("AazXkWY06s", vchc.getAdoptableCode(), vchc.getAdoptedAge(), vchc.getAfdcFcEligibilityIndicatorVar(), vchc.getAllEducationInfoOnFileIndicator(), vchc.getAllHealthInfoOnFileIndicator(), vchc.getAttemptToAcquireEducInfoDesc(), vchc.getAttemptToAcquireHlthInfoDesc(), vchc.getAwolAbductedCode(), vchc.getBirthHistoryIndicatorVar(), vchc.getChildIndianAncestryIndicator(), vchc.getCollegeIndicator(), vchc.getCurrentCaseId(), vchc.getDeathCircumstancesType(), vchc.getDisabilityDiagnosedCode(), vchc.getDrmsHePassportDocOld(), vchc.getDrmsHealthEducPassportDoc(), vchc.getDrmsVoluntaryPlcmntAgrmntDoc(), vchc.getFc2EligApplicationIndicatorVar(), vchc.getFoodStampsApplicationDate(), vchc.getFoodStampsApplicationIndicator(), vchc.getIcwaEligibilityCode(), vchc.getIntercountryAdoptDisruptedIndicator(), vchc.getIntercountryAdoptDissolvedIndicator(), vchc.getMedEligibilityApplicationIndicatorVar(), vchc.getMinorNmdParentIndicator(), vchc.getParentalRightsLimitedIndicator(), vchc.getParentalRightsTermintnIndicatorVar(), vchc.getPaternityIndividualIndicatorVar(), vchc.getPostsecVocIndicator(), vchc.getPreviouslyAdoptedCode(), vchc.getSafelySurrendedBabiesIndicatorVar(), vchc.getSaw1EligApplicationIndicatorVar(), vchc.getSawsCaseSerialNumber(), vchc.getSijsScheduledInterviewDate(), vchc.getSiiNextScreeningDueDate(), vchc.getSsiSspApplicationIndicator(), vchc.getTribalAncestryNotifctnIndicatorVar(), vchc.getTribalCustomaryAdoptionDate(), vchc.getTribalCustomaryAdoptionIndicator());
ChildClient updated = childClientDao.update(pers);
assertThat(updated, is(pers));
}
Aggregations