本文整理汇总了Java中org.sakaiproject.user.api.User.getFirstName方法的典型用法代码示例。如果您正苦于以下问题:Java User.getFirstName方法的具体用法?Java User.getFirstName怎么用?Java User.getFirstName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sakaiproject.user.api.User
的用法示例。
在下文中一共展示了User.getFirstName方法的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;
}
示例2: getActiveInstructorIds
import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
private Set<String> getActiveInstructorIds(String INST_ROLE, Site site) {
log.debug("Getting active instructor IDs for permission " + INST_ROLE + " in site " + site.getId());
Set<String> instIds = site.getUsersIsAllowed(INST_ROLE);
//the site could contain references to deleted users
List<User> activeUsers = userDirectoryService.getUsers(instIds);
Set<String> ret = new HashSet<>();
for (int i = 0; i < activeUsers.size(); i++) {
User user = activeUsers.get(i);
// Ignore users who do not have a first and/or last name set or do not have
// a valid email address, as this will cause a TII API call to fail
if (user.getFirstName() != null && !user.getFirstName().trim().isEmpty() &&
user.getLastName() != null && !user.getLastName().trim().isEmpty() &&
getEmail(user) != null) {
ret.add(user.getId());
}
}
return ret;
}
示例3: getUser
import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
* Get a user by their unique id
* @param userId user id
* @return the populated User or null if none found
*/
public org.sakaiproject.gradebook.entity.User getUser(String userId) {
org.sakaiproject.gradebook.entity.User user = null;
User u = null;
try {
u = userDirectoryService.getUser(userId);
} catch (UserNotDefinedException e) {
try {
u = userDirectoryService.getUserByEid(userId);
} catch (UserNotDefinedException e1) {
log.warn("Cannot get user for id: " + userId);
}
}
if (u != null) {
user = new org.sakaiproject.gradebook.entity.User(u.getId(),
u.getEid(), u.getDisplayName(), u.getSortName(), u.getEmail());
user.fname = u.getFirstName();
user.lname = u.getLastName();
}
return user;
}
示例4: getUserName
import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
private String getUserName(String userId) {
String userName="";
try
{
User user=UserDirectoryService.getUser(userId) ;
if (ServerConfigurationService.getBoolean("msg.displayEid", true)) {
if(user != null) {
userName= user.getLastName() + ", " + user.getFirstName() + " (" + user.getDisplayId() + ")" ;
}
} else {
if(user != null) {
userName = user.getLastName() + ", " + user.getFirstName();
}
}
}
catch (UserNotDefinedException e) {
log.error(e.getMessage(), e);
}
return userName;
}
示例5: getAllPossbileCoordinatorsOnFastTrack
import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public List<SignupUser> getAllPossbileCoordinatorsOnFastTrack(SignupMeeting meeting) {
List<SignupUser> coordinators = new ArrayList<SignupUser>();
List<SignupSite> signupSites = meeting.getSignupSites();
Set<String> userIdsHasPermissionToCreate = new HashSet<String>();
if (signupSites != null) {
for (SignupSite site: signupSites) {
//Only thing we miss here is that the view permission is not checked. the Chance is very small.
userIdsHasPermissionToCreate.addAll(getUserIdsHasPermissionToCreate(site));
}
}
List<User> sakaiUsers = userDirectoryService.getUsers(userIdsHasPermissionToCreate);
for (User user : sakaiUsers) {
SignupUser signupUser = new SignupUser(user.getEid(), user.getId(), user.getFirstName(), user.getLastName(),
null, "", true);
coordinators.add(signupUser);
}
return coordinators;
}
示例6: getActiveInstructorIds
import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
private Set<String> getActiveInstructorIds(String INST_ROLE, Site site) {
log.debug("Getting active instructor IDs for permission " + INST_ROLE + " in site " + site.getId());
Set<String> instIds = site.getUsersIsAllowed(INST_ROLE);
// the site could contain references to deleted users
List<User> activeUsers = userDirectoryService.getUsers(instIds);
Set<String> ret = new HashSet<String>();
for (int i = 0; i < activeUsers.size(); i++) {
User user = activeUsers.get(i);
// Ignore users who do not have a first and/or last name set or do
// not have
// a valid email address, as this will cause a TII API call to fail
if (user.getFirstName() != null && !user.getFirstName().trim().isEmpty() && user.getLastName() != null
&& !user.getLastName().trim().isEmpty() && getEmail(user) != null) {
ret.add(user.getId());
}
}
return ret;
}
示例7: EntityUser
import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
* Construct an EntityUser from a legacy user object
* @param user a legacy user or user edit
*/
public EntityUser(User user) {
this.user = user;
this.id = user.getId();
this.eid = user.getEid();
this.email = user.getEmail();
this.firstName = user.getFirstName();
this.lastName = user.getLastName();
this.displayName = user.getDisplayName();
this.displayId = user.getDisplayId();
this.owner = user.getCreatedBy() == null ? null : "/user/" + user.getCreatedBy().getId();
this.lastModified = user.getModifiedTime() == null ? System.currentTimeMillis() : user.getModifiedTime().getTime();
this.type = user.getType();
ResourceProperties rp = user.getProperties();
for (Iterator<String> iterator = rp.getPropertyNames(); iterator.hasNext();) {
String name = iterator.next();
String value = rp.getProperty(name);
this.setProperty(name, value);
}
}
示例8: 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 );
}
示例9: 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);
}
示例10: getDisplayName
import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public String getDisplayName(User user) {
if (!UNADVISED_USER_EID.equals(user.getEid())) {
return user.getFirstName() + " " + user.getLastName() + DISPLAY_ADVISED_SUFFIX;
} else {
return null;
}
}
示例11: getUserDisplayName
import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public String getUserDisplayName(User user, String contextReference) {
if (contextualSiteUid.equals(contextReference)) {
if (!NOT_IN_SITE_USER_EID.equals(user.getEid())) {
return user.getFirstName() + " " + user.getLastName() + CONTEXTUAL_SITE_NAME;
}
}
return null;
}
示例12: getCurrentUserFields
import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
protected Map<String, String> getCurrentUserFields() {
Map<String, String> rv = new HashMap<>();
String userRef = developerHelperService.getCurrentUserReference();
if (userRef != null) {
User user = (User) developerHelperService.fetchEntity(userRef);
try {
String email = user.getEmail();
if (email == null)
email = "";
String first = user.getFirstName();
if (first == null)
first = "";
String last = user.getLastName();
if (last == null)
last ="";
rv.put(CURRENT_USER_EMAIL, email);
rv.put(CURRENT_USER_FIRST_NAME, first);
rv.put(CURRENT_USER_LAST_NAME, last);
rv.put(CURRENT_USER_DISPLAY_NAME, user.getDisplayName());
rv.put(CURRENT_USER_DISPLAY_ID, user.getDisplayId());
rv.put("currentUserDispalyId", user.getDisplayId());
} catch (Exception e) {
log.warn("Failed to get current user replacements: " + userRef, e);
}
}
/*NoN user fields */
rv.put(LOCAL_SAKAI_NAME, serverConfigurationService.getString("ui.service", "Sakai"));
rv.put(LOCAL_SAKAI_SUPPORT_MAIL,serverConfigurationService.getString("mail.support", "[email protected]"+ serverConfigurationService.getServerName()));
rv.put(LOCAL_SAKAI_URL,serverConfigurationService.getServerUrl());
return rv;
}
示例13: getSignupUserForLoginRequiredOnlySite
import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
private SignupUser getSignupUserForLoginRequiredOnlySite(SignupSite signupSite, String userId){
SignupUser signupUser=null;
Site site=null;
try {
site = siteService.getSite(signupSite.getSiteId());
} catch (IdUnusedException e) {
log.error(e.getMessage(), e);
}
if (site == null)
return null;
Set siteRoles = site.getRoles();
if(siteRoles !=null){
for (Iterator iter = siteRoles.iterator(); iter.hasNext();) {
Role role = (Role) iter.next();
if(REALM_ID_FOR_LOGIN_REQUIRED_ONLY.equals(role.getId())){
if(hasPermissionToAttend(signupSite,userId)){
User user = getUser(userId);
if(user !=null)
signupUser = new SignupUser(user.getEid(), userId, user.getFirstName(), user.getLastName(),
role, site.getId(), site.isPublished());
break;
}
}
}
}
return signupUser;
}
示例14: addAndPopulateSignupUsersInfo
import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
private void addAndPopulateSignupUsersInfo(Set<SignupUser> signupUsers, Map<String,Role> memberRoleMap, List<String> userIds, Site site){
//it should filter out non-existing userIds
List<User> sakaiUsers = userDirectoryService.getUsers(userIds);
if(sakaiUsers !=null){
for (User user : sakaiUsers) {
SignupUser signupUser = new SignupUser(user.getEid(), user.getId(), user.getFirstName(), user.getLastName(),
memberRoleMap.get(user.getId()), site.getId(), site.isPublished());
processAddOrUpdateSignupUsers(signupUsers, signupUser);
// comment: member.getUserDisplayId() not used
}
}
}
示例15: GbStudentGradeInfo
import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public GbStudentGradeInfo(final User u, final String studentNumber) {
this.studentUuid = u.getId();
this.studentEid = u.getEid();
this.studentFirstName = u.getFirstName();
this.studentLastName = u.getLastName();
this.studentDisplayName = u.getDisplayName();
this.studentNumber = studentNumber;
this.grades = new HashMap<>();
this.categoryAverages = new HashMap<>();
}