use of fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity in project muikku by otavanopisto.
the class WorkspaceUserEntityDAO method findByWorkspaceEntityAndUserSchoolDataIdentifierAndActiveAndArchived.
public WorkspaceUserEntity findByWorkspaceEntityAndUserSchoolDataIdentifierAndActiveAndArchived(WorkspaceEntity workspaceEntity, 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), 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 listByWorkspaceEntityAndRoleArchetypeAndActiveAndArchived.
public List<WorkspaceUserEntity> listByWorkspaceEntityAndRoleArchetypeAndActiveAndArchived(WorkspaceEntity workspaceEntity, WorkspaceRoleArchetype archetype, 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);
Join<WorkspaceUserEntity, WorkspaceRoleEntity> join = root.join(WorkspaceUserEntity_.workspaceUserRole);
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_.workspaceEntity), workspaceEntity), criteriaBuilder.equal(join.get(WorkspaceRoleEntity_.archetype), archetype)));
return entityManager.createQuery(criteria).getResultList();
}
use of fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity in project muikku by otavanopisto.
the class WorkspaceUserEntityDAO method findByIdentifier.
public List<WorkspaceUserEntity> findByIdentifier(String identifier) {
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.equal(root.get(WorkspaceUserEntity_.identifier), identifier));
return entityManager.createQuery(criteria).getResultList();
}
use of fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity in project muikku by otavanopisto.
the class WorkspaceUserEntityDAO method listByWorkspaceEntity.
public List<WorkspaceUserEntity> listByWorkspaceEntity(WorkspaceEntity workspaceEntity) {
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.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 findByWorkspaceAndIdentifierAndArchived.
public WorkspaceUserEntity findByWorkspaceAndIdentifierAndArchived(WorkspaceEntity workspaceEntity, String identifier, 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_.workspaceEntity), workspaceEntity), criteriaBuilder.equal(root.get(WorkspaceUserEntity_.identifier), identifier), criteriaBuilder.equal(root.get(WorkspaceUserEntity_.archived), archived)));
return getSingleResult(entityManager.createQuery(criteria));
}
Aggregations