Search in sources :

Example 16 with CommunicatorMessageIdLabel

use of fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageIdLabel in project muikku by otavanopisto.

the class CommunicatorController method delete.

public void delete(CommunicatorUserLabel communicatorUserLabel) {
    List<CommunicatorMessageIdLabel> labels = communicatorMessageIdLabelDAO.listByLabel(communicatorUserLabel);
    for (CommunicatorMessageIdLabel label : labels) {
        delete(label);
    }
    communicatorUserLabelDAO.delete(communicatorUserLabel);
}
Also used : CommunicatorMessageIdLabel(fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageIdLabel)

Example 17 with CommunicatorMessageIdLabel

use of fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageIdLabel in project muikku by otavanopisto.

the class CommunicatorMessageIdLabelDAO method create.

public CommunicatorMessageIdLabel create(UserEntity userEntity, CommunicatorMessageId messageId, CommunicatorLabel label) {
    CommunicatorMessageIdLabel communicatorUserLabel = new CommunicatorMessageIdLabel();
    communicatorUserLabel.setUserEntity(userEntity.getId());
    communicatorUserLabel.setCommunicatorMessageId(messageId);
    communicatorUserLabel.setLabel(label);
    getEntityManager().persist(communicatorUserLabel);
    return communicatorUserLabel;
}
Also used : CommunicatorMessageIdLabel(fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageIdLabel)

Example 18 with CommunicatorMessageIdLabel

use of fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageIdLabel in project muikku by otavanopisto.

the class CommunicatorMessageIdLabelDAO method listByLabel.

public List<CommunicatorMessageIdLabel> listByLabel(CommunicatorUserLabel communicatorUserLabel) {
    EntityManager entityManager = getEntityManager();
    CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
    CriteriaQuery<CommunicatorMessageIdLabel> criteria = criteriaBuilder.createQuery(CommunicatorMessageIdLabel.class);
    Root<CommunicatorMessageIdLabel> root = criteria.from(CommunicatorMessageIdLabel.class);
    criteria.select(root);
    criteria.where(criteriaBuilder.equal(root.get(CommunicatorMessageIdLabel_.label), communicatorUserLabel));
    return entityManager.createQuery(criteria).getResultList();
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) CommunicatorMessageIdLabel(fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageIdLabel) EntityManager(javax.persistence.EntityManager)

Aggregations

CommunicatorMessageIdLabel (fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageIdLabel)18 UserEntity (fi.otavanopisto.muikku.model.users.UserEntity)11 RESTPermit (fi.otavanopisto.security.rest.RESTPermit)11 Path (javax.ws.rs.Path)11 CommunicatorMessage (fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessage)10 GET (javax.ws.rs.GET)10 CommunicatorMessageId (fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageId)8 CommunicatorMessageRecipient (fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageRecipient)5 EntityManager (javax.persistence.EntityManager)5 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)5 ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 UserBasicInfo (fi.otavanopisto.muikku.rest.model.UserBasicInfo)3 CommunicatorLabel (fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorLabel)2 CommunicatorMessageRecipientUserGroup (fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageRecipientUserGroup)2 CommunicatorMessageRecipientWorkspaceGroup (fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorMessageRecipientWorkspaceGroup)2 CommunicatorUserLabel (fi.otavanopisto.muikku.plugins.communicator.model.CommunicatorUserLabel)1 Join (javax.persistence.criteria.Join)1 Predicate (javax.persistence.criteria.Predicate)1 Root (javax.persistence.criteria.Root)1