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


Java IdNotFoundException类代码示例

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


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

示例1: constructManualAddTitle

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
private String constructManualAddTitle(SessionState state)
{
	String title = "";
	List providerCourseList = (List) state.getAttribute(STATE_ADD_CLASS_PROVIDER_CHOSEN);
	List multiCourseInputs = (List) state.getAttribute(STATE_MANUAL_ADD_COURSE_FIELDS);
	AcademicSession t = (AcademicSession) state.getAttribute(STATE_TERM_SELECTED);
	if ((providerCourseList == null || providerCourseList.size() == 0)
			&& multiCourseInputs != null && multiCourseInputs.size() > 0) {
		String sectionEid = sectionFieldProvider.getSectionEid(t.getEid(),
				(List) multiCourseInputs.get(0));
		// default title
		title = sectionFieldProvider.getSectionTitle(t.getEid(), (List) multiCourseInputs.get(0));
		try {
			Section s = cms.getSection(sectionEid);
			title = s != null?s.getTitle():title;
		} catch (IdNotFoundException e) {
			log.warn("readCourseSectionInfo: Cannot find section " + sectionEid);
		}
	}

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

示例2: getCMSections

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
private List getCMSections(String offeringEid) {
	if (offeringEid == null || offeringEid.trim().length() == 0)
		return null;

	if (cms != null) {
		try
		{
			Set sections = cms.getSections(offeringEid);
			if (sections != null)
			{
				Collection c = sortSections(new ArrayList(sections));
				return (List) c;
			}
		}
		catch (IdNotFoundException e)
		{
			log.warn("getCMSections: Cannot find sections for " + offeringEid);
		}
	}

	return new ArrayList(0);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:SiteAction.java

示例3: addCategories

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
/**
 * a recursive function to add courseset categories
 * @param rv
 * @param courseSets
 */
private List<String> addCategories(List<String> rv, Set courseSets) {
	if (courseSets != null)
	{
		for (Iterator i = courseSets.iterator(); i.hasNext();)
		{
			// get the CourseSet object level
			CourseSet cs = (CourseSet) i.next();
			String level = cs.getCategory();
			if (!rv.contains(level))
			{
				rv.add(level);
			}
			try
			{
				// recursively add child categories
				rv = addCategories(rv, cms.getChildCourseSets(cs.getEid()));
			}
			catch (IdNotFoundException e)
			{
				// current CourseSet not found
			}
		}
	}
	return rv;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:31,代码来源:SiteAction.java

示例4: addExternalCourseSectionToSite

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
/**
 * Adds an externally managed CourseSection (a decorated group) to a site.  The CourseSection is
 * constructed by finding the official section from CM and converting it to a CourseSection.
 * 
 * @param site The site in which we are adding a CourseSection 
 * @param sectionId The Enterprise ID of the section to add.
 * 
 * @return The CourseSection that was added to the site
 */
private CourseSection addExternalCourseSectionToSite(Site site, String sectionEid) {
	if(log.isDebugEnabled()) log.debug("Adding section " + sectionEid + " to site " + site.getId());

	// Create a new sakai section (group) for this providerId
	Section officialSection = null;
	try {
		officialSection = courseManagementService.getSection(sectionEid);
	} catch (IdNotFoundException ide) {
		log.error("Site " + site.getId() + " has a provider id, " + sectionEid + ", that has no matching section in CM.");
		return null;
	}
	Group group = site.addGroup();
	group.setProviderGroupId(sectionEid);
	return CourseSectionUtil.decorateGroupWithCmSection(group, officialSection);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:SectionManagerImpl.java

示例5: getEnrollmentSetByEid

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
/**
 * Needed to get course offering eid in the output for an enrollment set.
 */
public EnrollmentSetCmImpl getEnrollmentSetByEid(final String eid) {
  HibernateCallback hc = session -> {
    StringBuilder hql = new StringBuilder();
    hql.append("from ").append(EnrollmentSetCmImpl.class.getName()).append(" as obj where obj.eid=:eid");
    Query q = session.createQuery(hql.toString());
    q.setParameter("eid", eid);
    EnrollmentSetCmImpl result = (EnrollmentSetCmImpl) q.uniqueResult();
    if (result == null) {
      throw new IdNotFoundException(eid, EnrollmentSetCmImpl.class.getName());
    }
    Hibernate.initialize(result.getCourseOffering());
    return result;
  };
  return (EnrollmentSetCmImpl) getHibernateTemplate().execute(hc);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:CmProviderHibernateService.java

示例6: testRemoveEnrollmentSet

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
@Test
public void testRemoveEnrollmentSet() throws Exception {
	cmAdmin.createAcademicSession("as", "as", "as", null, null);
	cmAdmin.createCanonicalCourse("cc", "cc", "cc");
	cmAdmin.createCourseOffering("co", "co", "co", "co", "as", "cc", null, null);
	cmAdmin.createEnrollmentSet("es", "es", "es", "es", "es", "co", null);
	cmAdmin.addOrUpdateEnrollment("student1","es","enrolled", "4", "letter grade");
	
	// Remove the ES
	cmAdmin.removeEnrollmentSet("es");
	
	// Ensure that the enrollment was deleted as well
	Assert.assertEquals(0, cm.getEnrollments("es").size());

	// Ensure that the CM service can no longer find the ES
	try {
		cm.getEnrollmentSet("es");
		Assert.fail();
	} catch (IdNotFoundException ide) {}
	
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:CourseManagementAdministrationTest.java

示例7: findActiveCourseOfferingsInCanonicalCourse

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
public List<CourseOffering> findActiveCourseOfferingsInCanonicalCourse(
		String eid) {
	log.debug("findActiveCourseOfferingsInCanonicalCourse(eid");
	/**
	 * select * from CM_MEMBER_CONTAINER_T where start_date <= now() and end_date>=now() and class_discr='org.sakaiproject.coursemanagement.impl.CourseOfferingCmImpl' and canonical_course in (select MEMBER_CONTAINER_ID from CM_MEMBER_CONTAINER_T where enterprise_id= ? and CLASS_DISCR='org.sakaiproject.coursemanagement.impl.CanonicalCourseCmImpl');
	 */
	CanonicalCourse canonicalCourse = null;
	try {
		canonicalCourse = this.getCanonicalCourse(eid);
	}
	catch (IdNotFoundException e) {
		//its quite possible someone ask for a course that doesn't exits
		return new ArrayList<CourseOffering>();
	}
	
	List<CourseOffering> ret = new ArrayList<CourseOffering>((List<CourseOffering>) getHibernateTemplate().findByNamedQueryAndNamedParam("findActiveCourseOfferingsInCanonicalCourse", 
			"canonicalCourse", canonicalCourse));
	
	return ret;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:21,代码来源:CourseManagementServiceHibernateImpl.java

示例8: addOrUpdateCourseSetMembership

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
public Membership addOrUpdateCourseSetMembership(final String userId, String role, final String courseSetEid, final String status) throws IdNotFoundException {
	CourseSetCmImpl cs = (CourseSetCmImpl)getObjectByEid(courseSetEid, CourseSetCmImpl.class.getName());
	MembershipCmImpl member =getMembership(userId, cs);
	if(member == null) {
		// Add the new member
	    member = new MembershipCmImpl(userId, role, cs, status);
	    member.setCreatedBy(authn.getUserEid());
	    member.setCreatedDate(new Date());
		getHibernateTemplate().save(member);
	} else {
		// Update the existing member
		member.setRole(role);
		member.setStatus(status);
		member.setLastModifiedBy(authn.getUserEid());
		member.setLastModifiedDate(new Date());
		getHibernateTemplate().update(member);
	}
	return member;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:20,代码来源:CourseManagementAdministrationHibernateImpl.java

示例9: getCanonicalCourses

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
public Set<CanonicalCourse> getCanonicalCourses(String courseSetEid) throws IdNotFoundException {
	Set<CanonicalCourse> resultSet = new HashSet<CanonicalCourse>();
	int exceptions = 0;
	for(Iterator implIter = implList.iterator(); implIter.hasNext();) {
		CourseManagementService cm = (CourseManagementService)implIter.next();
		Set<CanonicalCourse> set = null;
		try {
			set = cm.getCanonicalCourses(courseSetEid);
		} catch (IdNotFoundException ide) {
			exceptions++;
			if(log.isDebugEnabled()) log.debug(cm + " could not find course set " + courseSetEid);
		}
		if(set != null) {
			resultSet.addAll(set);
		}
	}
	// If none of the impls could find the course set, throw an IdNotFoundException.
	if(exceptions == implList.size()) {
		throw new IdNotFoundException(courseSetEid, CourseSet.class.getName());
	}
	return resultSet;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:CourseManagementServiceFederatedImpl.java

示例10: getChildCourseSets

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
public Set<CourseSet> getChildCourseSets(String parentCourseSetEid) throws IdNotFoundException {
	Set<CourseSet> resultSet = new HashSet<CourseSet>();
	int exceptions = 0;
	for(Iterator implIter = implList.iterator(); implIter.hasNext();) {
		CourseManagementService cm = (CourseManagementService)implIter.next();
		Set<CourseSet> set = null;
		try {
			set = cm.getChildCourseSets(parentCourseSetEid);
		} catch (IdNotFoundException ide) {
			exceptions++;
			if(log.isDebugEnabled()) log.debug(cm + " could not locate parent course set " + parentCourseSetEid);
		}
		if(set != null) {
			resultSet.addAll(set);
		}
	}
	// If none of the impls could find the course set, throw an IdNotFoundException.
	if(exceptions == implList.size()) {
		throw new IdNotFoundException(parentCourseSetEid, CourseSet.class.getName());
	}
	return resultSet;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:CourseManagementServiceFederatedImpl.java

示例11: getCourseOfferingMemberships

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
public Set<Membership> getCourseOfferingMemberships(String courseOfferingEid) throws IdNotFoundException {
	Set<Membership> resultSet = new HashSet<Membership>();
	int exceptions = 0;
	for(Iterator implIter = implList.iterator(); implIter.hasNext();) {
		CourseManagementService cm = (CourseManagementService)implIter.next();
		Set<Membership> set = null;
		try {
			set = cm.getCourseOfferingMemberships(courseOfferingEid);
		} catch (IdNotFoundException ide) {
			exceptions++;
			if(log.isDebugEnabled()) log.debug(cm + " could not locate course offering " + courseOfferingEid);
		}
		if(set != null) {
			resultSet.addAll(set);
		}
	}
	// If none of the impls could find the course offering, throw an IdNotFoundException.
	if(exceptions == implList.size()) {
		throw new IdNotFoundException(courseOfferingEid, CourseOffering.class.getName());
	}
	return resultSet;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:CourseManagementServiceFederatedImpl.java

示例12: getCourseOfferingsInCourseSet

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
public Set<CourseOffering> getCourseOfferingsInCourseSet(String courseSetEid) throws IdNotFoundException {
	Set<CourseOffering> resultSet = new HashSet<CourseOffering>();
	int exceptions = 0;
	for(Iterator implIter = implList.iterator(); implIter.hasNext();) {
		CourseManagementService cm = (CourseManagementService)implIter.next();
		Set<CourseOffering> set = null;
		try {
			set = cm.getCourseOfferingsInCourseSet(courseSetEid);
		} catch (IdNotFoundException ide) {
			exceptions++;
			if(log.isDebugEnabled()) log.debug(cm + " could not locate course set " + courseSetEid);
		}
		if(set != null) {
			resultSet.addAll(set);
		}
	}
	if(exceptions == implList.size()) {
		// all of the impls threw an IdNotFoundException, so the course set doesn't exist anywhere
		throw new IdNotFoundException(courseSetEid, CourseSet.class.getName());
	}
	return resultSet;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:CourseManagementServiceFederatedImpl.java

示例13: getCourseSetMemberships

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
public Set<Membership> getCourseSetMemberships(String courseSetEid) throws IdNotFoundException {
	Set<Membership> resultSet = new HashSet<Membership>();
	int exceptions = 0;
	for(Iterator implIter = implList.iterator(); implIter.hasNext();) {
		CourseManagementService cm = (CourseManagementService)implIter.next();
		Set<Membership> set = null;
		try {
			set = cm.getCourseSetMemberships(courseSetEid);
		} catch (IdNotFoundException ide) {
			exceptions++;
			if(log.isDebugEnabled()) log.debug(cm + " could not locate course set " + courseSetEid);
		}
		if(set != null) {
			resultSet.addAll(set);
		}
	}
	// If none of the impls could find the course set, throw an IdNotFoundException.
	if(exceptions == implList.size()) {
		throw new IdNotFoundException(courseSetEid, CourseSet.class.getName());
	}
	return resultSet;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:CourseManagementServiceFederatedImpl.java

示例14: getEnrollmentSets

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
public Set<EnrollmentSet> getEnrollmentSets(String courseOfferingEid) throws IdNotFoundException {
	Set<EnrollmentSet> resultSet = new HashSet<EnrollmentSet>();
	int exceptions = 0;
	for(Iterator implIter = implList.iterator(); implIter.hasNext();) {
		CourseManagementService cm = (CourseManagementService)implIter.next();
		Set<EnrollmentSet> set = null;
		try {
			set = cm.getEnrollmentSets(courseOfferingEid);
		} catch (IdNotFoundException ide) {
			exceptions++;
			if(log.isDebugEnabled()) log.debug(cm + " could not locate course offering " + courseOfferingEid);
		}
		if(set != null) {
			resultSet.addAll(set);
		}
	}
	// If none of the impls could find the course offering, throw an IdNotFoundException.
	if(exceptions == implList.size()) {
		throw new IdNotFoundException(courseOfferingEid, CourseOffering.class.getName());
	}
	return resultSet;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:CourseManagementServiceFederatedImpl.java

示例15: getEnrollments

import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException; //导入依赖的package包/类
public Set<Enrollment> getEnrollments(String enrollmentSetEid) throws IdNotFoundException {
	Set<Enrollment> resultSet = new HashSet<Enrollment>();
	int exceptions =0;
	for(Iterator implIter = implList.iterator(); implIter.hasNext();) {
		CourseManagementService cm = (CourseManagementService)implIter.next();
		Set<Enrollment> set = null;
		try {
			set = cm.getEnrollments(enrollmentSetEid);
		} catch (IdNotFoundException ide) {
			if(log.isDebugEnabled()) log.debug(cm + " could not locate enrollment set " + enrollmentSetEid);
		}
		if(set != null) {
			resultSet.addAll(set);
		}
	}
	// If none of the impls could find the enrollment set, throw an IdNotFoundException.
	if(exceptions == implList.size()) {
		throw new IdNotFoundException(enrollmentSetEid, EnrollmentSet.class.getName());
	}
	return resultSet;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:CourseManagementServiceFederatedImpl.java


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