use of org.apache.openmeetings.IApplication in project openmeetings by apache.
the class ConfigurationDao method update.
public Configuration update(Configuration entity, Long userId, boolean deleted) {
String key = entity.getKey();
String value = entity.getValue();
if (entity.getId() == null || entity.getId().longValue() <= 0) {
entity.setInserted(new Date());
entity.setDeleted(deleted);
em.persist(entity);
} else {
entity.setUser(userDao.get(userId));
entity.setDeleted(deleted);
entity.setUpdated(new Date());
entity = em.merge(entity);
}
switch(key) {
case CONFIG_KEYCODE_ARRANGE:
case CONFIG_KEYCODE_EXCLUSIVE:
case CONFIG_KEYCODE_MUTE:
reloadRoomSettings();
break;
case CONFIG_MAX_UPLOAD_SIZE:
reloadMaxUpload();
break;
case CONFIG_CRYPT:
reloadCrypt();
break;
case CONFIG_APPLICATION_NAME:
setApplicationName(value);
break;
case CONFIG_APPLICATION_BASE_URL:
reloadBaseUrl();
break;
case CONFIG_SIP_ENABLED:
reloadSipEnabled();
break;
case CONFIG_GOOGLE_ANALYTICS_CODE:
reloadGaCode();
break;
case CONFIG_HEADER_XFRAME:
{
IApplication iapp = (IApplication) Application.get(getWicketApplicationName());
if (iapp != null) {
iapp.setXFrameOptions(value);
}
}
break;
case CONFIG_HEADER_CSP:
{
IApplication iapp = (IApplication) Application.get(getWicketApplicationName());
if (iapp != null) {
iapp.setContentSecurityPolicy(value);
}
}
break;
case CONFIG_EXT_PROCESS_TTL:
setExtProcessTtl(toInt(value));
break;
case CONFIG_DEFAULT_LANG:
reloadDefaultLang();
break;
case CONFIG_MP4_AUDIO_RATE:
reloadAudioRate();
break;
case CONFIG_MP4_AUDIO_BITRATE:
reloadAudioBitrate();
break;
case CONFIG_DEFAULT_TIMEZONE:
reloadTimezone();
break;
case CONFIG_REST_ALLOW_ORIGIN:
reloadRestAllowOrigin();
break;
}
return entity;
}
use of org.apache.openmeetings.IApplication in project openmeetings by apache.
the class StreamClientManager method add.
@Override
public StreamClient add(StreamClient c) {
if (c == null) {
return null;
}
IApplication iapp = getApp();
c.setServerId(iapp.getServerId());
c.setConnectedSince(new Date());
c.setRoomEnter(new Date());
update(c);
return c;
}
use of org.apache.openmeetings.IApplication 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.IApplication in project openmeetings by apache.
the class WebSocketHelper method publish.
protected static void publish(IClusterWsMessage m) {
IApplication app = getApp();
new Thread(() -> {
app.publishWsTopic(m);
}).start();
}
use of org.apache.openmeetings.IApplication in project openmeetings by apache.
the class ApplicationHelper method ensureApplication.
public static IApplication ensureApplication(Long langId) {
IApplication a = ensureApplication();
if (ThreadContext.getRequestCycle() == null) {
ServletWebRequest req = new ServletWebRequest(new MockHttpServletRequest((Application) a, new MockHttpSession(a.getServletContext()), a.getServletContext()), "");
RequestCycleContext rctx = new RequestCycleContext(req, new MockWebResponse(), a.getRootRequestMapper(), a.getExceptionMapperProvider().get());
ThreadContext.setRequestCycle(new RequestCycle(rctx));
}
if (ThreadContext.getSession() == null) {
WebSession s = WebSession.get();
if (langId > 0) {
((IWebSession) s).setLanguage(langId);
}
}
return a;
}
Aggregations