use of gov.ca.cwds.data.persistence.cms.StaffPerson in project API by ca-cwds.
the class StaffPersonDaoIT method testUpdateEntityNotFoundException.
@Override
@Test
public void testUpdateEntityNotFoundException() throws Exception {
thrown.expect(EntityNotFoundException.class);
StaffPerson staffPerson = new StaffPerson("q1q", null, "External Interface", "external interface", "SCXCIN7", " ", "", BigDecimal.valueOf(9165672100L), 0, null, " ", "N", "MIZN02k00E", " ", " ", "99", "N", "3XPCP92q38", null);
staffPersonDao.update(staffPerson);
}
use of gov.ca.cwds.data.persistence.cms.StaffPerson in project API by ca-cwds.
the class StaffPersonDaoIT method testCreate.
@Override
@Test
public void testCreate() throws Exception {
StaffPerson staffPerson = new StaffPerson("q1k", null, "External Interface", "external interface", "SCXCIN7", " ", "", BigDecimal.valueOf(9165672100L), 0, null, " ", "N", "MIZN02k00E", " ", " ", "99", "N", "3XPCP92q38", null);
StaffPerson created = staffPersonDao.create(staffPerson);
assertThat(created, is(staffPerson));
}
use of gov.ca.cwds.data.persistence.cms.StaffPerson in project API by ca-cwds.
the class StaffPersonDaoIT method testFind.
@Override
@Test
public void testFind() throws Exception {
String id = "q1p";
StaffPerson found = staffPersonDao.find(id);
assertThat(found.getId(), is(id));
}
use of gov.ca.cwds.data.persistence.cms.StaffPerson in project API by ca-cwds.
the class ClientAddressService method create.
@Override
public Response create(Request request) {
assert request instanceof gov.ca.cwds.rest.api.domain.cms.ClientAddress;
gov.ca.cwds.rest.api.domain.cms.ClientAddress clientAddress = (gov.ca.cwds.rest.api.domain.cms.ClientAddress) request;
try {
ClientAddress managedClientAddress = new ClientAddress(IdGenerator.randomString(10), clientAddress, "BTr");
// checking the staffPerson county code
StaffPerson staffperson = staffpersonDao.find(managedClientAddress.getLastUpdatedId());
if (staffperson != null && (triggerTablesDao.getLaCountySpecificCode().equals(staffperson.getCountyCode()))) {
laCountyTrigger.createClientAddressCountyTrigger(managedClientAddress);
}
managedClientAddress = clientAddressDao.create(managedClientAddress);
return new gov.ca.cwds.rest.api.domain.cms.ClientAddress(managedClientAddress, false);
} catch (EntityExistsException e) {
LOGGER.info("ClientAddress already exists : {}", clientAddress);
throw new ServiceException(e);
}
}
use of gov.ca.cwds.data.persistence.cms.StaffPerson in project API by ca-cwds.
the class ReferralClientService method create.
@Override
public gov.ca.cwds.rest.api.domain.cms.ReferralClient create(Request request) {
assert request instanceof gov.ca.cwds.rest.api.domain.cms.ReferralClient;
gov.ca.cwds.rest.api.domain.cms.ReferralClient referralClient = (gov.ca.cwds.rest.api.domain.cms.ReferralClient) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
ReferralClient managed = new ReferralClient(referralClient, lastUpdatedId);
managed = referralClientDao.create(managed);
// checking the staffPerson county code
StaffPerson staffperson = staffpersonDao.find(managed.getLastUpdatedId());
if (staffperson != null && (triggerTablesDao.getLaCountySpecificCode().equals(staffperson.getCountyCode()))) {
laCountyTrigger.createCountyTrigger(managed);
} else {
nonLaTriggers.createAndUpdateReferralClientCoutyOwnership(managed);
}
return new gov.ca.cwds.rest.api.domain.cms.ReferralClient(managed);
} catch (EntityExistsException e) {
LOGGER.info("Referral Client already exists : {}", referralClient);
throw new ServiceException(e);
}
}
Aggregations