本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}