Skip to content

Commit

Permalink
SAK-25907
Browse files Browse the repository at this point in the history
Integrate the ScoringAgent API into Gradebook to enable support with iRubric

git-svn-id: https://source.sakaiproject.org/svn/gradebook/trunk@311503 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
mrw-iu committed Aug 3, 2014
1 parent 87a29af commit a95220a
Show file tree
Hide file tree
Showing 23 changed files with 1,526 additions and 3 deletions.
7 changes: 7 additions & 0 deletions gradebook/app/business/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
<groupId>org.sakaiproject.edu-services.sections</groupId>
<artifactId>sections-api</artifactId>
</dependency>
<!-- ScoringService integration -->
<dependency>
<groupId>org.sakaiproject.edu-services.scoringservice</groupId>
<artifactId>scoring-service-api</artifactId>
<scope>provided</scope>
<version>${sakai.version}</version>
</dependency>
<!-- Standalone component -->
<!-- <dependency>
<groupId>org.sakaiproject.edu-services.sections</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
/**********************************************************************************
*
* $Id: GradebookScoringAgentManager.java $
*
***********************************************************************************
*
* Copyright (c) 2005, 2006, 2007, 2008, 2009 The Sakai Foundation, The MIT Corporation
*
* Licensed under the Educational Community License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/ECL-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************************/

package org.sakaiproject.tool.gradebook.business;


