/** * Returns the "full" name of the given user in the format <code>"{firstname} {lastname} ({username})"</code>, * or the empty String <code>""</code> if the user is null.<p> * * @param user the user to get the full name from * @return the "full" name the user * * @see #getFullName() */ public static String getFullName(CmsUser user) { if (user == null) { return ""; } else { return user.getFullName(); } }
/** * Returns the "full" name of the given user in the format <code>"{firstname} {lastname} ({username})"</code>, * or the empty String <code>""</code> if the user is null.<p> * * @param user the user to get the full name from * @return the "full" name the user * * @see #getFullName() */ public static String getFullName(CmsUser user) { if (user == null) { return ""; } else { return user.getFullName(); } }
/** * Returns a semicolon separated list of user names.<p> * * @return a semicolon separated list of user names */ protected String getToNames() { StringBuffer result = new StringBuffer(256); Iterator<CmsUser> itUsers = getUsers().iterator(); while (itUsers.hasNext()) { CmsUser user = itUsers.next(); result.append(user.getFullName()); if (itUsers.hasNext()) { result.append("; "); } } return result.toString(); }
if (session != null) { try { String userName = getCms().readUser(session.getUserId()).getFullName(); if (!users.contains(userName)) { users.add(userName);
/** * Stores a value in this users "additional information" storage map with the given access key.<p> * * @param key the key to store the value under * @param value the value to store in the users "additional information" storage map * * @see #getAdditionalInfo() */ public void setAdditionalInfo(String key, Object value) { if (key == null) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_USER_ADDINFO_KEY_NULL_1, getFullName())); } m_additionalInfo.put(key, value); }
/** * @see org.opencms.workplace.list.A_CmsListDialog#getListItems() */ @Override protected List getListItems() throws CmsException { List ret = new ArrayList(); // get content List users = getUsers(); Iterator itUsers = users.iterator(); while (itUsers.hasNext()) { CmsUser user = (CmsUser)itUsers.next(); CmsListItem item = getList().newItem(user.getId().toString()); item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_FULLNAME, user.getFullName()); ret.add(item); } return ret; }
/** * @see org.opencms.security.CmsPrincipal#getDisplayName(org.opencms.file.CmsObject, java.util.Locale) */ @Override public String getDisplayName(CmsObject cms, Locale locale) throws CmsException { if (OpenCms.getOrgUnitManager().getOrganizationalUnits(cms, "", true).size() > 0) { return org.opencms.security.Messages.get().getBundle(locale).key( org.opencms.security.Messages.GUI_PRINCIPAL_DISPLAY_NAME_2, getFullName(), OpenCms.getOrgUnitManager().readOrganizationalUnit(cms, getOuFqn()).getDisplayName(locale)); } else { return getFullName(); } }
/** * @see org.opencms.security.CmsPrincipal#getDisplayName(org.opencms.file.CmsObject, java.util.Locale) */ @Override public String getDisplayName(CmsObject cms, Locale locale) throws CmsException { if (OpenCms.getOrgUnitManager().getOrganizationalUnits(cms, "", true).size() > 0) { return org.opencms.security.Messages.get().getBundle(locale).key( org.opencms.security.Messages.GUI_PRINCIPAL_DISPLAY_NAME_2, getFullName(), OpenCms.getOrgUnitManager().readOrganizationalUnit(cms, getOuFqn()).getDisplayName(locale)); } else { return getFullName(); } }
/** * Sets all needed data of the user into the list item object.<p> * * @param user the user to set the data for * @param item the list item object to set the data into */ protected void setUserData(CmsUser user, CmsListItem item) { item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_NAME, user.getFullName()); item.set(LIST_COLUMN_EMAIL, user.getEmail()); item.set(LIST_COLUMN_LASTLOGIN, new Date(user.getLastlogin())); }
/** * @see org.opencms.workplace.list.A_CmsListDialog#getListItems() */ @Override protected List<CmsListItem> getListItems() throws CmsException { List<CmsListItem> ret = new ArrayList<CmsListItem>(); // get content List<CmsUser> users = getUsers(); Iterator<CmsUser> itUsers = users.iterator(); while (itUsers.hasNext()) { CmsUser user = itUsers.next(); CmsListItem item = getList().newItem(user.getId().toString()); item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_NAME, user.getSimpleName()); item.set(LIST_COLUMN_ORGUNIT, CmsOrganizationalUnit.SEPARATOR + user.getOuFqn()); item.set(LIST_COLUMN_FULLNAME, user.getFullName()); ret.add(item); } return ret; }
/** * Sets all needed data of the user into the list item object.<p> * * @param user the user to set the data for * @param item the list item object to set the data into */ protected void setUserData(CmsUser user, CmsListItem item) { item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_DISPLAY, user.getSimpleName()); item.set(LIST_COLUMN_NAME, user.getFullName()); item.set(LIST_COLUMN_EMAIL, user.getEmail()); item.set(LIST_COLUMN_LASTLOGIN, new Date(user.getLastlogin())); item.set(LIST_COLUMN_ENABLED, new Boolean(user.isEnabled())); }
/** * Sets all needed data of the user into the list item object.<p> * * @param user the user to set the data for * @param item the list item object to set the data into */ protected void setUserData(CmsUser user, CmsListItem item) { item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_NAME, user.getSimpleName()); item.set(LIST_COLUMN_ORGUNIT, CmsOrganizationalUnit.SEPARATOR + user.getOuFqn()); item.set(LIST_COLUMN_FULLNAME, user.getFullName()); }
/** * Makes a list item from a user.<p> * * @param user the user * * @return the list item */ protected CmsListItem makeListItem(CmsUser user) { CmsListItem item = getList().newItem(user.getId().toString()); item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_FULLNAME, user.getFullName()); return item; }
/** * Initializes the message info object to work with depending on the dialog state and request parameters.<p> */ protected void initMessageObject() { try { if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) { // create a new message info object m_msgInfo = new CmsMessageInfo(); } else { // this is not the initial call, get the message info object from session m_msgInfo = (CmsMessageInfo)getDialogObject(); } } catch (Exception e) { // create a new message info object m_msgInfo = new CmsMessageInfo(); } m_msgInfo.setFrom(getCms().getRequestContext().getCurrentUser().getFullName()); m_msgInfo.setTo(getToNames()); }
/** * Initializes the message info object to work with depending on the dialog state and request parameters.<p> */ protected void initMessageObject() { try { if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) { // create a new message info object m_msgInfo = new CmsMessageInfo(); } else { // this is not the initial call, get the message info object from session m_msgInfo = (CmsMessageInfo)getDialogObject(); } } catch (Exception e) { // create a new message info object m_msgInfo = new CmsMessageInfo(); } m_msgInfo.setFrom(getCms().getRequestContext().getCurrentUser().getFullName()); m_msgInfo.setTo(getToNames()); }
/** * Initializes the message info object to work with depending on the dialog state and request parameters.<p> */ protected void initMessageObject() { Object o = null; try { // this is not the initial call, get the message info object from session o = getDialogObject(); m_msgInfo = (CmsMessageInfo)o; // test m_msgInfo.getTo(); } catch (Exception e) { // create a new message info object m_msgInfo = new CmsMessageInfo(); } m_msgInfo.setFrom(getCms().getRequestContext().getCurrentUser().getFullName()); m_msgInfo.setTo(getToNames()); }
/** * Makes a list item from a user.<p> * * @param user the user * * @return the list item */ protected CmsListItem makeUserItem(CmsUser user) { CmsListItem item = getList().newItem(user.getId().toString()); item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_NAME, user.getSimpleName()); item.set(LIST_COLUMN_ORGUNIT, CmsOrganizationalUnit.SEPARATOR + user.getOuFqn()); item.set(LIST_COLUMN_FULLNAME, user.getFullName()); return item; }
/** * @see org.opencms.gwt.shared.rpc.I_CmsCoreService#lockTempAndCheckModification(org.opencms.util.CmsUUID, long) */ public CmsLockInfo lockTempAndCheckModification(CmsUUID structureId, long modification) throws CmsRpcException { CmsObject cms = getCmsObject(); try { CmsResource resource = cms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION); if (resource.getDateLastModified() != modification) { CmsUser user = cms.readUser(resource.getUserLastModified()); return CmsLockInfo.forChangedResource(user.getFullName()); } } catch (Throwable e) { error(e); } try { return getLock(structureId); } catch (CmsException e) { return CmsLockInfo.forError(e.getLocalizedMessage()); } }
item.set(LIST_COLUMN_DESCRIPTION, ((CmsUser)principal).getDescription(getLocale())); } else { item.set(LIST_COLUMN_DESCRIPTION, ((CmsUser)principal).getFullName());
/** * Returns the lock information to the given resource.<p> * * @param resource the resource * * @return lock information, if the page is locked by another user * * @throws CmsException if something goes wrong reading the lock owner user */ private String getLockInfo(CmsResource resource) throws CmsException { CmsObject cms = getCmsObject(); CmsResourceUtil resourceUtil = new CmsResourceUtil(cms, resource); CmsLock lock = resourceUtil.getLock(); String lockInfo = null; if (!lock.isLockableBy(cms.getRequestContext().getCurrentUser())) { if (lock.getType() == CmsLockType.PUBLISH) { lockInfo = Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key( Messages.GUI_LOCKED_FOR_PUBLISH_0); } else { CmsUser lockOwner = cms.readUser(lock.getUserId()); lockInfo = Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key( Messages.GUI_LOCKED_BY_1, lockOwner.getFullName()); } } return lockInfo; }