Package eu.scape_project.planning.model

Examples of eu.scape_project.planning.model.GroupInvitation


        if (inviteUser.getUserGroup().getId() == user.getUserGroup().getId()) {
            throw new AlreadyGroupMemberException();
        }

        GroupInvitation invitation = createInvitation(inviteUser.getEmail());
        sendInvitationMail(inviteUser, invitation, serverString);
    }
View Full Code Here


            for (User user : users) {
                inviteUser(user, serverString);
            }
        } else {
            // No user found
            GroupInvitation invitation = createInvitation(trimmedInviteMail);
            sendInvitationMail(invitation, serverString);
        }
    }
View Full Code Here

        for (GroupInvitation existingInvitation : existingInvitations) {
            em.remove(existingInvitation);
        }

        GroupInvitation invitation = new GroupInvitation();
        invitation.setEmail(inviteMail);
        invitation.setInvitationActionToken(UUID.randomUUID().toString());
        invitation.setInvitedGroup(user.getUserGroup());

        em.merge(invitation);
        log.debug("Created GroupInvitation for mail " + inviteMail);

        return invitation;
View Full Code Here

    public void acceptInvitation(String invitationActionToken) throws GroupNotFoundException, TokenNotFoundException,
        AlreadyGroupMemberException {

        try {

            GroupInvitation invitation = em
                .createQuery("SELECT i FROM GroupInvitation i WHERE i.invitationActionToken = :invitationActionToken",
                    GroupInvitation.class).setParameter("invitationActionToken", invitationActionToken)
                .getSingleResult();

            em.remove(invitation);

            if (invitation.getInvitedGroup() == null) {
                throw new GroupNotFoundException();
            }

            if (invitation.getInvitedGroup().getId() == user.getUserGroup().getId()) {
                throw new AlreadyGroupMemberException();
            }

            switchGroup(user, invitation.getInvitedGroup());
            save();

            log.info("Invitation to group " + user.getUserGroup().getName() + " accepted by user " + user.getUsername());

        } catch (NoResultException e) {
View Full Code Here

     *             if the token could not be found
     */
    public void declineInvitation(String invitationActionToken) throws TokenNotFoundException {
        try {

            GroupInvitation invitation = em
                .createQuery("SELECT i FROM GroupInvitation i WHERE i.invitationActionToken = :invitationActionToken",
                    GroupInvitation.class).setParameter("invitationActionToken", invitationActionToken)
                .getSingleResult();

            em.remove(invitation);
View Full Code Here

     */
    public String getInvitationGroupName(String invitationActionToken) throws TokenNotFoundException,
        GroupNotFoundException {

        try {
            GroupInvitation invitation = em
                .createQuery("SELECT i FROM GroupInvitation i WHERE i.invitationActionToken = :invitationActionToken",
                    GroupInvitation.class).setParameter("invitationActionToken", invitationActionToken)
                .getSingleResult();

            if (invitation.getInvitedGroup() == null) {
                throw new GroupNotFoundException();
            }

            return invitation.getInvitedGroup().getName();
        } catch (NoResultException e) {
            log.info("InvitationActionToken for user " + user.getUsername() + " not found.");
            throw new TokenNotFoundException(e);
        }
    }
View Full Code Here

TOP

Related Classes of eu.scape_project.planning.model.GroupInvitation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.