Search in sources :

Example 21 with UserGroupUserEntity

use of fi.otavanopisto.muikku.model.users.UserGroupUserEntity in project muikku by otavanopisto.

the class UserGroupUserEntityDAO method findByDataSourceAndIdentifierAndArchived.

public UserGroupUserEntity findByDataSourceAndIdentifierAndArchived(SchoolDataSource schoolDataSource, String identifier, Boolean archived) {
    EntityManager entityManager = getEntityManager();
    CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
    CriteriaQuery<UserGroupUserEntity> criteria = criteriaBuilder.createQuery(UserGroupUserEntity.class);
    Root<UserGroupUserEntity> root = criteria.from(UserGroupUserEntity.class);
    criteria.select(root);
    criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(UserGroupUserEntity_.archived), archived), criteriaBuilder.equal(root.get(UserGroupUserEntity_.schoolDataSource), schoolDataSource), criteriaBuilder.equal(root.get(UserGroupUserEntity_.identifier), identifier)));
    return getSingleResult(entityManager.createQuery(criteria));
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) EntityManager(javax.persistence.EntityManager) UserGroupUserEntity(fi.otavanopisto.muikku.model.users.UserGroupUserEntity)

Example 22 with UserGroupUserEntity

use of fi.otavanopisto.muikku.model.users.UserGroupUserEntity in project muikku by otavanopisto.

the class UserGroupUserEntityDAO method listByUserSchoolDataIdentifier.

public List<UserGroupUserEntity> listByUserSchoolDataIdentifier(UserSchoolDataIdentifier userSchoolDataIdentifier) {
    EntityManager entityManager = getEntityManager();
    CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
    CriteriaQuery<UserGroupUserEntity> criteria = criteriaBuilder.createQuery(UserGroupUserEntity.class);
    Root<UserGroupUserEntity> root = criteria.from(UserGroupUserEntity.class);
    criteria.select(root);
    criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(UserGroupUserEntity_.userSchoolDataIdentifier), userSchoolDataIdentifier)));
    return entityManager.createQuery(criteria).getResultList();
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) EntityManager(javax.persistence.EntityManager) UserGroupUserEntity(fi.otavanopisto.muikku.model.users.UserGroupUserEntity)

Aggregations

UserGroupUserEntity (fi.otavanopisto.muikku.model.users.UserGroupUserEntity)22 UserGroupEntity (fi.otavanopisto.muikku.model.users.UserGroupEntity)11 UserSchoolDataIdentifier (fi.otavanopisto.muikku.model.users.UserSchoolDataIdentifier)8 EntityManager (javax.persistence.EntityManager)8 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)8 RESTPermit (fi.otavanopisto.security.rest.RESTPermit)3 Path (javax.ws.rs.Path)3 UserEntity (fi.otavanopisto.muikku.model.users.UserEntity)2 WorkspaceEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceEntity)2 WorkspaceUserEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity)2 StudentGroupType (fi.otavanopisto.muikku.plugins.schooldatapyramus.PyramusIdentifierMapper.StudentGroupType)2 StudentGroupStudent (fi.otavanopisto.pyramus.rest.model.StudentGroupStudent)2 StudentGroupUser (fi.otavanopisto.pyramus.rest.model.StudentGroupUser)2 ArrayList (java.util.ArrayList)2 DELETE (javax.ws.rs.DELETE)2 Tag (fi.otavanopisto.muikku.model.base.Tag)1 CommunicatorMessage (fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessage)1 CommunicatorMessageCategory (fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageCategory)1 CommunicatorMessageId (fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageId)1 CommunicatorMessageRecipientUserGroup (fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageRecipientUserGroup)1