use of javax.persistence.EntityNotFoundException in project API by ca-cwds.
the class ReferralClientService method update.
@Override
public gov.ca.cwds.rest.api.domain.cms.ReferralClient update(Serializable primaryKeyObject, 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 {
ReferralClient managed = new ReferralClient(referralClient, "BTr");
// 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 (EntityNotFoundException e) {
LOGGER.info("Referral not found : {}", referralClient);
LOGGER.error(e.getMessage(), e);
throw new ServiceException(e);
}
}
use of javax.persistence.EntityNotFoundException in project API by ca-cwds.
the class ReporterService 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.Reporter update(Serializable primaryKey, Request request) {
assert primaryKey instanceof String;
assert request instanceof gov.ca.cwds.rest.api.domain.cms.Reporter;
gov.ca.cwds.rest.api.domain.cms.Reporter reporter = (gov.ca.cwds.rest.api.domain.cms.Reporter) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
Reporter managed = new Reporter(reporter, lastUpdatedId);
managed = reporterDao.update(managed);
return new gov.ca.cwds.rest.api.domain.cms.Reporter(managed);
} catch (EntityNotFoundException e) {
LOGGER.info("Reporter not found : {}", reporter);
throw new ServiceException(e);
}
}
use of javax.persistence.EntityNotFoundException 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);
}
}
use of javax.persistence.EntityNotFoundException 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 javax.persistence.EntityNotFoundException in project API by ca-cwds.
the class ClientAddressService method update.
@Override
public Response update(Serializable primaryKey, Request request) {
assert primaryKey instanceof String;
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 {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
ClientAddress managed = new ClientAddress((String) primaryKey, clientAddress, lastUpdatedId);
// checking the staffPerson county code
StaffPerson staffperson = staffpersonDao.find(managed.getLastUpdatedId());
if (staffperson != null && (triggerTablesDao.getLaCountySpecificCode().equals(staffperson.getCountyCode()))) {
laCountyTrigger.createClientAddressCountyTrigger(managed);
}
managed = clientAddressDao.update(managed);
return new gov.ca.cwds.rest.api.domain.cms.ClientAddress(managed, true);
} catch (EntityNotFoundException e) {
LOGGER.info("ClientAddress not found : {}", clientAddress);
throw new ServiceException(e);
}
}
Aggregations