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


Java User.getDisplayName方法代码示例

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


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

示例1: getUser

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public org.sakaiproject.kaltura.logic.User getUser(String userId) {
    org.sakaiproject.kaltura.logic.User user = null;
    if (userId != null) {
        User u = null;
        try {
            u = userDirectoryService.getUserByEid(userId);
        } catch (UserNotDefinedException e) {
            try {
                u = userDirectoryService.getUser(userId);
            } catch (UserNotDefinedException e1) {
                log.warn("Cannot get user for id: " + userId);
            }
        }
        if (u != null) {
            user = new org.sakaiproject.kaltura.logic.User(u.getId(),
                    u.getEid(), u.getDisplayName(), u.getSortName(), u.getEmail());
            user.fname = u.getFirstName();
            user.lname = u.getLastName();
        }
    }
    return user;
}
 
开发者ID:ITYug,项目名称:kaltura-ce-sakai-extension,代码行数:23,代码来源:SakaiExternalLogicImpl.java

示例2: 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

示例3: getSocialAlerts

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public List<BullhornAlert> getSocialAlerts(String userId) {

        List<BullhornAlert> alerts = sqlService.dbRead(ALERTS_SELECT_SQL
                , new Object[] { SOCIAL, userId }
                , new SqlReader() {
                        public Object readSqlResultRecord(ResultSet rs) {
                            return new BullhornAlert(rs);
                        }
                    }
                );

        for (BullhornAlert alert : alerts) {
            try {
                User fromUser = userDirectoryService.getUser(alert.from);
                alert.fromDisplayName = fromUser.getDisplayName();
            } catch (UserNotDefinedException unde) {
                alert.fromDisplayName = alert.from;
            }
        }

        return alerts;
    }
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:BullhornServiceImpl.java

示例4: getUserDisplayName

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
 * Gets the display name for a given user
 * <p/>
 * Differs from original above as that one uses the session to get the displayname hence you must know this in advance or be logged in to the web services
 * with that user. This uses a userid as well so we could be logged in as admin and retrieve the display name for any user.
 *
 * @param sessionid the id of a valid session
 * @param userid    the login username (ie jsmith26) of the user you want the display name for
 * @return the display name for the user
 * @throws RuntimeException
 */
