Search in sources :

Example 1 with LpaInformation

use of gov.ca.cwds.cals.persistence.model.fas.LpaInformation in project cals-api by ca-cwds.

the class LpaInformationDao method findByLpaCode.

public LpaInformation findByLpaCode(String lpaCode) {
    Session session = getSessionFactory().getCurrentSession();
    Class<LpaInformation> entityClass = getEntityClass();
    Query<LpaInformation> query = session.createNamedQuery(LpaInformation.FIND_ASSIGNED_WORKER_BY_LPA_CODE, entityClass);
    query.setParameter(LpaInformation.PARAM_LPA_CODE, lpaCode);
    LpaInformation res = null;
    try {
        res = query.getSingleResult();
    } catch (NoResultException e) {
        LOG.warn("There is no result for lpaCode: {}", lpaCode);
        LOG.debug(e.getMessage(), e);
    }
    return res;
}
Also used : LpaInformation(gov.ca.cwds.cals.persistence.model.fas.LpaInformation) NoResultException(javax.persistence.NoResultException) Session(org.hibernate.Session)

Example 2 with LpaInformation

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

Aggregations

LpaInformation (gov.ca.cwds.cals.persistence.model.fas.LpaInformation)2 LisFacFile (gov.ca.cwds.cals.persistence.model.lisfas.LisFacFile)1 NoResultException (javax.persistence.NoResultException)1 Session (org.hibernate.Session)1