use of fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity in project muikku by otavanopisto.
the class WorkspaceUserEntityDAO method listByWorkspaceEntityAndArchived.
public List<WorkspaceUserEntity> listByWorkspaceEntityAndArchived(WorkspaceEntity workspaceEntity, Boolean archived) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<WorkspaceUserEntity> criteria = criteriaBuilder.createQuery(WorkspaceUserEntity.class);
Root<WorkspaceUserEntity> root = criteria.from(WorkspaceUserEntity.class);
criteria.select(root);
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(WorkspaceUserEntity_.archived), archived), criteriaBuilder.equal(root.get(WorkspaceUserEntity_.workspaceEntity), workspaceEntity)));
return entityManager.createQuery(criteria).getResultList();
}
use of fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity in project muikku by otavanopisto.
the class WorkspaceUserEntityDAO method countByWorkspaceEntityAndRolesAndArchived.
public Long countByWorkspaceEntityAndRolesAndArchived(WorkspaceEntity workspaceEntity, List<WorkspaceRoleEntity> workspaceUserRoles, Boolean archived) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Long> criteria = criteriaBuilder.createQuery(Long.class);
Root<WorkspaceUserEntity> root = criteria.from(WorkspaceUserEntity.class);
criteria.select(criteriaBuilder.count(root));
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(WorkspaceUserEntity_.archived), archived), criteriaBuilder.equal(root.get(WorkspaceUserEntity_.workspaceEntity), workspaceEntity), root.get(WorkspaceUserEntity_.workspaceUserRole).in(workspaceUserRoles)));
return entityManager.createQuery(criteria).getSingleResult();
}
use of fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity in project muikku by otavanopisto.
the class WorkspaceUserEntityDAO method findByWorkspaceEntityAndUserSchoolDataIdentifierAndArchived.
public WorkspaceUserEntity findByWorkspaceEntityAndUserSchoolDataIdentifierAndArchived(WorkspaceEntity workspaceEntity, UserSchoolDataIdentifier userSchoolDataIdentifier, Boolean archived) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<WorkspaceUserEntity> criteria = criteriaBuilder.createQuery(WorkspaceUserEntity.class);
Root<WorkspaceUserEntity> root = criteria.from(WorkspaceUserEntity.class);
criteria.select(root);
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(WorkspaceUserEntity_.archived), archived), criteriaBuilder.equal(root.get(WorkspaceUserEntity_.userSchoolDataIdentifier), userSchoolDataIdentifier), criteriaBuilder.equal(root.get(WorkspaceUserEntity_.workspaceEntity), workspaceEntity)));
return getSingleResult(entityManager.createQuery(criteria));
}
use of fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity in project muikku by otavanopisto.
the class WorkspaceUserEntityDAO method listByWorkspaceEntityAndRoleAndArchived.
public List<WorkspaceUserEntity> listByWorkspaceEntityAndRoleAndArchived(WorkspaceEntity workspaceEntity, WorkspaceRoleEntity workspaceUserRole, Boolean archived) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<WorkspaceUserEntity> criteria = criteriaBuilder.createQuery(WorkspaceUserEntity.class);
Root<WorkspaceUserEntity> root = criteria.from(WorkspaceUserEntity.class);
criteria.select(root);
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(WorkspaceUserEntity_.archived), archived), criteriaBuilder.equal(root.get(WorkspaceUserEntity_.workspaceEntity), workspaceEntity), criteriaBuilder.equal(root.get(WorkspaceUserEntity_.workspaceUserRole), workspaceUserRole)));
return entityManager.createQuery(criteria).getResultList();
}
use of fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity in project muikku by otavanopisto.
the class WorkspaceUserEntityDAO method listByUserSchoolDataIdentifierAndActiveAndArchived.
public List<WorkspaceUserEntity> listByUserSchoolDataIdentifierAndActiveAndArchived(UserSchoolDataIdentifier userSchoolDataIdentifier, Boolean active, Boolean archived) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<WorkspaceUserEntity> criteria = criteriaBuilder.createQuery(WorkspaceUserEntity.class);
Root<WorkspaceUserEntity> root = criteria.from(WorkspaceUserEntity.class);
criteria.select(root);
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(WorkspaceUserEntity_.active), active), criteriaBuilder.equal(root.get(WorkspaceUserEntity_.archived), archived), criteriaBuilder.equal(root.get(WorkspaceUserEntity_.userSchoolDataIdentifier), userSchoolDataIdentifier)));
return entityManager.createQuery(criteria).getResultList();
}
Aggregations