/** * Commits the edited project to the db.<p> */ @Override public void actionCommit() { List<Throwable> errors = new ArrayList<Throwable>(); try { if (isForAll()) { OpenCms.getSessionManager().sendBroadcast(getCms(), m_msgInfo.getMsg()); } else { List<String> ids = CmsStringUtil.splitAsList(getParamSessionids(), CmsHtmlList.ITEM_SEPARATOR); Iterator<String> itIds = ids.iterator(); while (itIds.hasNext()) { String id = itIds.next(); OpenCms.getSessionManager().sendBroadcast(getCms(), m_msgInfo.getMsg(), id); } } } catch (Throwable t) { errors.add(t); } // set the list of errors to display when saving failed setCommitErrors(errors); }
/** * Commits the edited project to the db.<p> */ @Override public void actionCommit() { List<Throwable> errors = new ArrayList<Throwable>(); if (getUsers().isEmpty()) { setCommitErrors( Collections.singletonList((Throwable)new CmsIllegalStateException( Messages.get().container(Messages.ERR_NO_SELECTED_USER_WITH_EMAIL_0)))); return; } try { Iterator<CmsUser> itUsers = getUsers().iterator(); while (itUsers.hasNext()) { CmsUser user = itUsers.next(); OpenCms.getSessionManager().sendBroadcast( getCms().getRequestContext().getCurrentUser(), m_msgInfo.getMsg(), user); } } catch (Throwable t) { errors.add(t); } // set the list of errors to display when saving failed setCommitErrors(errors); }
/** * Checks whether the workplace is accessed through the workplace server, and sends an error message otherwise.<p> * * @param request the request to check * @param cms the CmsObject to use */ public void checkWorkplaceRequest(HttpServletRequest request, CmsObject cms) { try { if ((OpenCms.getSiteManager().getSites().size() > 1) && !OpenCms.getSiteManager().isWorkplaceRequest(request)) { // this is a multi site-configuration, but not a request to the configured Workplace site CmsUser user = cms.getRequestContext().getCurrentUser(); // to limit the number of times broadcast is called for a user, we use an expiring cache // with the user name as key if (null == m_workplaceServerUserChecks.getIfPresent(user.getName())) { m_workplaceServerUserChecks.put(user.getName(), ""); OpenCms.getSessionManager().sendBroadcast( null, Messages.get().getBundle(getWorkplaceLocale(cms)).key( Messages.ERR_WORKPLACE_SERVER_CHECK_FAILED_0), user); } } } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } }
/** * Sends a message to the given user, if publish notification is enabled or an error is shown in the message.<p> * * @param toUserId the id of the user to send the message to * @param message the message to send * @param hasErrors flag to determine if the message to send shows an error */ protected void sendMessage(CmsUUID toUserId, String message, boolean hasErrors) { CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { CmsUser toUser = m_driverManager.readUser(dbc, toUserId); CmsUserSettings settings = new CmsUserSettings(toUser); if (settings.getShowPublishNotification() || hasErrors) { // only show message if publish notification is enabled or the message shows an error OpenCms.getSessionManager().sendBroadcast(null, message, toUser); } } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } finally { dbc.clear(); } }
/** * Sends a message to the given user, if publish notification is enabled or an error is shown in the message.<p> * * @param toUserId the id of the user to send the message to * @param message the message to send * @param hasErrors flag to determine if the message to send shows an error */ protected void sendMessage(CmsUUID toUserId, String message, boolean hasErrors) { CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { CmsUser toUser = m_driverManager.readUser(dbc, toUserId); CmsUserSettings settings = new CmsUserSettings(toUser); if (settings.getShowPublishNotification() || hasErrors) { // only show message if publish notification is enabled or the message shows an error OpenCms.getSessionManager().sendBroadcast(null, message, toUser); } } catch (CmsException e) { dbc.rollback(); LOG.error(e.getLocalizedMessage(), e); } finally { dbc.clear(); } }
if ((loginMessage != null) && loginMessage.isActive()) { OpenCms.getSessionManager().updateSessionInfo(getCmsObject(), getRequest()); OpenCms.getSessionManager().sendBroadcast(null, loginMessage.getMessage(), user);
OpenCms.getSessionManager().sendBroadcast( null, storedMessage,