use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aFormService method submitApplication.
/**
* There is using XA Transaction
*/
private void submitApplication(Long formId, RFAApplicationStatus newStatus) throws NotSupportedException, SystemException, DroolsException {
RFA1aFormDTO expandedFormDTO = getExpandedFormDTO(formId);
performSubmissionValidation(expandedFormDTO);
// Start transaction here
UserTransaction userTransaction = new UserTransactionImp();
userTransaction.setTransactionTimeout(3600);
userTransaction.begin();
PlacementHome storedPlacementHome = null;
try {
storedPlacementHome = storePlaceMentHome(expandedFormDTO);
updateFormAfterPlacementHomeCreation(formId, storedPlacementHome.getIdentifier(), newStatus);
userTransaction.commit();
} catch (BusinessValidationException e) {
userTransaction.rollback();
LOG.error("Can not create Placement Home because of BusinessValidationException", e);
throw e;
} catch (UnauthorizedException e) {
userTransaction.rollback();
LOG.error("Can not create Placement Home because of UnauthorizedException", e);
throw e;
} catch (Exception e) {
try {
userTransaction.rollback();
} catch (Exception re) {
LOG.warn(re.getMessage(), re);
}
StringBuilder sb = new StringBuilder();
sb.append(e.getMessage());
sb.append('\n');
Throwable cause = e.getCause();
while (cause != null) {
sb.append(" Cause: ");
sb.append(cause.getMessage());
sb.append('\n');
cause = cause.getCause();
}
LOG.error("Can not create Placement Home: \n", e);
throw new SystemException(sb.toString());
}
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aFormService method find.
@UnitOfWork(CALSNS)
@Override
public RFA1aFormDTO find(RFA1aFormsParameterObject parameterObject) {
RFA1aForm form = rfa1AFormsDao.find(parameterObject.getFormId());
RFA1aFormDTO formDTO;
if (parameterObject.isExpanded()) {
formDTO = rfa1aFomMapper.toExpandedRFA1aFormDTO(form);
} else {
formDTO = rfa1aFomMapper.toRFA1aFormDTO(form);
}
return formDTO;
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aPDFGenerationService method generatePDF.
public String generatePDF(Long formId) {
String docId = null;
RFA1aFormDTO rfa1aFormDTO = rfa1aFormService.find(new RFA1aFormsParameterObject(formId, true));
if (rfa1aFormDTO != null) {
docId = generatePDF(rfa1aFormDTO);
}
return docId;
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aFormsResource method createApplicationForm.
// @UnitOfWork(CALSNS)
@POST
@Timed
@ApiResponses(value = { @ApiResponse(code = 201, message = "Created"), @ApiResponse(code = 401, message = "Not Authorized"), @ApiResponse(code = 406, message = "Accept Header not supported") })
@ApiOperation(value = "Creates and returns RFA 1A Form", response = RFA1aFormDTO.class)
public Response createApplicationForm(@ApiParam(name = "application", value = "The RFA-1A Application object") @Valid RFA1aFormDTO application) {
// TODO: remove this temporary fix to support older versions of CALS DS
if (application == null) {
application = new RFA1aFormDTO();
application.setInitialApplication(Boolean.TRUE);
}
return resourceDelegate.create(application);
}
use of gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO in project cals-api by ca-cwds.
the class RFA1aCornerCasesSubmitApplicationTest method unChangedSubmitStatusTest.
@Test
public void unChangedSubmitStatusTest() throws Exception {
if (TestModeUtils.isIntegrationTestsMode()) {
return;
}
RFA1aFormDTO form = formAHelper.createRFA1aForm();
applicantHelper.postApplicant(form.getId(), applicantHelper.getValidApplicant());
residenceHelper.putResidence(form.getId(), residenceHelper.getResidenceDTO());
Response response = statusHelper.submitApplication(form.getId(), FIXTURE_PATH_TO_PRINCIPAL);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
statusHelper.assertSubmitted(form.getId());
response = statusHelper.submitApplication(form.getId(), FIXTURE_PATH_TO_PRINCIPAL);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
statusHelper.assertSubmitted(form.getId());
}
Aggregations