Search in sources :

Example 1 with IApplication

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;
}
Also used : IApplication(org.apache.openmeetings.IApplication) Date(java.util.Date)

Example 2 with IApplication

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;
}
Also used : IApplication(org.apache.openmeetings.IApplication) Date(java.util.Date)

Example 3 with IApplication

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);
    }
}
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 4 with IApplication

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();
}
Also used : IApplication(org.apache.openmeetings.IApplication)

Example 5 with IApplication

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;
}
Also used : MockWebResponse(org.apache.wicket.mock.MockWebResponse) IApplication(org.apache.openmeetings.IApplication) RequestCycleContext(org.apache.wicket.request.cycle.RequestCycleContext) IWebSession(org.apache.openmeetings.IWebSession) WebSession(org.apache.wicket.protocol.http.WebSession) IWebSession(org.apache.openmeetings.IWebSession) MockHttpServletRequest(org.apache.wicket.protocol.http.mock.MockHttpServletRequest) RequestCycle(org.apache.wicket.request.cycle.RequestCycle) MockHttpSession(org.apache.wicket.protocol.http.mock.MockHttpSession) ServletWebRequest(org.apache.wicket.protocol.http.servlet.ServletWebRequest) IApplication(org.apache.openmeetings.IApplication) Application(org.apache.wicket.Application) WebApplication(org.apache.wicket.protocol.http.WebApplication)

Aggregations

IApplication (org.apache.openmeetings.IApplication)6 Date (java.util.Date)2 WebApplication (org.apache.wicket.protocol.http.WebApplication)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 IWebSession (org.apache.openmeetings.IWebSession)1 MailMessage (org.apache.openmeetings.db.entity.basic.MailMessage)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 Application (org.apache.wicket.Application)1 MockWebResponse (org.apache.wicket.mock.MockWebResponse)1 WebSession (org.apache.wicket.protocol.http.WebSession)1 MockHttpServletRequest (org.apache.wicket.protocol.http.mock.MockHttpServletRequest)1 MockHttpSession (org.apache.wicket.protocol.http.mock.MockHttpSession)1 ServletWebRequest (org.apache.wicket.protocol.http.servlet.ServletWebRequest)1 RequestCycle (org.apache.wicket.request.cycle.RequestCycle)1 RequestCycleContext (org.apache.wicket.request.cycle.RequestCycleContext)1