Search in sources :

Example 6 with User

use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.

the class UserDTO method get.

public User get(UserDao userDao) {
    User u = id == null ? new User() : userDao.get(id);
    u.setFirstname(firstname);
    u.setLastname(lastname);
    u.setRights(rights);
    u.setLanguageId(languageId);
    u.setAddress(address);
    u.setTimeZoneId(timeZoneId);
    u.setExternalId(externalId);
    u.setExternalType(externalType);
    u.setType(type);
    return u;
}
Also used : User(org.apache.openmeetings.db.entity.user.User)

Example 7 with User

use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.

the class MobileService method loginGoogle.

public Map<String, Object> loginGoogle(Map<String, String> umap) {
    Map<String, Object> result = getResult();
    try {
        if (cfgDao.getBool(CONFIG_REGISTER_OAUTH, false)) {
            // TODO hardcoded
            User u = userManager.loginOAuth(new OAuthUser(umap), 2);
            result = login(u, result);
        }
    } catch (Exception e) {
        log.error("[loginGoogle]", e);
    }
    return result;
}
Also used : User(org.apache.openmeetings.db.entity.user.User) OAuthUser(org.apache.openmeetings.db.dto.user.OAuthUser) OAuthUser(org.apache.openmeetings.db.dto.user.OAuthUser) OmException(org.apache.openmeetings.util.OmException)

Example 8 with User

use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.

the class WebSocketHelper method setScope.

private static JSONObject setScope(JSONObject o, ChatMessage m, long curUserId) {
    String scope, scopeName = null;
    if (m.getToUser() != null) {
        User u = curUserId == m.getToUser().getId() ? m.getFromUser() : m.getToUser();
        scope = ID_USER_PREFIX + u.getId();
        scopeName = getDisplayName(u);
    } else if (m.getToRoom() != null) {
        scope = ID_ROOM_PREFIX + m.getToRoom().getId();
        o.put("needModeration", m.isNeedModeration());
    } else {
        scope = ID_ALL;
    }
    return o.put("scope", scope).put("scopeName", scopeName);
}
Also used : User(org.apache.openmeetings.db.entity.user.User) WsMessageUser(org.apache.openmeetings.core.util.ws.WsMessageUser)

Example 9 with User

use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.

the class MessageDialog method reset.

public MessageDialog reset(boolean isPrivate) {
    LocalDateTime now = ZonedDateTime.now(getZoneId()).toLocalDateTime();
    start.setModelObject(now);
    end.setModelObject(now.plus(1, ChronoUnit.HOURS));
    modelTo.setObject(new ArrayList<User>());
    PrivateMessage p = new PrivateMessage();
    p.setFrom(userDao.get(getUserId()));
    p.setOwner(p.getFrom());
    p.setIsRead(false);
    p.setFolderId(INBOX_FOLDER_ID);
    p.setRoom(AppointmentDialog.createAppRoom());
    setModelObject(p);
    roomParams.setVisible(getModelObject().isBookedRoom());
    form.setModelObject(p);
    this.isPrivate = isPrivate;
    return this;
}
Also used : LocalDateTime(java.time.LocalDateTime) User(org.apache.openmeetings.db.entity.user.User) PrivateMessage(org.apache.openmeetings.db.entity.user.PrivateMessage)

Example 10 with User

use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.

the class MessageDialog method onSubmit.

