return false;
}
public void inviteUser(User userLogged, Long groupId, String userMail) throws ServiceException {
if (userMail==null || !EmailHelper.doEmailSeemsValid(userMail)) {
throw new ServiceException(RessourceBundleApplicationMessage.error("woj.page.admin.user.group.error.invite.no.mail", new Object[] {userMail}));
}
UserImpl u = (UserImpl)DaoFactory.getUserDao().findUserByEmail(userMail);
Group g;
try {
g = (Group)DaoFactory.getGroupDao().find(groupId);
} catch (DaoException e) {
throw new ServiceException(RessourceBundleApplicationMessage.error("woj.page.admin.user.group.error.group.not.found", new Object[] {groupId}));
}
if (u==null) {
throw new ServiceException(RessourceBundleApplicationMessage.error("woj.page.admin.user.group.error.invite.no.user.by.mail", new Object[] {userMail}));
}
License l = u.getLicenseUsed();
if (l==null || !u.isLicenseValid()) {
throw new ServiceException(RessourceBundleApplicationMessage.error("woj.page.admin.user.group.error.invite.user.no.license.valid", new Object[] {userMail}));
}
if (!ServiceFactory.getLicenseService().isGroupable(l)) {
throw new ServiceException(RessourceBundleApplicationMessage.error("woj.page.admin.user.group.error.invite.user.license.non.groupable", new Object[] {userMail}));
}
try {
ServiceFactory.getMailService().sendMail(Portal.getInstance().getMailFactory().createInviteUserMail(userLogged, u, g));
} catch (MessagingException e) {
throw new ServiceException(RessourceBundleApplicationMessage.error("woj.page.admin.user.group.error.invite.send.mail", null));
}
}