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


Java User.getId方法代码示例

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


在下文中一共展示了User.getId方法的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: 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);
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:24,代码来源:EntityUser.java

示例4: getTimezoneToolUrlForUser

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public String getTimezoneToolUrlForUser() {
    User thisUser = UserDirectoryService.getCurrentUser();
    String userid = thisUser.getId();

    // If there is no user (e.g. on the gateway site!) there's no timezone
    if(StringUtils.isEmpty(userid)) {
        return null;
    }

    try {
        Site userSite = SiteService.getSite("~" + userid);
        ToolConfiguration preferences = userSite.getToolForCommonId("sakai.preferences");
        return String.format("/portal/site/~%s/tool/%s/timezone", userid, preferences.getId());
    } catch (Exception e) {
        log.warn("Couldn't find a timezone tool for user {}", userid, e);
        return null;
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:PASystemEntityProvider.java

示例5: lookupUser

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
 * Attempt to find a user, searches by EID, AID and email.
 *
 * @param search The search.
 * @return A user ID or <code>null</code> if none or multiple were found.
 */
public String lookupUser(String search) {
	User user = null;
	try {
		user = userDirectoryService.getUserByAid(search);
	} catch (UserNotDefinedException e) {
			if (search.contains("@")) {
				Collection<User> users = userDirectoryService.findUsersByEmail(search);
				Iterator<User> usersIterator = users.iterator();
				if (usersIterator.hasNext()) {
					user = usersIterator.next();
					if (usersIterator.hasNext()) {
						// Too many matches
						user = null;
					}
				}
			}

		}
	return (user == null)? null : user.getId();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:27,代码来源:SiteManageGroupSectionRoleHandler.java

示例6: getProfileImage

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
@EntityCustomAction(action = "details", viewKey = EntityView.VIEW_LIST)
public Object getProfileImage(OutputStream out, EntityView view, Map<String,Object> params) {

    JSONObject result = new JSONObject();

    result.put("status", "ERROR");

    User currentUser = UserDirectoryService.getCurrentUser();
    String currentUserId = currentUser.getId();

    if (currentUserId == null) {
        log.warn("Access denied");
        return result.toJSONString();
    }

    String imageUrl = imageLogic.getProfileImageEntityUrl(currentUserId, ProfileConstants.PROFILE_IMAGE_MAIN);

    result.put("url", imageUrl);
    result.put("isDefault", imageLogic.profileImageIsDefault(currentUserId));
    result.put("csrf_token", sessionManager.getCurrentSession().getAttribute("sakai.csrf.token"));
    result.put("status", "SUCCESS");

    return result.toJSONString();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:ProfileImageEntityProvider.java

示例7: remove

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
@EntityCustomAction(action = "remove", viewKey = EntityView.VIEW_NEW)
public String remove(EntityView view, Map<String, Object> params) {

    JSONObject result = new JSONObject();

    result.put("status", "ERROR");

    if (!checkCSRFToken(params)) {
        return result.toJSONString();
    }

    User currentUser = UserDirectoryService.getCurrentUser();
    String currentUserId = currentUser.getId();

    if (currentUserId == null) {
        log.warn("Access denied");
        return result.toJSONString();
    }

    if (imageLogic.resetProfileImage(currentUserId)) {
        profileImageService.resetCachedProfileImageId(currentUserId);
        result.put("status", "SUCCESS");
    }

    return result.toJSONString();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:27,代码来源:ProfileImageEntityProvider.java

示例8: 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;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:ExternalLogic.java

示例9: doAcknowledge

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
private String doAcknowledge(Acknowledger acknowledger, Map<String, Object> params) {
    JSONObject result = new JSONObject();

    result.put("status", "ERROR");

    if (!checkCSRFToken(params)) {
        return result.toJSONString();
    }

    User currentUser = UserDirectoryService.getCurrentUser();
    String uuid = (String) params.get("uuid");
    String acknowledgement = (String) params.get("acknowledgement");
    String userId = currentUser.getId();

    if (uuid == null || userId == null) {
        log.warn("Parameter mismatch: {}", params);
        return result.toJSONString();
    }

    if (acknowledgement == null) {
        acknowledger.acknowledge(uuid, userId);
    } else {
        acknowledger.acknowledge(uuid, userId, AcknowledgementType.of(acknowledgement));
    }
            
    result.put("status", "SUCCESS");

    return result.toJSONString();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:30,代码来源:PASystemEntityProvider.java

示例10: getUserIdForEidOrEmail

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
 * Gets the userId for a user, given an eid or an email address. 
 * We check if it matches the eid first, then if it matches an email address.
 * If nothing, return null.
 * 
 * @param value		the string to lookup, could be an eid or an email address
 * @return	the userId or null if User cannot be found
 */
public String getUserIdForEidOrEmail(String value) {
	User u = sakaiFacade.getUserByEid(value);
	if(u==null) {
		u=sakaiFacade.getUserByEmail(value);
	}
	
	if(u!=null) {
		return u.getId();
	}
	
	return null;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:21,代码来源:SignupUIBaseBean.java

示例11: 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			
		}
	}
	
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:SakaiFacadeImpl.java

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

示例13: getSiteOwner

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
/**
 * Special method
 * @return the owner data for the current site owner
 */
public Owner getSiteOwner() {
    Owner owner = null;
    if (this.site != null) {
        // TODO handle the contact info?
        User user = site.getCreatedBy();
        owner = new Owner(user.getId(), user.getDisplayName());
    } else {
        owner = new Owner(this.owner, this.owner);
    }
    return owner;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:16,代码来源:EntitySite.java

示例14: getSourceDID

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
public static String getSourceDID(User user, String placeStr, String placementSecret)
{
	if ( placementSecret == null ) return null;
	String suffix = ":::" + user.getId() + ":::" + placeStr;
	String base_string = placementSecret + suffix;
	String signature = LegacyShaUtil.sha256Hash(base_string);
	return signature + suffix;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:9,代码来源:SakaiBLTIUtil.java

示例15: getPopupsFooter

import org.sakaiproject.user.api.User; //导入方法依赖的package包/类
private String getPopupsFooter(Handlebars handlebars, Map<String, Object> context) {
    Session session = SessionManager.getCurrentSession();
    User currentUser = UserDirectoryService.getCurrentUser();

    if (currentUser == null || currentUser.getId() == null || "".equals(currentUser.getId())) {
        return "";
    }

    try {
        if (session.getAttribute(POPUP_SCREEN_SHOWN) == null) {
            Popup popup = new PopupForUser(currentUser).getPopup();
            if (popup.isActiveNow()) {
                context.put("popupTemplate", popup.getTemplate());
                context.put("popupUuid", popup.getUuid());
                context.put("popup", true);

                if (currentUser.getId() != null) {
                    // Delivered!
                    session.setAttribute(POPUP_SCREEN_SHOWN, "true");
                }
            }
        }


        Template template = handlebars.compile("templates/popup_footer");
        return template.apply(context);
    } catch (IOException | MissingUuidException e) {
        log.warn("IOException while getting popups footer", e);
        return "";
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:32,代码来源:PASystemImpl.java


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