当前位置: 首页>>代码示例>>Java>>正文


Java User.getDisplayId方法代码示例

本文整理汇总了Java中org.sakaiproject.user.api.User.getDisplayId方法的典型用法代码示例。如果您正苦于以下问题:Java User.getDisplayId方法的具体用法?Java User.getDisplayId怎么用?Java User.getDisplayId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.sakaiproject.user.api.User的用法示例。


在下文中一共展示了User.getDisplayId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getEvalUsersByIds

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public Map<String, EvalUser> getEvalUsersByIds(String[] userIds) {
    Map<String, EvalUser> users = new HashMap<>();
    boolean foundAll = false;
    if (userIds == null 
            || userIds.length == 0) {
        foundAll = true;
    }

    if (! foundAll) {
        // get remaining users from Sakai
        Map<String, User> sakaiUsers = getSakaiUsers(userIds);
        for (Entry<String, User> entry : sakaiUsers.entrySet()) {
            String userId = entry.getKey();
            User sakaiUser = entry.getValue();
            EvalUser user = new EvalUser(sakaiUser.getId(), EvalConstants.USER_TYPE_EXTERNAL,
                    sakaiUser.getEmail(), sakaiUser.getEid(), sakaiUser.getDisplayName(), sakaiUser.getSortName(), sakaiUser.getDisplayId());
            users.put(userId, user);
        }
    }
    return users;
}
 
开发者ID:sakaicontrib,项目名称:evaluation,代码行数:22,代码来源:EvalExternalLogicImpl.java

