本文整理汇总了Java中org.sakaiproject.service.gradebook.shared.Assignment.getCategoryId方法的典型用法代码示例。如果您正苦于以下问题:Java Assignment.getCategoryId方法的具体用法?Java Assignment.getCategoryId怎么用?Java Assignment.getCategoryId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sakaiproject.service.gradebook.shared.Assignment
的用法示例。
在下文中一共展示了Assignment.getCategoryId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateAssignment
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
/**
* Update the details of an assignment
*
* @param assignment
* @return
*/
public boolean updateAssignment(final Assignment assignment) {
final String siteId = getCurrentSiteId();
final Gradebook gradebook = getGradebook(siteId);
// need the original name as the service needs that as the key...
final Assignment original = this.getAssignment(assignment.getId());
try {
this.gradebookService.updateAssignment(gradebook.getUid(), original.getId(), assignment);
if (original.getCategoryId() != null && assignment.getCategoryId() != null
&& original.getCategoryId().longValue() != assignment.getCategoryId().longValue()) {
updateAssignmentCategorizedOrder(gradebook.getUid(), assignment.getCategoryId(), assignment.getId(),
Integer.MAX_VALUE);
}
return true;
} catch (final Exception e) {
log.error("An error occurred updating the assignment", e);
}
return false;
}
示例2: updateAssignment
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
/**
* Update the details of an assignment
*
* @param assignment
* @return
*/
public boolean updateAssignment(Assignment assignment) {
String siteId = this.getCurrentSiteId();
Gradebook gradebook = getGradebook(siteId);
//need the original name as the service needs that as the key...
Assignment original = this.getAssignment(assignment.getId());
try {
gradebookService.updateAssignment(gradebook.getUid(), original.getId(), assignment);
if (original.getCategoryId() != assignment.getCategoryId()) {
syncCatagorizedAssignmentOrder(siteId, assignment);
}
return true;
} catch (Exception e) {
log.error("An error occurred updating the assignment", e);
}
return false;
}
示例3: GradebookItem
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
public GradebookItem(Assignment assignment) {
this.id = assignment.getId();
this.name = assignment.getName();
this.points = assignment.getPoints();
this.dueDate = assignment.getDueDate();
if(assignment.isExternallyMaintained()) {
this.externalInfo = new ExternalInfo(assignment);
}
this.grades = new ArrayList<>();
this.categoryId = assignment.getCategoryId();
this.released = assignment.isReleased();
this.extraCredit = assignment.isExtraCredit();
}
示例4: getCategoryScoreForStudent
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
/**
* Get the category score for the given student. Safe to call when logged in as a student.
* @param categoryId id of category
* @param studentUuid uuid of student
* @param grades Map of grades obtained from getGradesForStudent.
* @return
*/
public Double getCategoryScoreForStudent(Long categoryId, String studentUuid, Map<Assignment,GbGradeInfo> grades) {
String siteId = this.getCurrentSiteId();
//get assignments (filtered to just the category ones later)
List<Assignment> assignments = new ArrayList<Assignment>(grades.keySet());
//build map of just the grades and assignments we want for the assignments in the given category
Map<Long,String> gradeMap = new HashMap<>();
Iterator<Assignment> iter = assignments.iterator();
while (iter.hasNext()) {
Assignment assignment = iter.next();
if(categoryId == assignment.getCategoryId()) {
GbGradeInfo gradeInfo = grades.get(assignment);
if(gradeInfo != null) {
gradeMap.put(assignment.getId(),gradeInfo.getGrade());
}
} else {
iter.remove();
}
}
//get the score
Double score = this.gradebookService.calculateCategoryScore(categoryId, assignments, gradeMap);
log.info("Category score for category: " + categoryId + ", student: " + studentUuid + ":" + score);
return score;
}