Search in sources :

Example 6 with WorkspaceMaterialMultiSelectFieldAnswer

use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialMultiSelectFieldAnswer in project muikku by otavanopisto.

the class WorkspaceMaterialMultiSelectFieldAnswerDAO method listByQueryMultiSelectFieldOption.

public List<WorkspaceMaterialMultiSelectFieldAnswer> listByQueryMultiSelectFieldOption(QueryMultiSelectFieldOption option) {
    EntityManager entityManager = getEntityManager();
    CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
    CriteriaQuery<WorkspaceMaterialMultiSelectFieldAnswer> criteria = criteriaBuilder.createQuery(WorkspaceMaterialMultiSelectFieldAnswer.class);
    Root<WorkspaceMaterialMultiSelectFieldAnswerOption> root = criteria.from(WorkspaceMaterialMultiSelectFieldAnswerOption.class);
    criteria.select(root.get(WorkspaceMaterialMultiSelectFieldAnswerOption_.fieldAnswer)).distinct(true);
    criteria.where(criteriaBuilder.equal(root.get(WorkspaceMaterialMultiSelectFieldAnswerOption_.option), option));
    return entityManager.createQuery(criteria).getResultList();
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) EntityManager(javax.persistence.EntityManager) WorkspaceMaterialMultiSelectFieldAnswer(fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialMultiSelectFieldAnswer) WorkspaceMaterialMultiSelectFieldAnswerOption(fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialMultiSelectFieldAnswerOption)

Aggregations

WorkspaceMaterialMultiSelectFieldAnswer (fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialMultiSelectFieldAnswer)6 WorkspaceMaterialMultiSelectFieldAnswerOption (fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialMultiSelectFieldAnswerOption)3 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)3 QueryMultiSelectFieldOption (fi.otavanopisto.muikku.plugins.material.model.QueryMultiSelectFieldOption)2 EntityManager (javax.persistence.EntityManager)2 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)2 MaterialFieldMetaParsingExeption (fi.otavanopisto.muikku.plugins.material.MaterialFieldMetaParsingExeption)1 MultiSelectFieldMeta (fi.otavanopisto.muikku.plugins.material.fieldmeta.MultiSelectFieldMeta)1 MultiSelectFieldOptionMeta (fi.otavanopisto.muikku.plugins.material.fieldmeta.MultiSelectFieldOptionMeta)1 QueryMultiSelectField (fi.otavanopisto.muikku.plugins.material.model.QueryMultiSelectField)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1