示例2: notifyCourseRequestRequester

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public void notifyCourseRequestRequester(String requestEmail, String supportEmailContent, String termTitle)
{
	User currentUser = userDirectoryService.getCurrentUser();
	String currentUserDisplayName = currentUser!=null?currentUser.getDisplayName():"";
	String currentUserDisplayId = currentUser!=null?currentUser.getDisplayId():"";
	String currentUserEmail = currentUser!=null?currentUser.getEmail():"";
	
	String from = requestEmail;
	String to = currentUserEmail;
	String headerTo = to;
	String replyTo = to;
	Map<String, String> replacementValues = new HashMap<>();
	replacementValues.put("currentUserDisplayName", currentUserDisplayName);
	replacementValues.put("currentUserDisplayId", currentUserDisplayId);
	replacementValues.put("currentUserEmail", currentUserEmail);
	replacementValues.put("termTitle", termTitle);
	replacementValues.put("supportEmailContent", supportEmailContent);
	replacementValues.put("requestEmail", requestEmail);
	
	emailTemplateServiceSend(NOTIFY_COURSE_REQUEST_REQUESTER, (new ResourceLoader()).getLocale(), currentUser, from, to, headerTo, replyTo, replacementValues);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:ETSUserNotificationProviderImpl.java

示例3: getUserName

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public String getUserName() {
   String userId=SessionManager.getCurrentSessionUserId();
   try
   {
     User user=UserDirectoryService.getUser(userId) ;
     if (ServerConfigurationService.getBoolean("msg.displayEid", true))
     {
    	 userName= user.getDisplayName() + " (" + user.getDisplayId() + ")";
     }
     else {
    	 userName= user.getDisplayName();
     }   
   }
   catch (UserNotDefinedException e) {
       log.error(e.getMessage(), e);
}
   return userName;
  }
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:PrivateMessagesTool.java

示例4: getImpersonatorDisplayId

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
 * Checks if current user is being impersonated (via become user/sutool) and returns displayId of
 * the impersonator. Adapted from SkinnableLogin's isImpersonating()
 * @return displayId of impersonator, or empty string if not being impersonated
 */
private String getImpersonatorDisplayId()
{
	Session currentSession = SessionManager.getCurrentSession();
	UsageSession originalSession = (UsageSession) currentSession.getAttribute(UsageSessionService.USAGE_SESSION_KEY);
	
	if (originalSession != null)
	{
		String originalUserId = originalSession.getUserId();
		if (!StringUtils.equals(currentSession.getUserId(), originalUserId))
		{
			try
			{
				User originalUser = UserDirectoryService.getUser(originalUserId);
				return originalUser.getDisplayId();
			}
			catch (UserNotDefinedException e)
			{
				log.debug("Unable to retrieve user for id: {}", originalUserId);
			}
		}
	}
	
	return "";
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:30,代码来源:SkinnableCharonPortal.java

示例5: SimpleChatMessage

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public SimpleChatMessage(ChatMessage msg)
{
	this.id = msg.getId();
	this.owner = msg.getOwner();
	this.body = msg.getBody();
	this.messageDate = msg.getMessageDate();
	this.chatChannelId = msg.getChatChannel().getId();
	this.context = msg.getChatChannel().getContext();
	
	try {
		User msgowner = userDirectoryService.getUser(this.owner);
		this.ownerDisplayId = msgowner.getDisplayId();
		this.ownerDisplayName = msgowner.getDisplayName();
	} catch (UserNotDefinedException e) {
		// user not found - ignore
	}
	
	removeable = chatManager.getCanDelete(msg);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:20,代码来源:ChatMessageEntityProvider.java

示例6: getUserSortNameById

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
  * 
  * @param id
  * @return
  */
 public String getUserSortNameById(String id){    
   try
   {
     User user=UserDirectoryService.getUser(id) ;
     if (ServerConfigurationService.getBoolean("msg.displayEid", true))
     {
   	  userName= user.getSortName() + " (" + user.getDisplayId() + ")";
     }
     else
     {
   	  userName= user.getSortName();
     }
   }
   catch (UserNotDefinedException e) {
	log.error(e.getMessage(), e);
}
   return userName;
 }
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:24,代码来源:PrivateMessagesTool.java

示例7: getEvalUserById

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public EvalUser getEvalUserById(String userId) {
    EvalUser user = makeInvalidUser(userId, null);
    if (isUserAnonymous(userId)) {
        user = makeAnonymousUser(userId);
    } else {
        try {
            User sakaiUser = userDirectoryService.getUser(userId);
            user = new EvalUser(userId, EvalConstants.USER_TYPE_EXTERNAL,
                    sakaiUser.getEmail(), sakaiUser.getEid(), sakaiUser.getDisplayName(), sakaiUser.getSortName(), sakaiUser.getDisplayId());
        } catch(UserNotDefinedException ex) {
            LOG.debug("Sakai could not get user from userId: " + userId, ex);
        }
    }
    return user;
}
 
开发者ID:sakaicontrib,项目名称:evaluation,代码行数:16,代码来源:EvalExternalLogicImpl.java

示例8: getEvalUserByEmail

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public EvalUser getEvalUserByEmail(String email) {
    EvalUser user = makeInvalidUser(null, email);
    Collection<User> sakaiUsers = userDirectoryService.findUsersByEmail(email);
    if (sakaiUsers.size() > 0) {
        User sakaiUser = sakaiUsers.iterator().next(); // just get the first one
        user = new EvalUser(sakaiUser.getId(), EvalConstants.USER_TYPE_EXTERNAL,
                sakaiUser.getEmail(), sakaiUser.getEid(), sakaiUser.getDisplayName(), sakaiUser.getSortName(), sakaiUser.getDisplayId());
    }
    return user;
}
 
开发者ID:sakaicontrib,项目名称:evaluation,代码行数:11,代码来源:EvalExternalLogicImpl.java

示例9: notifyTemplateUse

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void notifyTemplateUse(Site templateSite, User currentUser, Site site) {
	// send an email to track who are using the template
	String from = getSetupRequestEmailAddress();
	// send it to the email archive of the template site
	// TODO: need a better way to get the email archive address
	//String domain = from.substring(from.indexOf('@'));
	String templateEmailArchive = templateSite.getId() 
		+ "@" + serverConfigurationService.getServerName();
	String to = templateEmailArchive;
	String headerTo = templateEmailArchive;
	String replyTo = templateEmailArchive;
	String message_subject = templateSite.getId() + ": copied by " + currentUser.getDisplayId ();					

	if (from != null && templateEmailArchive != null) {
		StringBuffer buf = new StringBuffer();
		buf.setLength(0);

		// email body
		buf.append("Dear template maintainer,\n\n");
		buf.append("Congratulations!\n\n");
		buf.append("The following user just created a new site based on your template.\n\n");
		buf.append("Template name: " + templateSite.getTitle() + "\n");
		buf.append("User         : " + currentUser.getDisplayName() + " (" 
				+ currentUser.getDisplayId () + ")\n");
		buf.append("Date         : " + new java.util.Date() + "\n");
		buf.append("New site Id  : " + site.getId() + "\n");
		buf.append("New site name: " + site.getTitle() + "\n\n");
		buf.append("Cheers,\n");
		buf.append("Alliance Team\n");
		String content = buf.toString();
		
		emailService.send(from, to, message_subject, content, headerTo, replyTo, null);
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:38,代码来源:UserNotificationProviderImpl.java

示例10: notifyCourseRequestRequester

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void notifyCourseRequestRequester(String requestEmail, String supportEmailContent, String termTitle)
{
	User currentUser = userDirectoryService.getCurrentUser();
	String currentUserDisplayName = currentUser!=null?currentUser.getDisplayName():"";
	String currentUserDisplayId = currentUser!=null?currentUser.getDisplayId():"";
	String currentUserId = currentUser!=null?currentUser.getId():"";
	String currentUserEmail = currentUser!=null?currentUser.getEmail():"";
	

	ResourceLoader rb = new ResourceLoader(currentUserId, "UserNotificationProvider");
	
	String from = requestEmail;
	String to = currentUserEmail;
	String headerTo = to;
	String replyTo = to;
	// message subject
	String message_subject = rb.getString("java.sitereqfrom") + " " + currentUserDisplayName + " " + rb.getString("java.for") + " " + termTitle;
	
	StringBuffer buf = new StringBuffer();
	buf.append(rb.getString("java.isbeing") + " ");
	buf.append(rb.getString("java.meantime") + "\n\n");
	buf.append(rb.getString("java.copy") + "\n\n");
	buf.append(supportEmailContent);
	buf.append("\n" + rb.getString("java.wish") + " " + requestEmail);
	emailService.send(from, to, message_subject, buf.toString(), headerTo, replyTo, null);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:30,代码来源:UserNotificationProviderImpl.java

示例11: notifyCourseRequestAuthorizer

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public boolean notifyCourseRequestAuthorizer(String instructorId, String requestEmail, String replyToEmail, String termTitle, String requestSectionInfo, String siteTitle, String siteId, String additionalInfo, String serverName)
{
	try {
		User instructor = userDirectoryService.getUserByEid(instructorId);
		String to = instructor.getEmail();	
		String from = requestEmail;
		String headerTo = to;
		String replyTo = replyToEmail;
		User currentUser = userDirectoryService.getCurrentUser();
		String currentUserDisplayName = currentUser!=null?currentUser.getDisplayName():"";
		String currentUserDisplayId = currentUser!=null?currentUser.getDisplayId():"";
		
		
		Map<String, String> replacementValues = new HashMap<>();
		replacementValues.put("currentUserDisplayName", currentUserDisplayName);
		replacementValues.put("currentUserDisplayId", currentUserDisplayId);
		replacementValues.put("termTitle", termTitle);
		replacementValues.put("requestSectionInfo", requestSectionInfo);
		replacementValues.put("siteTitle", siteTitle);
		replacementValues.put("siteId", siteId);
		replacementValues.put("specialInstruction", additionalInfo);
		replacementValues.put("serverName", serverName);
		
		return emailTemplateServiceSend(NOTITY_COURSE_REQUEST_AUTHORIZER, null, instructor, from, to, headerTo, replyTo, replacementValues) != null;
		
	}
	catch (Exception e)
	{
		log.warn(this + " cannot find user " + instructorId, e);
		return false;
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:33,代码来源:ETSUserNotificationProviderImpl.java

示例12: compare

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public int compare(User user1, User user2)
{
    String displayName1 = user1.getLastName() + ", " + user1.getFirstName() + " ("
            + user1.getDisplayId() + ")";
    String displayName2 = user2.getLastName() + ", " + user2.getFirstName() + " ("
            + user2.getDisplayId() + ")";
    return displayName1.compareTo( displayName2 );
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:9,代码来源:SiteManageGroupSectionRoleHandler.java

示例13: getDisplayId

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
 * Access the user display id, if we can find it - fall back to the id
 * if not.
 * 
 * @return The user display id.
 */
public String getDisplayId() {
	try {
		User user = UserDirectoryService.getUser(uniqname);
		return user.getDisplayId();
	} catch (UserNotDefinedException e) {
		return uniqname;
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:Participant.java

示例14: compare

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public int compare(User user1, User user2)
{
	String displayName1 = user1.getLastName() + ", " + user1.getFirstName() + " ("
			+ user1.getDisplayId() + ")";
	String displayName2 = user2.getLastName() + ", " + user2.getFirstName() + " ("
			+ user2.getDisplayId() + ")";
	return collator.compare(displayName1, displayName2);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:9,代码来源:ComposeLogicImpl.java

示例15: getUserDisplayId

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
 * @inheritDoc
 */
public String getUserDisplayId()
{
	try
	{
		User user = userDirectoryService.getUser(userId);
		return user.getDisplayId();
	}
	catch (UserNotDefinedException e)
	{
		return userId;
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:16,代码来源:BaseMember.java


注:本文中的org.sakaiproject.user.api.User.getDisplayId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。