use of javax.persistence.EntityNotFoundException in project API by ca-cwds.
the class ClientService 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.Client update(Serializable primaryKey, Request request) {
assert primaryKey instanceof String;
assert request instanceof gov.ca.cwds.rest.api.domain.cms.Client;
gov.ca.cwds.rest.api.domain.cms.Client client = (gov.ca.cwds.rest.api.domain.cms.Client) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
Client managed = new Client((String) primaryKey, client, lastUpdatedId);
managed = clientDao.update(managed);
return new gov.ca.cwds.rest.api.domain.cms.Client(managed, true);
} catch (EntityNotFoundException e) {
LOGGER.info("Client not found : {}", client);
throw new ServiceException(e);
}
}
use of javax.persistence.EntityNotFoundException in project API by ca-cwds.
the class ReferralService 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.Referral update(Serializable primaryKey, Request request) {
assert primaryKey instanceof String;
assert request instanceof gov.ca.cwds.rest.api.domain.cms.Referral;
gov.ca.cwds.rest.api.domain.cms.Referral referral = (gov.ca.cwds.rest.api.domain.cms.Referral) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
Referral managed = new Referral((String) primaryKey, referral, lastUpdatedId);
managed = referralDao.update(managed);
// checking the staffPerson county code
StaffPerson staffperson = staffpersonDao.find(managed.getLastUpdatedId());
if (staffperson != null && (triggerTablesDao.getLaCountySpecificCode().equals(staffperson.getCountyCode()))) {
laCountyTrigger.createCountyTrigger(managed);
}
return new gov.ca.cwds.rest.api.domain.cms.Referral(managed);
} catch (EntityNotFoundException e) {
final String msg = "Referral not found : " + referral;
LOGGER.error("Referral not found : {}", referral);
throw new ServiceException(msg, e);
}
}
use of javax.persistence.EntityNotFoundException in project API by ca-cwds.
the class StaffPersonService method update.
/**
* {@inheritDoc}
*
* @see gov.ca.cwds.rest.services.CrudsService#update(java.io.Serializable,
* gov.ca.cwds.rest.api.Request)
*/
@Override
public StaffPerson update(Serializable primaryKey, Request request) {
assert primaryKey instanceof String;
assert request instanceof gov.ca.cwds.rest.api.domain.cms.StaffPerson;
gov.ca.cwds.rest.api.domain.cms.StaffPerson staffPerson = (gov.ca.cwds.rest.api.domain.cms.StaffPerson) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
gov.ca.cwds.data.persistence.cms.StaffPerson managed = new gov.ca.cwds.data.persistence.cms.StaffPerson((String) primaryKey, staffPerson, lastUpdatedId);
managed = staffPersonDao.update(managed);
return new gov.ca.cwds.rest.api.domain.cms.StaffPerson(managed);
} catch (EntityNotFoundException e) {
LOGGER.info("StaffPerson not found : {}", staffPerson);
throw new ServiceException(e);
}
}
Aggregations