當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。