use of gov.ca.cwds.data.legacy.cms.entity.PlacementHome 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.data.legacy.cms.entity.PlacementHome in project api-core by ca-cwds.
the class PlacementHomeDao method findByFacilityId.
public PlacementHome findByFacilityId(String facilityId) {
Session session = getSessionFactory().getCurrentSession();
Class<PlacementHome> entityClass = getEntityClass();
Query<PlacementHome> query = session.createNamedQuery(entityClass.getSimpleName() + ".find", entityClass);
query.setParameter("facilityId", facilityId);
PlacementHome placementHome = null;
try {
placementHome = query.getSingleResult();
} catch (NoResultException e) {
LOG.warn("There is no result for facilityId = {}", facilityId);
LOG.debug(e.getMessage(), e);
}
return placementHome;
}
use of gov.ca.cwds.data.legacy.cms.entity.PlacementHome in project api-core by ca-cwds.
the class PlacementHomeCreateAuthorizerTest method initPlacementHome.
private PlacementHome initPlacementHome() {
final PlacementHome placementHome = new PlacementHome();
placementHome.setIdentifier("id");
placementHome.setLicensrCd("CT");
placementHome.setFacilityType(Short.valueOf("1416"));
return placementHome;
}
use of gov.ca.cwds.data.legacy.cms.entity.PlacementHome in project api-core by ca-cwds.
the class BaseDocToolRulesPlacementHomeTest method prepareSuccessfulPlacementHomeEntityAwareDTO.
private PlacementHomeEntityAwareDTO prepareSuccessfulPlacementHomeEntityAwareDTO() {
PlacementHomeEntityAwareDTO placementHomeEntityAwareDTO = new PlacementHomeEntityAwareDTO();
PlacementHome placementHome = new PlacementHome();
placementHome.setAgeToNo((short) 23);
placementHome.setZipNo("11111");
placementHome.setLaPZipno("11111");
placementHome.setpZipNo("11111");
placementHome.setPyeFstnm("PyeFstnm");
placementHome.setPyeLstnm("PyeLstnm");
placementHome.setPstreetNm("PstreetNm");
placementHome.setpCityNm("pCityNm");
placementHome.setPayeeStateCode((short) 1);
SubstituteCareProvider substituteCareProvider = new SubstituteCareProvider();
substituteCareProvider.setZipNo("11111");
placementHome.setPrimarySubstituteCareProvider(substituteCareProvider);
placementHomeEntityAwareDTO.setEntity(placementHome);
return placementHomeEntityAwareDTO;
}
use of gov.ca.cwds.data.legacy.cms.entity.PlacementHome in project api-core by ca-cwds.
the class R00195Test method testNALicensrCd.
@Test
public void testNALicensrCd() throws DroolsException {
final PlacementHome placementHome = placementHomeEntityAwareDTO.getEntity();
placementHome.setFacilityType(null);
placementHome.setLicensrCd(null);
businessValidationService.runDataProcessing(placementHomeEntityAwareDTO, principal, PlacementHomeDroolsConfiguration.DATA_PROCESSING_INSTANCE);
assert placementHome.getLicensrCd().equals("NA");
}
Aggregations