use of gov.ca.cwds.cals.persistence.model.fas.ComplaintReportLic802 in project cals-api by ca-cwds.
the class ComplaintReportLic802Dao method findComplaintsByFacilityNumber.
public List<ComplaintReportLic802> findComplaintsByFacilityNumber(String facilityNumber) {
Session session = getSessionFactory().getCurrentSession();
Class<ComplaintReportLic802> entityClass = getEntityClass();
Query<ComplaintReportLic802> query = session.createNamedQuery(ComplaintReportLic802.FIND_COMPLAINTS_BY_FACILITY_ID, entityClass);
query.setParameter(ComplaintReportLic802.PARAM_FACILITY_NUMBER, facilityNumber);
return query.getResultList();
}
use of gov.ca.cwds.cals.persistence.model.fas.ComplaintReportLic802 in project cals-api by ca-cwds.
the class ComplaintService method find.
@Override
public Response find(Serializable parametersObject) {
FacilityComplaintParameterObject parameterObject;
if (parametersObject instanceof FacilityComplaintParameterObject) {
parameterObject = (FacilityComplaintParameterObject) parametersObject;
ComplaintReportLic802 complaintReportLic802 = null;
if (StringUtils.isNumeric(parameterObject.getFacilityId())) {
complaintReportLic802 = complaintReportLic802Dao.findComplaintByFacilityIdAndComplaintId(parameterObject.getFacilityId(), parameterObject.getComplaintId());
}
if (complaintReportLic802 == null) {
throw new ExpectedException(Constants.ExpectedExceptionMessages.COMPLAINT_NOT_FOUND_BY_ID, NOT_FOUND);
} else {
return complaintMapper.entityToDTO(complaintReportLic802);
}
}
throw new IllegalStateException("FacilityComplaintParameterObject is expected here");
}
use of gov.ca.cwds.cals.persistence.model.fas.ComplaintReportLic802 in project cals-api by ca-cwds.
the class ComplaintsCollectionService method find.
@Override
public Response find(Serializable facilityNumber) {
List<ComplaintReportLic802> facilityComplaints = complaintReportLic802Dao.findComplaintsByFacilityNumber(String.valueOf(facilityNumber));
if (CollectionUtils.isEmpty(facilityComplaints)) {
return null;
}
ComplaintsDTO complaintsDTO = new ComplaintsDTO();
complaintsDTO.setComplaints(complaintMapper.complaintsListToComplaintsDTOList(facilityComplaints));
return complaintsDTO;
}
use of gov.ca.cwds.cals.persistence.model.fas.ComplaintReportLic802 in project cals-api by ca-cwds.
the class ComplaintReportLic802Dao method findComplaintByFacilityIdAndComplaintId.
public ComplaintReportLic802 findComplaintByFacilityIdAndComplaintId(String facilityId, String complaintId) {
Session session = getSessionFactory().getCurrentSession();
Class<ComplaintReportLic802> entityClass = getEntityClass();
Query<ComplaintReportLic802> query = session.createNamedQuery(ComplaintReportLic802.FIND_COMPLAINTS_BY_FACILITY_ID_AND_COMPLAINT_NUMBER, entityClass);
query.setParameter(ComplaintReportLic802.PARAM_FACILITY_NUMBER, facilityId);
query.setParameter(ComplaintReportLic802.PARAM_COMPLAINT_ID, complaintId);
ComplaintReportLic802 res = null;
try {
res = query.getSingleResult();
} catch (NoResultException e) {
LOG.warn("There is no result for facilityNumber: {} and complaintId: {}", facilityId, complaintId);
LOG.debug(e.getMessage(), e);
}
return res;
}
Aggregations