use of fi.otavanopisto.muikku.model.users.FlagShare in project muikku by otavanopisto.
the class FlagShareDAO method listByFlag.
public List<FlagShare> listByFlag(Flag flag) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<FlagShare> criteria = criteriaBuilder.createQuery(FlagShare.class);
Root<FlagShare> root = criteria.from(FlagShare.class);
criteria.select(root);
criteria.where(criteriaBuilder.equal(root.get(FlagShare_.flag), flag));
return entityManager.createQuery(criteria).getResultList();
}
use of fi.otavanopisto.muikku.model.users.FlagShare in project muikku by otavanopisto.
the class FlagShareDAO method findByFlagAndUserIdentifier.
public FlagShare findByFlagAndUserIdentifier(Flag flag, UserSchoolDataIdentifier userIdentifier) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<FlagShare> criteria = criteriaBuilder.createQuery(FlagShare.class);
Root<FlagShare> root = criteria.from(FlagShare.class);
criteria.select(root);
criteria.where(criteriaBuilder.equal(root.get(FlagShare_.flag), flag), criteriaBuilder.equal(root.get(FlagShare_.userIdentifier), userIdentifier));
return getSingleResult(entityManager.createQuery(criteria));
}
use of fi.otavanopisto.muikku.model.users.FlagShare in project muikku by otavanopisto.
the class FlagShareDAO method listByUserIdentifier.
public List<FlagShare> listByUserIdentifier(UserSchoolDataIdentifier userIdentifier) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<FlagShare> criteria = criteriaBuilder.createQuery(FlagShare.class);
Root<FlagShare> root = criteria.from(FlagShare.class);
criteria.select(root);
criteria.where(criteriaBuilder.equal(root.get(FlagShare_.userIdentifier), userIdentifier));
return entityManager.createQuery(criteria).getResultList();
}
use of fi.otavanopisto.muikku.model.users.FlagShare in project muikku by otavanopisto.
the class FlagShareDAO method create.
public FlagShare create(Flag flag, UserSchoolDataIdentifier userIdentifier) {
FlagShare flagShare = new FlagShare();
flagShare.setFlag(flag);
flagShare.setUserIdentifier(userIdentifier);
return persist(flagShare);
}
Aggregations