use of gov.ca.cwds.data.persistence.cms.ClientAddress 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);
}
}
Aggregations