forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
23 changed files
with
1,526 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
...iness/src/java/org/sakaiproject/tool/gradebook/business/GradebookScoringAgentManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
} |
134 changes: 134 additions & 0 deletions
134
.../java/org/sakaiproject/tool/gradebook/business/impl/GradebookScoringAgentManagerImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.