Search in sources :

Example 1 with MailMessage

use of org.apache.openmeetings.db.entity.basic.MailMessage in project openmeetings by apache.

the class InvitationManager method sendInvitationLink.

@Override
public void sendInvitationLink(Invitation i, MessageType type, String subject, String message, boolean ical) throws Exception {
    String invitationLink = null;
    if (type != MessageType.Cancel) {
        IApplication app = ensureApplication(1L);
        invitationLink = app.getOmInvitationLink(i);
    }
    User owner = i.getInvitedBy();
    String invitorName = owner.getFirstname() + " " + owner.getLastname();
    String template = InvitationTemplate.getEmail(i.getInvitee(), invitorName, message, invitationLink);
    String email = i.getInvitee().getAddress().getEmail();
    String replyToEmail = owner.getAddress().getEmail();
    if (ical) {
        String username = i.getInvitee().getLogin();
        boolean isOwner = owner.getId().equals(i.getInvitee().getId());
        IcalHandler handler = new IcalHandler(MessageType.Cancel == type ? IcalHandler.ICAL_METHOD_CANCEL : IcalHandler.ICAL_METHOD_REQUEST);
        Map<String, String> attendeeList = handler.getAttendeeData(email, username, isOwner);
        List<Map<String, String>> atts = new ArrayList<>();
        atts.add(attendeeList);
        // Defining Organizer
        Map<String, String> organizerAttendee = handler.getAttendeeData(replyToEmail, owner.getLogin(), isOwner);
        Appointment a = i.getAppointment();
        // Create ICal Message
        String meetingId = handler.addNewMeeting(a.getStart(), a.getEnd(), a.getTitle(), atts, invitationLink, organizerAttendee, a.getIcalId(), getTimeZone(owner).getID());
        // Writing back meetingUid
        if (Strings.isEmpty(a.getIcalId())) {
            a.setIcalId(meetingId);
        }
        log.debug(handler.getICalDataAsString());
        mailHandler.send(new MailMessage(email, replyToEmail, subject, template, handler.getIcalAsByteArray()));
    } else {
        mailHandler.send(email, replyToEmail, subject, template);
    }
}
Also used : Appointment(org.apache.openmeetings.db.entity.calendar.Appointment) MailMessage(org.apache.openmeetings.db.entity.basic.MailMessage) IApplication(org.apache.openmeetings.IApplication) User(org.apache.openmeetings.db.entity.user.User) ArrayList(java.util.ArrayList) IcalHandler(org.apache.openmeetings.util.mail.IcalHandler) Map(java.util.Map)

Example 2 with MailMessage

use of org.apache.openmeetings.db.entity.basic.MailMessage in project openmeetings by apache.

the class EmailForm method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    // add a cancel button that can be used to submit the form via ajax
    delBtn = new ConfirmableAjaxBorder("ajax-cancel-button", getString("80"), getString("833"), this) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            emailDao.delete(getModelObject().getId());
            setModelObject(new MailMessage());
            target.add(list, EmailForm.this);
        }
    };
    add(delBtn.setOutputMarkupId(true).setEnabled(false));
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) MailMessage(org.apache.openmeetings.db.entity.basic.MailMessage) ConfirmableAjaxBorder(org.apache.openmeetings.web.common.ConfirmableAjaxBorder)

Example 3 with MailMessage

use of org.apache.openmeetings.db.entity.basic.MailMessage in project openmeetings by apache.

the class EmailForm method onModelChanged.

@Override
protected void onModelChanged() {
    super.onModelChanged();
    MailMessage m = getModelObject();
    delBtn.setEnabled(m.getId() != null);
    status.setDefaultModelObject(getString("admin.email.status." + m.getStatus().name()));
    reset.setEnabled(m.getId() != null && MailMessage.Status.ERROR == m.getStatus());
}
Also used : MailMessage(org.apache.openmeetings.db.entity.basic.MailMessage)

Aggregations

MailMessage (org.apache.openmeetings.db.entity.basic.MailMessage)3 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 IApplication (org.apache.openmeetings.IApplication)1 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)1 User (org.apache.openmeetings.db.entity.user.User)1 IcalHandler (org.apache.openmeetings.util.mail.IcalHandler)1 ConfirmableAjaxBorder (org.apache.openmeetings.web.common.ConfirmableAjaxBorder)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1