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


Java GradebookNotFoundException类代码示例

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


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

示例1: getAccessibleGradebooks

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
public List getAccessibleGradebooks(String userUid) {
	List gradebooks = new ArrayList();
	List siteMemberships = integrationSupport.getAllSiteMemberships(userUid);
	for (Iterator iter = siteMemberships.iterator(); iter.hasNext(); ) {
		ParticipationRecord participationRecord = (ParticipationRecord)iter.next();
		Course course = (Course)participationRecord.getLearningContext();
		String siteContext = course.getSiteContext();
           Gradebook gradebook = null;
           try {
               gradebook = getGradebookManager().getGradebook(siteContext);
               gradebooks.add(gradebook);
           } catch (GradebookNotFoundException gnfe) {
           	if (log.isInfoEnabled()) log.info("no gradebook found for " + siteContext);
           }
       }
	return gradebooks;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:18,代码来源:FrameworkManagerSectionsImpl.java

示例2: setGradebookUid

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
/**
 * @param newGradebookUid The gradebookId to set.
 * Since this is coming from the client, the application should NOT
 * trust that the current user actually has access to the gradebook
 * with this UID. This design assumes that authorization will come
 * into play on each request.
 */
public final void setGradebookUid(String newGradebookUid) {
	Long newGradebookId = null;
	if (newGradebookUid != null) {
		Gradebook gradebook = null;
		try {
			gradebook = getGradebookManager().getGradebook(newGradebookUid);
		} catch (GradebookNotFoundException gnfe1) {
			log.debug("Request made for inaccessible, adding gradebookUid=" + newGradebookUid);
			getGradebookFrameworkService().addGradebook(newGradebookUid,newGradebookUid);
			try {
				gradebook = getGradebookManager().getGradebook(newGradebookUid);
			} catch (GradebookNotFoundException gnfe2) {
				log.error("Request made and could not add inaccessible gradebookUid=" + newGradebookUid);
				newGradebookUid = null;
			}
		}
		if(gradebook == null)
			throw new IllegalStateException("Gradebook gradebook == null!");
		newGradebookId = gradebook.getId();
		if (log.isDebugEnabled()) log.debug("setGradebookUid gradebookUid=" + newGradebookUid + ", gradebookId=" + newGradebookId);
	}
	this.gradebookUid = newGradebookUid;
	setGradebookId(newGradebookId);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:32,代码来源:GradebookBean.java

示例3: studentCanView

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
protected boolean studentCanView(String studentId, GradebookAssignment assignment) {
	if (assignment.isExternallyMaintained()) {
		try {
			String gbUid = assignment.getGradebook().getUid();
			String extId = assignment.getExternalId();

			if (externalAssessmentService.isExternalAssignmentGrouped(gbUid, extId)) {
				return externalAssessmentService.isExternalAssignmentVisible(gbUid, extId, studentId);
			}
		} catch (GradebookNotFoundException e) {
			if (log.isDebugEnabled()) { log.debug("Bogus graded assignment checked for course grades: " + assignment.getId()); }
		}
	}

	// We assume that the only disqualifying condition is that the external assignment
	// is grouped and the student is not a member of one of the groups allowed.
	return true;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:BaseHibernateManager.java

示例4: getAssignmentScoreComment

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
public CommentDefinition getAssignmentScoreComment(final String gradebookUid, final Long assignmentId, final String studentUid) throws GradebookNotFoundException, AssessmentNotFoundException {
	if (gradebookUid == null || assignmentId == null || studentUid == null) {
		throw new IllegalArgumentException("null parameter passed to getAssignmentScoreComment. Values are gradebookUid:" + gradebookUid + " assignmentId:" + assignmentId + " studentUid:"+ studentUid);
	}
	GradebookAssignment assignment = getAssignmentWithoutStats(gradebookUid, assignmentId);
	if (assignment == null) {
		throw new AssessmentNotFoundException("There is no assignmentId " + assignmentId + " for gradebookUid " + gradebookUid);
	}

	CommentDefinition commentDefinition = null;
       Comment comment = getInternalComment(gradebookUid, assignmentId, studentUid);
       if (comment != null) {
       	commentDefinition = new CommentDefinition();
       	commentDefinition.setAssignmentName(assignment.getName());
       	commentDefinition.setCommentText(comment.getCommentText());
       	commentDefinition.setDateRecorded(comment.getDateRecorded());
       	commentDefinition.setGraderUid(comment.getGraderId());
       	commentDefinition.setStudentUid(comment.getStudentId());
       }
	return commentDefinition;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:BaseHibernateManager.java

示例5: getAssignments

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
@Override
public List<org.sakaiproject.service.gradebook.shared.Assignment> getAssignments(final String gradebookUid, final SortType sortBy) throws GradebookNotFoundException {
		if (!isUserAbleToViewAssignments(gradebookUid)) {
			log.warn("AUTHORIZATION FAILURE: User {} in gradebook {} attempted to get assignments list", getUserUid(), gradebookUid);
			throw new GradebookSecurityException();
		}

		final Long gradebookId = getGradebook(gradebookUid).getId();

		final List<GradebookAssignment> internalAssignments = getAssignments(gradebookId);

        sortAssignments(internalAssignments, sortBy, true);

		final List<org.sakaiproject.service.gradebook.shared.Assignment> assignments = new ArrayList<>();
		for (final GradebookAssignment gradebookAssignment : internalAssignments) {
			final GradebookAssignment assignment = gradebookAssignment;
			assignments.add(getAssignmentDefinition(assignment));
		}
		return assignments;
	}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:21,代码来源:GradebookServiceHibernateImpl.java

示例6: isGradeValid

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
@Override
public boolean isGradeValid(final String gradebookUuid, final String grade) {
 if (gradebookUuid == null) {
  throw new IllegalArgumentException("Null gradebookUuid passed to isGradeValid");
 }
 Gradebook gradebook;
 try {
  gradebook = getGradebook(gradebookUuid);
 } catch (final GradebookNotFoundException gnfe) {
  throw new GradebookNotFoundException("No gradebook exists with the given gradebookUid: " +
		  gradebookUuid + "Error: " + gnfe.getMessage());
 }

 final int gradeEntryType = gradebook.getGrade_type();
 LetterGradePercentMapping mapping = null;
 if (gradeEntryType == GradebookService.GRADE_TYPE_LETTER) {
  mapping = getLetterGradePercentMapping(gradebook);
 }

 return isGradeValid(grade, gradeEntryType, mapping);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:GradebookServiceHibernateImpl.java

示例7: getAssignmentScoreString

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
@Override
	public String getAssignmentScoreString(final String gradebookUid, final String assignmentName, final String studentUid)
			throws GradebookNotFoundException, AssessmentNotFoundException {

if (gradebookUid == null || assignmentName == null || studentUid == null) {
	throw new IllegalArgumentException("null parameter passed to getAssignment. Values are gradebookUid:"
			+ gradebookUid + " assignmentName:" + assignmentName + " studentUid:" + studentUid);
}

final GradebookAssignment assignment = (GradebookAssignment)getHibernateTemplate().execute(new HibernateCallback() {
	@Override
	public Object doInHibernate(final Session session) throws HibernateException {
		return getAssignmentWithoutStats(gradebookUid, assignmentName);
	}
});

if (assignment == null) {
	throw new AssessmentNotFoundException("There is no assignment with name " + assignmentName + " in gradebook " + gradebookUid);
}

return getAssignmentScoreString(gradebookUid, assignment.getId(), studentUid);
	}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:GradebookServiceHibernateImpl.java

示例8: getAssignmentScoreStringByNameOrId

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
@Override
public String getAssignmentScoreStringByNameOrId(final String gradebookUid, final String assignmentName, final String studentUid)
		throws GradebookNotFoundException, AssessmentNotFoundException {
	// TODO Auto-generated method stub
	String assignment = null;
	try {
		assignment = getAssignmentScoreString(gradebookUid, assignmentName, studentUid);
	}
	catch (final AssessmentNotFoundException e) {
		//Don't fail on this exception
		log.debug("Assessment not found by name", e);
	}

	if (assignment == null) {
		//Try to get the assignment by id
		if (NumberUtils.isCreatable(assignmentName)) {
			final Long assignmentId = NumberUtils.toLong(assignmentName, -1L);
			return getAssignmentScoreString(gradebookUid, assignmentId, studentUid);
		}
	}
	return null;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:GradebookServiceHibernateImpl.java

示例9: setAssignmentScoreString

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
@Override
public void setAssignmentScoreString(final String gradebookUid, final String assignmentName, final String studentUid, final String score, final String clientServiceDescription)
		throws GradebookNotFoundException, AssessmentNotFoundException {

 		final GradebookAssignment assignment = (GradebookAssignment)getHibernateTemplate().execute(new HibernateCallback() {
		@Override
		public Object doInHibernate(final Session session) throws HibernateException {
			return getAssignmentWithoutStats(gradebookUid, assignmentName);
		}
	});

	if (assignment == null) {
		throw new AssessmentNotFoundException("There is no assignment with name " + assignmentName + " in gradebook " + gradebookUid);
	}

	setAssignmentScoreString(gradebookUid, assignment.getId(), studentUid, score, clientServiceDescription);
 	}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:18,代码来源:GradebookServiceHibernateImpl.java

示例10: isExternalAssignmentGrouped

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
@Override
public boolean isExternalAssignmentGrouped(String gradebookUid, String externalId)
	throws GradebookNotFoundException
{
       // SAK-19668
	final GradebookAssignment assignment = getExternalAssignment(gradebookUid, externalId);
	// If we check all available providers for an existing, externally maintained assignment
	// and none manage it, return false since grouping is the outlier case and all items
	// showed for all users until the 2.9 release.
	boolean result = false;
	boolean providerResponded = false;
	if (assignment == null) {
           result = false;
           log.info("No assignment found for external assignment check: gradebookUid="+gradebookUid+", externalId="+externalId);
	} else {
        for (ExternalAssignmentProvider provider : getExternalAssignmentProviders().values()) {
            if (provider.isAssignmentDefined(assignment.getExternalAppName(), externalId)) {
            	providerResponded = true;
                result = result || provider.isAssignmentGrouped(externalId);
            }
        }
	}
	return result || !providerResponded;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:GradebookExternalAssessmentServiceImpl.java

示例11: isExternalAssignmentVisible

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
@Override
public boolean isExternalAssignmentVisible(String gradebookUid, String externalId, String userId)
	throws GradebookNotFoundException
{
    // SAK-19668
	final GradebookAssignment assignment = getExternalAssignment(gradebookUid, externalId);
	// If we check all available providers for an existing, externally maintained assignment
	// and none manage it, assume that it should be visible. This matches the pre-2.9 behavior
	// when a provider is not implemented to handle the assignment. Also, any provider that
	// returns true will allow access (logical OR of responses).
	boolean result = false;
	boolean providerResponded = false;
	if (assignment == null) {
	    result = false;
		log.info("No assignment found for external assignment check: gradebookUid="+gradebookUid+", externalId="+externalId);
	} else {
		for (ExternalAssignmentProvider provider : getExternalAssignmentProviders().values()) {
			if (provider.isAssignmentDefined(assignment.getExternalAppName(), externalId)) {
				providerResponded = true;
				result = result || provider.isAssignmentVisible(externalId, userId);
			}
		}
	}
	return result || !providerResponded;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:GradebookExternalAssessmentServiceImpl.java

示例12: getGradebook

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
/**
 * Helper to get a reference to the gradebook for the specified site
 *
 * @param siteId the siteId
 * @return the gradebook for the site
 */
private Gradebook getGradebook(final String siteId) {
	Gradebook gradebook = null;
	try {
		gradebook = (Gradebook) this.gradebookService.getGradebook(siteId);
	} catch (final GradebookNotFoundException e) {
		log.debug("Request made for inaccessible, adding gradebookUid={}", siteId);
		this.gradebookFrameworkService.addGradebook(siteId, siteId);
		try {
			gradebook = (Gradebook) this.gradebookService.getGradebook(siteId);
		} catch (final GradebookNotFoundException e2) {
			log.error("Request made and could not add inaccessible gradebookUid={}", siteId);
		}
	}
	return gradebook;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:GradebookNgBusinessService.java

示例13: updateAssignmentGradeComment

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
/**
 * Update (or set) the comment for a student's assignment
 *
 * @param assignmentId id of assignment
 * @param studentUuid uuid of student
 * @param comment the comment
 * @return true/false
 */
public boolean updateAssignmentGradeComment(final long assignmentId, final String studentUuid,
		final String comment) {

	final String siteId = getCurrentSiteId();
	final Gradebook gradebook = getGradebook(siteId);

	try {
		// could do a check here to ensure we aren't overwriting someone
		// else's comment that has been updated in the interim...
		this.gradebookService.setAssignmentScoreComment(gradebook.getUid(), assignmentId, studentUuid, comment);
		return true;
	} catch (GradebookNotFoundException | AssessmentNotFoundException | IllegalArgumentException e) {
		log.error("An error occurred saving the comment. {}: {}", e.getClass(), e.getMessage());
	}

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

示例14: getAssignmentGradeComment

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
/**
  * Get the comment for a given student assignment grade
  * 
  * @param assignmentId id of assignment
  * @param studentUuid uuid of student
  * @return the comment or null if none
  */
 public String getAssignmentGradeComment(final long assignmentId, final String studentUuid){
	 
	 String siteId = this.getCurrentSiteId();
	 Gradebook gradebook = getGradebook(siteId);
	 
	 try {
    	 CommentDefinition def = this.gradebookService.getAssignmentScoreComment(gradebook.getUid(), assignmentId, studentUuid);
		 if(def != null){
			 return def.getCommentText();
		 }
	 } catch (GradebookNotFoundException | AssessmentNotFoundException e) {
log.error("An error occurred retrieving the comment. " + e.getClass() + ": " + e.getMessage());
	 }
	 return null;
 }
 
开发者ID:steveswinsburg,项目名称:gradebookNG,代码行数:23,代码来源:GradebookNgBusinessService.java

示例15: updateAssignmentGradeComment

import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException; //导入依赖的package包/类
/**
  * Update (or set) the comment for a student's assignment
  * 
  * @param assignmentId id of assignment
  * @param studentUuid uuid of student
  * @param comment the comment
  * @return true/false
  */
 public boolean updateAssignmentGradeComment(final long assignmentId, final String studentUuid, final String comment) {
	 
	 String siteId = this.getCurrentSiteId();
	 Gradebook gradebook = getGradebook(siteId);
	 
	 try {
		 //could do a check here to ensure we aren't overwriting someone else's comment that has been updated in the interim...
		 this.gradebookService.setAssignmentScoreComment(gradebook.getUid(), assignmentId, studentUuid, comment);
		 return true;
	 } catch (GradebookNotFoundException | AssessmentNotFoundException | IllegalArgumentException e) {
log.error("An error occurred saving the comment. " + e.getClass() + ": " + e.getMessage());
	 }
	 
	 return false;
 }
 
开发者ID:steveswinsburg,项目名称:gradebookNG,代码行数:24,代码来源:GradebookNgBusinessService.java


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