Search in sources :

Example 6 with UserEntityProperty

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

the class UserEntityPropertyDAO method findByUserEntityAndKey.

public UserEntityProperty findByUserEntityAndKey(UserEntity userEntity, String key) {
    EntityManager entityManager = getEntityManager();
    CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
    CriteriaQuery<UserEntityProperty> criteria = criteriaBuilder.createQuery(UserEntityProperty.class);
    Root<UserEntityProperty> root = criteria.from(UserEntityProperty.class);
    criteria.select(root);
    criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(UserEntityProperty_.userEntity), userEntity), criteriaBuilder.equal(root.get(UserEntityProperty_.key), key)));
    return getSingleResult(entityManager.createQuery(criteria));
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) EntityManager(javax.persistence.EntityManager) UserEntityProperty(fi.otavanopisto.muikku.model.users.UserEntityProperty)

Aggregations

UserEntityProperty (fi.otavanopisto.muikku.model.users.UserEntityProperty)6 UserEntity (fi.otavanopisto.muikku.model.users.UserEntity)3 WorkspaceUserEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity)3 RESTPermit (fi.otavanopisto.security.rest.RESTPermit)3 GET (javax.ws.rs.GET)3 Path (javax.ws.rs.Path)3 ArrayList (java.util.ArrayList)2 EntityManager (javax.persistence.EntityManager)2 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)2 EnvironmentRoleArchetype (fi.otavanopisto.muikku.model.users.EnvironmentRoleArchetype)1 UserSchoolDataIdentifier (fi.otavanopisto.muikku.model.users.UserSchoolDataIdentifier)1 WorkspaceEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceEntity)1 SchoolDataIdentifier (fi.otavanopisto.muikku.schooldata.SchoolDataIdentifier)1 SearchProvider (fi.otavanopisto.muikku.search.SearchProvider)1 SearchResult (fi.otavanopisto.muikku.search.SearchResult)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1