Search in sources :

Example 1 with LisTableFile

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

the class LisFacilityService method attachVisitsData.

@UnitOfWork(LIS)
void attachVisitsData(FacilityInformation facilityInformation) {
    Long facilityLastVisitReasonCode = facilityInformation.getFacLastVisitReason();
    if (facilityLastVisitReasonCode != null) {
        LisTableFile facilityLastVisitReason = lisTableFileDao.findVisitReasonType(facilityLastVisitReasonCode.intValue());
        facilityInformation.setFacilityLastVisitReason(facilityLastVisitReason);
    }
    Long facilityLastDeferredVisitReasonCode = facilityInformation.getFacLastDeferVisitReason();
    if (facilityLastDeferredVisitReasonCode != null) {
        LisTableFile facilityLastDeferredVisitReason = lisTableFileDao.findVisitReasonType(facilityLastDeferredVisitReasonCode.intValue());
        facilityInformation.setFacilityLastDeferredVisitReason(facilityLastDeferredVisitReason);
    }
}
Also used : LisTableFile(gov.ca.cwds.cals.persistence.model.lisfas.LisTableFile) UnitOfWork(io.dropwizard.hibernate.UnitOfWork)

Example 2 with LisTableFile

use of gov.ca.cwds.cals.persistence.model.lisfas.LisTableFile 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)

Example 3 with LisTableFile

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

the class LisTableFileDao method getLisTableFile.

private LisTableFile getLisTableFile(String paramName, Integer paramCode, String querySuffix) {
    Session session = getSessionFactory().getCurrentSession();
    Class<LisTableFile> entityClass = getEntityClass();
    Query<LisTableFile> query = session.createNamedQuery(entityClass.getSimpleName() + querySuffix, entityClass);
    query.setParameter(paramName, paramCode);
    LisTableFile lisTableFile = null;
    try {
        lisTableFile = query.getSingleResult();
    } catch (NoResultException e) {
        LOG.warn("There is no result for {} = {}", paramName, paramCode);
        LOG.debug(e.getMessage(), e);
    }
    return lisTableFile;
}
Also used : LisTableFile(gov.ca.cwds.cals.persistence.model.lisfas.LisTableFile) NoResultException(javax.persistence.NoResultException) Session(org.hibernate.Session)

Aggregations

LisTableFile (gov.ca.cwds.cals.persistence.model.lisfas.LisTableFile)3 UnitOfWork (io.dropwizard.hibernate.UnitOfWork)2 LisFacFile (gov.ca.cwds.cals.persistence.model.lisfas.LisFacFile)1 NoResultException (javax.persistence.NoResultException)1 Session (org.hibernate.Session)1