@Transactional public Sexualorientation getSexualorientationById(UUID sexualorientationId) { com.servinglynk.hmis.warehouse.model.v2014.Sexualorientation pSexualorientation = daoFactory.getSexualorientationDao().getSexualorientationById(sexualorientationId); if (pSexualorientation == null) throw new SexualorientationNotFoundException(); return SexualorientationConverter.entityToModel(pSexualorientation); }
@Transactional public Sexualorientations getAllEnrollmentSexualorientations( UUID enrollmentId, Integer startIndex, Integer maxItems) { Sexualorientations sexualorientations = new Sexualorientations(); List<com.servinglynk.hmis.warehouse.model.v2014.Sexualorientation> entities = daoFactory .getSexualorientationDao() .getAllEnrollmentSexualorientations(enrollmentId, startIndex, maxItems); for (com.servinglynk.hmis.warehouse.model.v2014.Sexualorientation entity : entities) { sexualorientations.addSexualorientation(SexualorientationConverter.entityToModel(entity)); } long count = daoFactory.getSexualorientationDao().getEnrollmentSexualorientationsCount(enrollmentId); SortedPagination pagination = new SortedPagination(); pagination.setFrom(startIndex); pagination.setReturned(sexualorientations.getSexualorientations().size()); pagination.setTotal((int) count); sexualorientations.setPagination(pagination); return sexualorientations; }