/**
* Manages Gradebook interaction with an external ScoringAgent
*
*/
public interface GradebookScoringAgentManager {

/**
* append this param to the end of the url calls to the ScoringAgent
* to identify the Gradebook tool (vs Gradebook2)
*/
public static String GRADEBOOK_PARAM = "&t=gb";

/**
*
* @param gradebookUid
* @return true if a ScoringAgent is enabled for this gradebook
*/
public boolean isScoringAgentEnabledForGradebook(String gradebookUid);

/**
*
* @return the name of the ScoringAgent for display in the UI
*/
public String getScoringAgentName();

/**
*
* @param gradebookUid
* @param gradebookItemId
* @return true if a ScoringComponent is associated with the given
* gradebook item
*/
public boolean isScoringComponentEnabledForGbItem(String gradebookUid, Long gradebookItemId);

/**
* @param gradebookUid
* @param gradebookItemId
* @return the name of the ScoringComponent associated with the gradebookItem
*/
public String getScoringComponentName(String gradebookUid, Long gradebookItemId);

/**
*
* @param gradebookUid
* @param gradebookItemId
* @return the url for the ScoringComponent associated with the given gradebook item
*/
public String getScoringComponentUrl(String gradebookUid, Long gradebookItemId);

/**
*
* @param gradebookUid
* @param gradebookItemId
* @param studentUid
* @return get a url that a user may click on to launch the external app
* that provides the scoring use case
*/
public String getScoreStudentUrl(String gradebookUid, Long gradebookItemId, String studentUid);

/**
*
* @param gradebookUid
* @param gradebookId
* @return a url that will be clicked on to launch the user into the external app
* that provides the scoring use case. Does not launch to any specific student but
* for the whole roster.
*/
public String getScoreAllUrl(String gradebookUid, Long gradebookItemId);

/**
*
* @param gradebookUid
* @param gradebookItemId
* @param studentUid
* @return a url that can be clicked on to launch into the "view score" use case in the external
* app for a given student.
*/
public String getViewStudentScoreUrl(String gradebookUid, Long gradebookItemId, String studentUid);

/**
*
* @return the reference to the image representing the ScoringAgent
*/
public String getScoringAgentImageRef();

/**
*
* @param gradebookUid
* @param gradebookItemId
* @return url for retrieving all scores from the external ScoringAgent for
* the ScoringComponent associated with the given gradebook item
*/
public String getScoresUrl(String gradebookUid, Long gradebookItemId);

/**
*
* @param gradebookUid
* @param gradebookItemId
* @param studentUid
* @return url for retrieving the scores from the external ScoringAgent for
* the given student and gradebook item
*/
public String getScoreUrl(String gradebookUid, Long gradebookItemId, String studentUid);


/**
*
* @param gradebookUid
* @param studentUid
* @return url for retrieving the scores from the external ScoringAgent for
* the given student for all gradebook items
*/
public String getStudentScoresUrl(String gradebookUid, String studentUid);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/**********************************************************************************
*
* $Id: GradebookScoringAgentManagerImpl.java $
*
***********************************************************************************
*
* Copyright (c) 2005, 2006, 2007, 2008, 2009 The Sakai Foundation, The MIT Corporation
*
* Licensed under the Educational Community License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/ECL-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************************/

package org.sakaiproject.tool.gradebook.business.impl;

import org.sakaiproject.scoringservice.api.ScoringAgent;
import org.sakaiproject.scoringservice.api.ScoringComponent;
import org.sakaiproject.scoringservice.api.ScoringService;
import org.sakaiproject.tool.gradebook.business.GradebookScoringAgentManager;

/**
* Manages Gradebook's integration with a ScoringAgent
*/
public class GradebookScoringAgentManagerImpl implements GradebookScoringAgentManager {

private static String DEFAULT_IMAGE = "/../library/image/silk/report_edit.png";

private ScoringService scoringService;
public void setScoringService(ScoringService scoringService) {
this.scoringService = scoringService;
}

public boolean isScoringAgentEnabledForGradebook(String gradebookUid) {
boolean enabled = false;
ScoringAgent scoringAgent = scoringService.getDefaultScoringAgent();
if (scoringAgent != null) {
enabled = scoringAgent.isEnabled(gradebookUid, null);
}

return enabled;
}

public String getScoringAgentName() {
return scoringService.getDefaultScoringAgent().getName();
}

public boolean isScoringComponentEnabledForGbItem(String gradebookUid, Long gradebookItemId) {
ScoringAgent scoringAgent = scoringService.getDefaultScoringAgent();
ScoringComponent component = scoringService.getScoringComponent(
scoringAgent.getAgentId(), gradebookUid, getString(gradebookItemId));
return component != null;
}


public String getScoringComponentName(String gradebookUid, Long gradebookItemId) {
String componentName = null;

ScoringAgent scoringAgent = scoringService.getDefaultScoringAgent();
ScoringComponent component = scoringService.getScoringComponent(
scoringAgent.getAgentId(), gradebookUid, getString(gradebookItemId));

if (component != null) {
componentName = component.getName();
}

return componentName;
}

public String getScoringComponentUrl(String gradebookUid, Long gradebookItemId) {
ScoringAgent scoringAgent = scoringService.getDefaultScoringAgent();
return scoringAgent.getScoringComponentLaunchUrl(gradebookUid, getString(gradebookItemId));
}


public String getScoreStudentUrl(String gradebookUid, Long gradebookItemId,
String studentUid) {
ScoringAgent scoringAgent = scoringService.getDefaultScoringAgent();
return scoringAgent.getScoreLaunchUrl(gradebookUid, getString(gradebookItemId), studentUid);
}


public String getScoreAllUrl(String gradebookUid, Long gradebookItemId) {
ScoringAgent scoringAgent = scoringService.getDefaultScoringAgent();
return scoringAgent.getScoreLaunchUrl(gradebookUid, getString(gradebookItemId));
}


public String getViewStudentScoreUrl(String gradebookUid,
Long gradebookItemId, String studentUid) {
ScoringAgent scoringAgent = scoringService.getDefaultScoringAgent();
return scoringAgent.getViewScoreLaunchUrl(gradebookUid, getString(gradebookItemId), studentUid);
}

/**
*
* @param longValue
* @return convenience method to return the String representation of
* the given Long
*/
private String getString(Long longValue) {
return longValue == null ? null : Long.toString(longValue);
}

public String getScoringAgentImageRef() {
String imageRef = scoringService.getDefaultScoringAgent().getImageReference();
if (imageRef == null) {
imageRef = DEFAULT_IMAGE;
}

return imageRef;
}

public String getScoresUrl(String gradebookUid, Long gradebookItemId) {
return scoringService.getDefaultScoringAgent().getScoresUrl(gradebookUid, getString(gradebookItemId)) + GRADEBOOK_PARAM;
}

public String getScoreUrl(String gradebookUid, Long gradebookItemId, String studentUid) {
return scoringService.getDefaultScoringAgent().getScoreUrl(gradebookUid, getString(gradebookItemId), studentUid) + GRADEBOOK_PARAM;
}

public String getStudentScoresUrl(String gradebookUid, String studentUid) {
return scoringService.getDefaultScoringAgent().getStudentScoresUrl(gradebookUid, studentUid);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -701,3 +701,21 @@ calculatedgrade= Calculated Grade
gradeoverride= Grade Override
coursegrade= Course Grade
lastmodifieddate= Last Log Date

#ScoringAgent integration
# {0} - the name of the ScoringAgent being used
selectScoringComponent= Select {0}
# {0} - the name of the ScoringAgent being used
gradeWithScoringAgent= Grade with {0}
# {0} - the name of the ScoringAgent being used
gradeAllWithScoringAgent= Grade all with {0}
# {0} - the name of the ScoringAgent being used
viewWithScoringAgent= View with {0}
# {0} - the name of the currently selected ScoringComponent, ie "Accounting Rubric"
existingScoringComponent= (Current selection: {0})
# {0} - the name of the ScoringAgent being used
refreshAllGrades= Refresh all grades from {0}
# {0} - the name of the ScoringAgent being used
refreshGrade= Refresh grade from {0}
refreshReminder= When you are finished grading, click here to refresh the grade.
refreshAllReminder= All grades have been refreshed. Please remember to click [Save Changes].
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public class AssignmentBean extends GradebookDependentBean implements Serializab
private boolean selectedCategoryDropsScores;
private boolean selectedAssignmentIsOnlyOne;
private List<Category> categories;

private ScoringAgentData scoringAgentData;

// added to support bulk gradebook item creation
public List newBulkItems;
Expand Down Expand Up @@ -153,6 +155,10 @@ protected void init() {
newBulkItems.add(item);
}
}

if (isScoringAgentEnabled()) {
scoringAgentData = initializeScoringAgentData(getGradebookUid(), assignment.getId(), null);
}
}

private boolean isAssignmentTheOnlyOne(Assignment assignment, Category category){
Expand Down Expand Up @@ -722,6 +728,10 @@ public boolean isSelectedAssignmentIsOnlyOne() {
public void setSelectedAssignmentIsOnlyOne(boolean selectedAssignmentIsOnlyOne) {
this.selectedAssignmentIsOnlyOne = selectedAssignmentIsOnlyOne;
}

public ScoringAgentData getScoringAgentData() {
return this.scoringAgentData;
}

}

Loading

0 comments on commit a95220a

Please sign in to comment.