use of gov.ca.cwds.data.persistence.cms.CrossReport in project API by ca-cwds.
the class CrossReportService 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.CrossReport update(Serializable primaryKey, Request request) {
assert request instanceof gov.ca.cwds.rest.api.domain.cms.CrossReport;
gov.ca.cwds.rest.api.domain.cms.CrossReport crossReport = (gov.ca.cwds.rest.api.domain.cms.CrossReport) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
CrossReport managed = new CrossReport(crossReport.getThirdId(), crossReport, lastUpdatedId);
managed = crossReportDao.update(managed);
return new gov.ca.cwds.rest.api.domain.cms.CrossReport(managed);
} catch (EntityNotFoundException e) {
LOGGER.info("CrossReport not found : {}", crossReport);
throw new ServiceException(e);
}
}
use of gov.ca.cwds.data.persistence.cms.CrossReport in project API by ca-cwds.
the class CrossReportService 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.CrossReport create(Request request) {
assert request instanceof gov.ca.cwds.rest.api.domain.cms.CrossReport;
gov.ca.cwds.rest.api.domain.cms.CrossReport crossReport = (gov.ca.cwds.rest.api.domain.cms.CrossReport) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
CrossReport managed = new CrossReport(CmsKeyIdGenerator.cmsIdGenertor(lastUpdatedId), crossReport, lastUpdatedId);
managed = crossReportDao.create(managed);
return new gov.ca.cwds.rest.api.domain.cms.CrossReport(managed);
} catch (EntityExistsException e) {
LOGGER.info("CrossReport already exists : {}", crossReport);
throw new ServiceException("CrossReport already exists : {}" + crossReport, e);
}
}
use of gov.ca.cwds.data.persistence.cms.CrossReport in project API by ca-cwds.
the class CrossReportDaoIT method testUpdateEntityNotFoundException.
@Override
@Test
public void testUpdateEntityNotFoundException() throws Exception {
thrown.expect(EntityNotFoundException.class);
CrossReport crossreport = new CrossReport("ZZ20cK10WS", "ZZDUfmj0WS", (short) 2094, "N", "N", null, " ", 0, BigDecimal.ZERO, null, " ", " ", "925q4As0AC", "0AC", " ", " ", " ", "34", "N", "N", "N");
crossreportDao.update(crossreport);
}
use of gov.ca.cwds.data.persistence.cms.CrossReport in project API by ca-cwds.
the class CrossReportDaoIT method testDelete.
@Override
@Test
public void testDelete() throws Exception {
String thirdId = "FsMh09h00J";
CrossReport delete = crossreportDao.delete(thirdId);
assertThat(delete.getThirdId(), is(thirdId));
}
use of gov.ca.cwds.data.persistence.cms.CrossReport in project API by ca-cwds.
the class CrossReportDaoIT method testUpdate.
@Override
@Test
public void testUpdate() throws Exception {
CrossReport crossreport = new CrossReport("Aj20cK10WS", "CVDUfmj0WS", (short) 2094, "N", "N", null, " ", 0, BigDecimal.ZERO, null, " ", " ", "925q4As0AC", "0AC", " ", " ", " ", "34", "N", "N", "N");
CrossReport updated = crossreportDao.update(crossreport);
assertThat(updated, is(crossreport));
}
Aggregations