use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialField in project muikku by otavanopisto.
the class WorkspaceMaterialFieldDAO method findByWorkspaceMaterialAndQueryFieldAndEmbedId.
public WorkspaceMaterialField findByWorkspaceMaterialAndQueryFieldAndEmbedId(WorkspaceMaterial workspaceMaterial, QueryField queryField, String embedId) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<WorkspaceMaterialField> criteria = criteriaBuilder.createQuery(WorkspaceMaterialField.class);
Root<WorkspaceMaterialField> root = criteria.from(WorkspaceMaterialField.class);
criteria.select(root);
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(WorkspaceMaterialField_.workspaceMaterial), workspaceMaterial), criteriaBuilder.equal(root.get(WorkspaceMaterialField_.queryField), queryField), criteriaBuilder.equal(root.get(WorkspaceMaterialField_.embedId), embedId)));
return getSingleResult(entityManager.createQuery(criteria));
}
use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialField in project muikku by otavanopisto.
the class WorkspaceMaterialFieldDAO method listByWorkspaceMaterial.
public List<WorkspaceMaterialField> listByWorkspaceMaterial(WorkspaceMaterial workspaceMaterial) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<WorkspaceMaterialField> criteria = criteriaBuilder.createQuery(WorkspaceMaterialField.class);
Root<WorkspaceMaterialField> root = criteria.from(WorkspaceMaterialField.class);
criteria.select(root);
criteria.where(criteriaBuilder.equal(root.get(WorkspaceMaterialField_.workspaceMaterial), workspaceMaterial));
return entityManager.createQuery(criteria).getResultList();
}
use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialField in project muikku by otavanopisto.
the class QueryFieldChangeListener method onQueryMultiSelectFieldUpdate.
public void onQueryMultiSelectFieldUpdate(@Observes QueryFieldUpdateEvent event) {
if (event.getMaterialField().getType().equals("application/vnd.muikku.field.multiselect")) {
QueryField queryField = event.getQueryField();
List<WorkspaceMaterialField> workspaceMaterialFields = workspaceMaterialFieldController.listWorkspaceMaterialFieldsByQueryField(queryField);
for (WorkspaceMaterialField workspaceMaterialField : workspaceMaterialFields) {
workspaceMaterialFieldController.updateWorkspaceMaterialField(workspaceMaterialField, event.getMaterialField(), event.getRemoveAnswers());
}
}
}
use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialField in project muikku by otavanopisto.
the class QueryFieldChangeListener method onQueryOrganizerFieldUpdate.
public void onQueryOrganizerFieldUpdate(@Observes QueryFieldUpdateEvent event) {
if (event.getMaterialField().getType().equals("application/vnd.muikku.field.organizer")) {
QueryField queryField = event.getQueryField();
List<WorkspaceMaterialField> workspaceMaterialFields = workspaceMaterialFieldController.listWorkspaceMaterialFieldsByQueryField(queryField);
for (WorkspaceMaterialField workspaceMaterialField : workspaceMaterialFields) {
workspaceMaterialFieldController.updateWorkspaceMaterialField(workspaceMaterialField, event.getMaterialField(), event.getRemoveAnswers());
}
}
}
use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialField in project muikku by otavanopisto.
the class QueryFieldChangeListener method onQuerySorterFieldUpdate.
public void onQuerySorterFieldUpdate(@Observes QueryFieldUpdateEvent event) {
if (event.getMaterialField().getType().equals("application/vnd.muikku.field.sorter")) {
QueryField queryField = event.getQueryField();
List<WorkspaceMaterialField> workspaceMaterialFields = workspaceMaterialFieldController.listWorkspaceMaterialFieldsByQueryField(queryField);
for (WorkspaceMaterialField workspaceMaterialField : workspaceMaterialFields) {
workspaceMaterialFieldController.updateWorkspaceMaterialField(workspaceMaterialField, event.getMaterialField(), event.getRemoveAnswers());
}
}
}
Aggregations