use of fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageRecipientUserGroup in project muikku by otavanopisto.
the class CommunicatorMessageRecipientUserGroupDAO method listByMessage.
public List<CommunicatorMessageRecipientUserGroup> listByMessage(CommunicatorMessage communicatorMessage) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<CommunicatorMessageRecipientUserGroup> criteria = criteriaBuilder.createQuery(CommunicatorMessageRecipientUserGroup.class);
Root<CommunicatorMessageRecipientUserGroup> root = criteria.from(CommunicatorMessageRecipientUserGroup.class);
Root<CommunicatorMessageRecipient> root2 = criteria.from(CommunicatorMessageRecipient.class);
criteria.select(root).distinct(true);
criteria.where(criteriaBuilder.and(root2.get(CommunicatorMessageRecipient_.recipientGroup).in(root), criteriaBuilder.equal(root2.get(CommunicatorMessageRecipient_.communicatorMessage), communicatorMessage)));
return entityManager.createQuery(criteria).getResultList();
}
use of fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageRecipientUserGroup in project muikku by otavanopisto.
the class CommunicatorMessageRecipientUserGroupDAO method create.
public CommunicatorMessageRecipientUserGroup create(UserGroupEntity userGroupEntity) {
CommunicatorMessageRecipientUserGroup workspaceGroup = new CommunicatorMessageRecipientUserGroup();
workspaceGroup.setUserGroupEntityId(userGroupEntity.getId());
getEntityManager().persist(workspaceGroup);
return workspaceGroup;
}
Aggregations