@Override
protected void onSubmit(AjaxRequestTarget target) {
    PrivateMessage m = getModelObject();
    m.setInserted(new Date());
    User owner = userDao.get(getUserId());
    if (m.isBookedRoom()) {
        Room r = m.getRoom();
        r.setName(m.getSubject());
        r.setComment("");
        r.setCapacity(100L);
        r.setAppointment(true);
        r.setAllowUserQuestions(true);
        r = roomDao.update(r, getUserId());
        Appointment a = new Appointment();
        a.setTitle(m.getSubject());
        a.setDescription(m.getMessage());
        a.setRoom(r);
        a.setStart(CalendarWebHelper.getDate(start.getModelObject()));
        a.setEnd(CalendarWebHelper.getDate(end.getModelObject()));
        List<MeetingMember> attendees = new ArrayList<>();
        for (User to : modelTo.getObject()) {
            MeetingMember mm = new MeetingMember();
            mm.setUser(to);
            mm.setDeleted(false);
            mm.setInserted(a.getInserted());
            mm.setUpdated(a.getUpdated());
            mm.setAppointment(a);
            attendees.add(mm);
        }
        a.setOwner(owner);
        a.setMeetingMembers(attendees);
        apptDao.update(a, getUserId(), false);
        m.setRoom(r);
    } else {
        m.setRoom(null);
    }
    for (User to : modelTo.getObject()) {
        if (to.getId() == null) {
            userDao.update(to, getUserId());
        }
        // to send
        PrivateMessage p = new PrivateMessage(m);
        p.setTo(to);
        p.setFolderId(SENT_FOLDER_ID);
        msgDao.update(p, getUserId());
        // to inbox
        p = new PrivateMessage(m);
        p.setOwner(to);
        p.setFolderId(INBOX_FOLDER_ID);
        msgDao.update(p, getUserId());
        if (to.getAddress() != null) {
            String aLinkHTML = (isPrivate && to.getType() == Type.user) ? "<br/><br/>" + "<a href='" + getContactsLink() + "'>" + Application.getString("1302", to.getLanguageId()) + "</a><br/>" : "";
            String invitationLink = "";
            if (p.isBookedRoom()) {
                Invitation i = inviteManager.getInvitation(to, p.getRoom(), false, null, Valid.Period, owner, to.getLanguageId(), CalendarHelper.getDate(start.getModelObject(), to.getTimeZoneId()), CalendarHelper.getDate(end.getModelObject(), to.getTimeZoneId()), null);
                invitationLink = getInvitationLink(i, WebSession.get().getExtendedProperties().getBaseUrl());
                if (invitationLink == null) {
                    invitationLink = "";
                } else {
                    invitationLink = // 
                    "<br/>" + Application.getString("503", to.getLanguageId()) + "<br/><a href='" + invitationLink + "'>" + Application.getString("504", to.getLanguageId()) + "</a><br/>";
                }
            }
            String subj = p.getSubject() == null ? "" : p.getSubject();
            handler.send(to.getAddress().getEmail(), Application.getString("1301", to.getLanguageId()) + subj, (p.getMessage() == null ? "" : p.getMessage().replaceAll("\\<.*?>", "")) + aLinkHTML + invitationLink);
        }
    }
}
Also used : Appointment(org.apache.openmeetings.db.entity.calendar.Appointment) User(org.apache.openmeetings.db.entity.user.User) MeetingMember(org.apache.openmeetings.db.entity.calendar.MeetingMember) ArrayList(java.util.ArrayList) Invitation(org.apache.openmeetings.db.entity.room.Invitation) PrivateMessage(org.apache.openmeetings.db.entity.user.PrivateMessage) Room(org.apache.openmeetings.db.entity.room.Room) Date(java.util.Date)

Aggregations

User (org.apache.openmeetings.db.entity.user.User)101 GroupUser (org.apache.openmeetings.db.entity.user.GroupUser)29 Test (org.junit.Test)25 Date (java.util.Date)11 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)10 ArrayList (java.util.ArrayList)8 ServiceResult (org.apache.openmeetings.db.dto.basic.ServiceResult)8 OmException (org.apache.openmeetings.util.OmException)8 Path (javax.ws.rs.Path)7 MeetingMember (org.apache.openmeetings.db.entity.calendar.MeetingMember)7 Room (org.apache.openmeetings.db.entity.room.Room)7 AbstractJUnitDefaults.getUser (org.apache.openmeetings.AbstractJUnitDefaults.getUser)6 Client (org.apache.openmeetings.db.entity.basic.Client)6 Address (org.apache.openmeetings.db.entity.user.Address)5 Group (org.apache.openmeetings.db.entity.user.Group)5 GroupDao (org.apache.openmeetings.db.dao.user.GroupDao)4 AppointmentDTO (org.apache.openmeetings.db.dto.calendar.AppointmentDTO)4 OAuthUser (org.apache.openmeetings.db.dto.user.OAuthUser)4 Recording (org.apache.openmeetings.db.entity.record.Recording)4 AbstractJUnitDefaults.createUser (org.apache.openmeetings.AbstractJUnitDefaults.createUser)3