/** Lists the entities of type Intrant for the CSV export */ @Transactional(readOnly = true) public List<Intrant> listForCsv( String sortProperty, boolean sortOrder, String identifiant, String nom) { ImogActor actor = HttpSessionUtil.getCurrentUser(); ImogJunction junction = createFilterJuntion(actor); if (identifiant != null && !identifiant.isEmpty()) { BasicCriteria criteria = new BasicCriteria(); criteria.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS); criteria.setField("identifiant"); criteria.setValue(identifiant); junction.add(criteria); } if (nom != null && !nom.isEmpty()) { BasicCriteria criteria = new BasicCriteria(); criteria.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS); criteria.setField("nom"); criteria.setValue(nom); junction.add(criteria); } List<Intrant> beans = dao.load(sortProperty, sortOrder, junction); List<Intrant> securedBeans = filter.<Intrant>toSecure(beans); return securedBeans; }
/** * Counts the number of non affected intrant entities in the database * * @param property the property which is not affected * @param criterion request criteria * @return the count */ @Transactional(readOnly = true) public Long countNonAffectedIntrantReverse(String property, ImogJunction criterions) { ImogActor actor = HttpSessionUtil.getCurrentUser(); ImogJunction junction = createFilterJuntion(actor); if (criterions != null) junction.add(criterions); return dao.countNonAffectedReverse(property, junction); }
/** * Counts the number of intrant in the database, that match the criteria * * @return the count */ @Transactional(readOnly = true) public Long countIntrant(ImogJunction criterions) { ImogActor actor = HttpSessionUtil.getCurrentUser(); ImogJunction junction = createFilterJuntion(actor); if (criterions != null) junction.add(criterions); return dao.count(junction); }
/** * Lists the entities of type Intrant * * @param sortProperty the property used to sort the collection * @param sortOrder true for an ascendant sort * @return list of intrant */ @Transactional(readOnly = true) public List<Intrant> listIntrant(String sortProperty, boolean sortOrder) { ImogActor actor = HttpSessionUtil.getCurrentUser(); ImogJunction junction = createFilterJuntion(actor); List<Intrant> beans = dao.load(sortProperty, sortOrder, junction); return beans; }
/** * Lists the entities of type Intrant * * @param i first index to retrieve * @param j nb of items to retrieve * @param sortProperty the property used to sort the collection * @param sortOrder true for an ascendant sort * @param criterions request criteria * @return list of intrant */ @Transactional(readOnly = true) public List<Intrant> listIntrant( int i, int j, String sortProperty, boolean sortOrder, ImogJunction criterions) { ImogActor actor = HttpSessionUtil.getCurrentUser(); ImogJunction junction = createFilterJuntion(actor); if (criterions != null) junction.add(criterions); List<Intrant> beans = dao.load(i, j, sortProperty, sortOrder, junction); return beans; }
/** * Saves or updates the entity * * @param entity the entity to be saved or updated * @param isNew true if it is a new entity added for the first time. */ @Transactional public void save(Intrant entity, boolean isNew) { ImogActor actor = HttpSessionUtil.getCurrentUser(); if (entity != null) { handlerHelper.prepare(entity); if (entity.getDeleted() != null) entity.setDeleted(null); dao.saveOrUpdate(entity, isNew); } }
@Override protected Predicate getFilter(Root<Patient> root, CriteriaBuilder builder) { ImogActor actor = ImogActorUtils.getCurrentActor(); if (actor == null) { actor = HttpSessionUtil.getCurrentUser(); } if (actor instanceof Personnel) { Personnel personnel = (Personnel) actor; String niveau = personnel.getNiveau(); if ("1".equals(niveau)) { Path<?> join = DaoUtil.getCascadeRoot(root.join("centres", JoinType.LEFT), "region.id"); return builder.equal(join, personnel.getRegion().getId()); } else if ("2".equals(niveau)) { Path<?> join = DaoUtil.getCascadeRoot(root.join("centres", JoinType.LEFT), "districtSante.id"); return builder.equal(join, personnel.getDistrictSante().getId()); } else if ("3".equals(niveau)) { Path<?> join = root.join("centres", JoinType.LEFT).get("id"); return builder.equal(join, personnel.getCDT().getId()); } } return null; }