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);
}
}
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));
}
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());
}
Aggregations