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