Search in sources :

Example 1 with LisFacFile

use of gov.ca.cwds.cals.persistence.model.lisfas.LisFacFile in project cals-api by ca-cwds.

the class LisFacilityService method loadFacilityFromLis.

/**
 * Load facility from LIS.
 */
public FacilityDTO loadFacilityFromLis(FacilityParameterObject parameterObject) {
    LisFacFile lisDsLisFacFile = findLisFacilityByLicenseNumber(parameterObject);
    if (lisDsLisFacFile == null) {
        LOGGER.warn("!!!Facility was not found in LIS by license number {}", parameterObject.getFacilityId());
        return null;
    }
    LpaInformation lpaInformation = lisDsLisFacFile.getFacDoEvalCode() != null ? fasFacilityService.findAssignedWorkerInformation(lisDsLisFacFile) : null;
    return facilityMapper.toFacilityDTO(lisDsLisFacFile, lpaInformation);
}
Also used : LpaInformation(gov.ca.cwds.cals.persistence.model.fas.LpaInformation) LisFacFile(gov.ca.cwds.cals.persistence.model.lisfas.LisFacFile)

Example 2 with LisFacFile

use of gov.ca.cwds.cals.persistence.model.lisfas.LisFacFile in project cals-api by ca-cwds.

the class LisFacilityService method findLisFacilityByLicenseNumber.

@UnitOfWork(LIS)
LisFacFile findLisFacilityByLicenseNumber(FacilityParameterObject parameterObject) {
    LisFacFile lisFacFile = lisFacFileLisDao.find(Integer.valueOf(parameterObject.getFacilityId()));
    if (lisFacFile == null) {
        return null;
    }
    Integer countyCode = lisFacFile.getCountyCode();
    if (countyCode != null) {
        LisTableFile county = lisTableFileDao.findCounty(countyCode);
        lisFacFile.setCounty(county);
    }
    Integer facilityStatusCode = lisFacFile.getFacilityStatusCode();
    if (facilityStatusCode != null) {
        LisTableFile facilityStatus = lisTableFileDao.findFacilityStatus(facilityStatusCode);
        lisFacFile.setFacilityStatus(facilityStatus);
    }
    Integer facilityTypeCode = lisFacFile.getFacilityTypeCode();
    if (facilityTypeCode != null) {
        LisTableFile facilityType = lisTableFileDao.findFacilityType(facilityTypeCode);
        lisFacFile.setFacilityType(facilityType);
    }
    return lisFacFile;
}
Also used : LisTableFile(gov.ca.cwds.cals.persistence.model.lisfas.LisTableFile) LisFacFile(gov.ca.cwds.cals.persistence.model.lisfas.LisFacFile) UnitOfWork(io.dropwizard.hibernate.UnitOfWork)

Aggregations

LisFacFile (gov.ca.cwds.cals.persistence.model.lisfas.LisFacFile)2 LpaInformation (gov.ca.cwds.cals.persistence.model.fas.LpaInformation)1 LisTableFile (gov.ca.cwds.cals.persistence.model.lisfas.LisTableFile)1 UnitOfWork (io.dropwizard.hibernate.UnitOfWork)1