@WebMethod
@Path("/getUserDisplayName")
@Produces("text/plain")
@GET
public String getUserDisplayName(
        @WebParam(name = "sessionid", partName = "sessionid") @QueryParam("sessionid") String sessionid,
        @WebParam(name = "userid", partName = "userid") @QueryParam("userid") String userid) {
    Session session = establishSession(sessionid);
    try {
        User user = userDirectoryService.getUserByEid(userid);
        return user.getDisplayName();
    } catch (Exception e) {
        log.error("WS getUserDisplayName() failed for user: " + userid + " : " + e.getClass().getName() + " : " + e.getMessage());
        return "";
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:28,代码来源:SakaiScript.java

示例5: getUserDisplayName

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public String getUserDisplayName(String userId) {
   try {
      User user = userDirectoryService.getUser(userId);
      return user.getDisplayName();
   } catch (UserNotDefinedException ex) {
      log.error("Could not get user from userId: " + userId, ex);
   }
   if (userId.startsWith(ANON_USER_PREFIX)) {
      return "Anonymous User";
   }
   return "----------";
}
 
开发者ID:sakaicontrib,项目名称:blogwow,代码行数:13,代码来源:ExternalLogicImpl.java

示例6: getCurrentUserDisplayName

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public String getCurrentUserDisplayName(){
User user = userDirectoryService.getCurrentUser();
if(user != null){
 return user.getDisplayName();
}

return "";
}
 
开发者ID:sakaicontrib,项目名称:blogwow,代码行数:9,代码来源:ExternalLogicImpl.java

示例7: getMessageOwnerDisplayName

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public String getMessageOwnerDisplayName(ChatMessage message)
{
   User sender = null;
   try {
      sender = UserDirectoryService.getUser(message.getOwner());
   } catch(UserNotDefinedException e) {
       // Expected some users will get deleted.
      log.debug("Failed to find user for ID: "+ message.getOwner(), e);
      return message.getOwner();
   }
   return sender.getDisplayName();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:13,代码来源:ChatTool.java

示例8: getUserNameForDisplay

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public String getUserNameForDisplay(User user) {
	if(isSortUsersByDisplayName()) {
		return user.getDisplayName();
	}else{
		return user.getSortName();
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:8,代码来源:StatsManagerImpl.java

示例9: getUserDisplayName

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
 * @see org.sakaiproject.mailsender.logic.ExternalLogic#getUserDisplayName(java.lang.String)
 */
public String getUserDisplayName(String userId)
{
	String name = "--------";
	User user = getUser(userId);
	if (user != null)
	{
		name = user.getDisplayName();
	}
	return name;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:14,代码来源:ExternalLogicImpl.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: getConfirmMessage

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public String getConfirmMessage() {
	try {
		User user = UserDirectoryService.getUserByEid(ownerId);
		String userInfo = user.getDisplayName() +  " (" + this.ownerId +  ")";
		confirmMessage = rb.getFormattedMessage("transfer_pool_confirm_owner", new String[] {userInfo});
		return confirmMessage;
	} catch(UserNotDefinedException e) {
		log.warn("Unable to get user by eid: " + ownerId);
		return "";
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:12,代码来源:QuestionPoolBean.java

示例12: GbUser

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public GbUser(final User u, String studentNumber) {
	this.userUuid = u.getId();
	this.displayId = u.getDisplayId();
	this.displayName = u.getDisplayName();
	this.firstName = u.getFirstName();
	this.lastName = u.getLastName();
	this.studentNumber = studentNumber;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:9,代码来源:GbUser.java

示例13: getUserDisplayNameForCurrentUser

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
 * Get a user's display name based on their session id
 *
 * @param sessionid the session id of the user who's display name you wish to retrieve
 * @return success or exception message
 * @throws RuntimeException
 */
@WebMethod
@Path("/getUserDisplayNameForCurrentUser")
@Produces("text/plain")
@GET
public String getUserDisplayNameForCurrentUser(
        @WebParam(name = "sessionid", partName = "sessionid") @QueryParam("sessionid") String sessionid) {
    Session session = establishSession(sessionid);
    User user = userDirectoryService.getCurrentUser();
    return user.getDisplayName();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:18,代码来源:SakaiScript.java

示例14: getOwner

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public String getOwner() {
	String owner = null;
	Set<AssignmentSubmissionSubmitter> submitters = ((AssignmentSubmission)getObject()).getSubmitters();
	for (AssignmentSubmissionSubmitter submitter : submitters) {
		try {
			User user = userDirectoryService.getUser(submitter.getSubmitter());
			owner =  owner != null ? owner + ", " + user.getDisplayName() : user.getDisplayName();
		} catch (UserNotDefinedException e) {
			log.warn("User not find for id: {}", submitter.getSubmitter());
			owner = submitter.getSubmitter();
		}
	}
	return owner;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:AssignmentItemImpl.java

示例15: sitePropertiesIntoState

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
 * %%% legacy properties, to be cleaned up
 * 
 */
private void sitePropertiesIntoState(SessionState state) {
	try {
		Site site = getStateSite(state);
		SiteInfo siteInfo = new SiteInfo();
		if (site != null)
		{
			ResourceProperties siteProperties = site.getProperties();
			// set from site attributes
			siteInfo.title = site.getTitle();
			siteInfo.description = site.getDescription();
			siteInfo.iconUrl = site.getIconUrl();
			siteInfo.infoUrl = site.getInfoUrl();
			siteInfo.joinable = site.isJoinable();
			siteInfo.joinerRole = site.getJoinerRole();
			siteInfo.published = site.isPublished();
			siteInfo.include = site.isPubView();
			siteInfo.short_description = site.getShortDescription();
			siteInfo.site_type = site.getType();
			// term information
			String term = siteProperties.getProperty(Site.PROP_SITE_TERM);
			if (term != null) {
				siteInfo.term = term;
			}
			
			// SAK-24423 - update site info for joinable site settings
			JoinableSiteSettings.updateSiteInfoFromSiteProperties( siteProperties, siteInfo );
			
			// site contact information
			String contactName = siteProperties.getProperty(Site.PROP_SITE_CONTACT_NAME);
			String contactEmail = siteProperties.getProperty(Site.PROP_SITE_CONTACT_EMAIL);
			if (contactName == null && contactEmail == null) {
				User u = site.getCreatedBy();
				if (u != null)
				{
					String email = u.getEmail();
					if (email != null) {
						contactEmail = u.getEmail();
					}
					contactName = u.getDisplayName();
				}
			}
			if (contactName != null) {
				siteInfo.site_contact_name = contactName;
			}
			if (contactEmail != null) {
				siteInfo.site_contact_email = contactEmail;
			}
			
			state.setAttribute(FORM_SITEINFO_ALIASES, getSiteReferenceAliasIds(site));
		}
		
		siteInfo.additional = "";
		state.setAttribute(STATE_SITE_TYPE, siteInfo.site_type);
		state.setAttribute(STATE_SITE_INFO, siteInfo);
		
		state.setAttribute(FORM_SITEINFO_URL_BASE, getSiteBaseUrl());
		
	} catch (Exception e) {
		log.error(this + ".sitePropertiesIntoState: " + e.getMessage(), e);
	}

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:67,代码来源:SiteAction.java


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