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


Java UserNotDefinedException类代码示例

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


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

示例1: getUser

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的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: isUserAnonymous

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的package包/类
public boolean isUserAnonymous(String userId) {
    String currentUserId = sessionManager.getCurrentSessionUserId();
    if (userId.equals(currentUserId)) {
        return false;
    }
    Session session = sessionManager.getCurrentSession();
    String sessionUserId = (String) session.getAttribute(ANON_USER_ATTRIBUTE);
    if (userId.equals(sessionUserId)) {
        return true;
    }
    // used up both cheap tests, now try the costly one
    try {
        userDirectoryService.getUser(userId);
    } catch (UserNotDefinedException e) {
        return true;
    }
    return false;
}
 
开发者ID:sakaicontrib,项目名称:evaluation,代码行数:19,代码来源:EvalExternalLogicImpl.java

示例3: getAttendeeEmail

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的package包/类
/**
 * @return the attendeeEmail
 */
public String getAttendeeEmail() {
	
	try
	{
		String userId= getSignupAttendee().getAttendeeUserId();
		User u = UserDirectoryService.getUser(userId);
		attendeeEmail = u.getEmail();
		if ((attendeeEmail != null) && (attendeeEmail.trim().length()) == 0) attendeeEmail = null;			
	}
	catch (UserNotDefinedException e)
	{
		attendeeEmail=null;
	}
	return attendeeEmail;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:AttendeeWrapper.java

示例4: lookupUser

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的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

示例5: BaseMessageHeaderEdit

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的package包/类
/**
 * Construct. Time and From set automatically.
 * 
 * @param id
 *        The message id.
 */
public BaseMessageHeaderEdit(Message msg, String id)
{
	m_message = msg;
	m_id = id;
	m_message_order=0;
	m_date = m_timeService.newTime();
	try
	{
		m_from = m_userDirectoryService.getUser(m_sessionManager.getCurrentSessionUserId());
	}
	catch (UserNotDefinedException e)
	{
		m_from = m_userDirectoryService.getAnonymousUser();
	}

	// init the AttachmentContainer
	m_attachments = m_entityManager.newReferenceList();

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

示例6: createNewSubmission

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的package包/类
private AssignmentSubmission createNewSubmission(String context, String submitterId) throws UserNotDefinedException, IdUnusedException {
    Assignment assignment = createNewAssignment(context);
    String assignmentReference = AssignmentReferenceReckoner.reckoner().assignment(assignment).reckon().getReference();
    Site site = mock(Site.class);
    when(site.getGroup(submitterId)).thenReturn(mock(Group.class));
    when(site.getMember(submitterId)).thenReturn(mock(Member.class));
    when(siteService.getSite(context)).thenReturn(site);
    when(securityService.unlock(AssignmentServiceConstants.SECURE_ADD_ASSIGNMENT_SUBMISSION, assignmentReference)).thenReturn(true);
    AssignmentSubmission submission = null;
    try {
        submission = assignmentService.addSubmission(assignment.getId(), submitterId);
    } catch (PermissionException e) {
        Assert.fail(e.getMessage());
    }
    return submission;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:17,代码来源:AssignmentServiceTest.java

示例7: setUp

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    provider = new UserEntityProvider();
    provider.setDeveloperHelperService(developerHelperService);
    provider.setServerConfigurationService(serverConfigurationService);
    provider.setUserDirectoryService(userDirectoryService);
    provider.setSiteService(siteService);

    // Setup the 2 users.
    when(user.getId()).thenReturn("1");
    when(admin.getId()).thenReturn("admin");
    when(user.getCreatedBy()).thenReturn(admin);
    when(user.getProperties()).thenReturn(new BaseResourceProperties());

    when(userDirectoryService.getUserByAid(any())).thenThrow(UserNotDefinedException.class);
    when(userDirectoryService.getUser("1")).thenReturn(user);
    when(userDirectoryService.getUser("admin")).thenReturn(admin);

    when(siteService.getSite("~admin")).thenReturn(adminSite);
    when(siteService.getUserSiteId("admin")).thenReturn("~admin");

    when(siteService.getSite("~1")).thenReturn(userSite);
    when(siteService.getUserSiteId("1")).thenReturn("~1");
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:UserEntityProviderRestrictedViewTest.java

示例8: addServiceMocks

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的package包/类
@Override
protected void addServiceMocks(AbstractWebService service) {
	Session mockSession = mock(Session.class);
	when(service.sessionManager.getSession(SESSION_ID)).thenReturn(mockSession);
	
	try
	{
		when(service.userDirectoryService.getUserId(MOCK_USER)).thenReturn(MOCK_USER);
	}
	catch (UserNotDefinedException e)
	{
		
	}
	
	when(service.questionPoolServiceImpl.getUserPoolAttachmentReport(MOCK_USER, MOCK_POOL_ID, MOCK_CONTEXT_TO_REPLACE)).thenReturn("report");
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:17,代码来源:TestsAndQuizzesPoolAttachmentReportTest.java

示例9: getStatementForGrade

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的package包/类
private LRS_Statement getStatementForGrade(String studentUid, String forumTitle, double score)
        throws UserNotDefinedException {
	LRS_Actor instructor = learningResourceStoreService.getActor(SessionManager.getCurrentSessionUserId());
    LRS_Verb verb = new LRS_Verb(SAKAI_VERB.scored);
    LRS_Object lrsObject = new LRS_Object(ServerConfigurationService.getPortalUrl() + "/forums", "received-grade-forum");
    HashMap<String, String> nameMap = new HashMap<String, String>();
    nameMap.put("en-US", "User received a grade");
    lrsObject.setActivityName(nameMap);
    HashMap<String, String> descMap = new HashMap<String, String>();
    descMap.put("en-US", "User received a grade for their forum post: " + forumTitle);
    lrsObject.setDescription(descMap);
    User studentUser = UserDirectoryService.getUser(studentUid);
    LRS_Actor student = learningResourceStoreService.getActor(studentUser.getId());
    student.setName(studentUser.getDisplayName());
    LRS_Statement statement = new LRS_Statement(student, verb, lrsObject, getLRS_Result(score), null);
    return statement;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:18,代码来源:DiscussionForumTool.java

示例10: compileUsers

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的package包/类
/**
 * Compile a list of users based on user IDs. Does not include the current user.
 * 
 * @param users
 * @param userIds
 */
private void compileUsers(ArrayList<User> users, Set<String> userIds)
{
	for (String userId : userIds)
	{
		try
		{
			users.add(userDirectoryService.getUser(userId));
		}
		catch (UserNotDefinedException e)
		{
			log.warn("Unable to retrieve user: " + userId);
		}
	}
	Collections.sort(users, new UserComparator());
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:ComposeLogicImpl.java

示例11: getImpersonatorDisplayId

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的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

示例12: getSocialAlerts

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的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

示例13: doEdit_user

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的package包/类
/**
 * Edit an existing user ability grant.
 */
public void doEdit_user(RunData data, Context context)
{
	SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid());

	// read the form - if rejected, leave things as they are
	if (!readRealmForm(data, state)) return;

	String id = data.getParameters().getString("target");
	try
	{
		User user = userDirectoryService.getUser(id);
		state.setAttribute("user", user);
		state.setAttribute("mode", "editUser");
	}
	catch (UserNotDefinedException e)
	{
	 	log.warn("user not found: {}", id);
		addAlert(state, rb.getString("realm.user.notfound"));
	}

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

示例14: getAdditionalRoles

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的package包/类
public Set<String> getAdditionalRoles(String userId) {
	if (userId != null) {
		try {
			User user = userDirectoryService.getUser(userId);
			String status = (String) user.getProperties().get(statusAttribute);
			if (status != null && status.length() > 0) {
				Set<String> roles = statusRoles.get(status);
				if (roles != null) {
					return roles;
				}
			}
		} catch (UserNotDefinedException e) {
			// This really shouldn't happen as this should only be called for known users
			log.warn("User couldn't be loaded to find additional roles: "+ userId, e);
		}
	}
	return Collections.emptySet();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:UserAttributeRoleProvider.java

示例15: getStatementForGradedAssessment

import org.sakaiproject.user.api.UserNotDefinedException; //导入依赖的package包/类
public static LRS_Statement getStatementForGradedAssessment(AssessmentGradingData gradingData, PublishedAssessmentFacade publishedAssessment) {
       LRS_Verb verb = new LRS_Verb(SAKAI_VERB.scored);
       LRS_Object lrsObject = new LRS_Object(serverConfigurationService.getPortalUrl() + "/assessment", "received-grade-assessment");
       HashMap<String, String> nameMap = new HashMap<>();
       nameMap.put("en-US", "User received a grade");
       lrsObject.setActivityName(nameMap);
       HashMap<String, String> descMap = new HashMap<>();
       String userId = gradingData.getAgentId();
       String userIdLabel = "User Id";
       try {
       	userId = userDirectoryService.getUserEid(gradingData.getAgentId());
       	userIdLabel = "User Eid";
       } catch (UserNotDefinedException e) {
       	//This is fine as userId is set by default
       }
      
       descMap.put("en-US", "User received a grade for their assessment: " + publishedAssessment.getTitle() +
       		"; " + userIdLabel + ": " + userId + 
       		"; Release To: "+ AgentFacade.getCurrentSiteId() + 
       		"; Submitted: " + (gradingData.getIsLate() ? "late" : "on time"));
       lrsObject.setDescription(descMap);
       LRS_Statement statement = new LRS_Statement(null, verb, lrsObject, getLRS_Result(gradingData, publishedAssessment), null);
       return statement;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:SamigoLRSStatements.java


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