Skip to content

Commit

Permalink
SAK-40437 GradebookNG GradingService refactored and centralized (saka…
Browse files Browse the repository at this point in the history
…iproject#9990)

* SAK-40437 Moved the grading service into gradebookng

https://sakaiproject.atlassian.net/browse/SAK-40437

This commit merges the 3 grading interfaces into one, GradingService. It
also adds a load of tests and adds a lot of typing to the various
collections used.

* List -> Collection

removed System.out.println

* Cleaned up poms and typed authz api

* hibernate mappings change
  • Loading branch information
adrianfish authored Apr 20, 2022
1 parent 60c7bc5 commit c16dc00
Show file tree
Hide file tree
Showing 325 changed files with 18,320 additions and 19,876 deletions.
8 changes: 6 additions & 2 deletions assignment/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@
<artifactId>sakai-assignment-api</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.edu-services.gradebook</groupId>
<artifactId>gradebook-service-api</artifactId>
<groupId>org.sakaiproject.grading</groupId>
<artifactId>sakai-grading-api</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.edu-services.sections</groupId>
<artifactId>sections-api</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.announcement</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import org.sakaiproject.event.api.EventTrackingService;
import org.sakaiproject.exception.IdUnusedException;
import org.sakaiproject.exception.PermissionException;
import org.sakaiproject.service.gradebook.shared.AssessmentNotFoundException;
import org.sakaiproject.service.gradebook.shared.GradebookService;
import org.sakaiproject.grading.api.AssessmentNotFoundException;
import org.sakaiproject.grading.api.GradingService;
import org.sakaiproject.user.api.User;
import org.sakaiproject.user.api.UserDirectoryService;
import org.sakaiproject.user.api.UserNotDefinedException;
Expand All @@ -44,7 +44,7 @@ public class AssignmentEventObserver implements Observer {

@Setter private AssignmentService assignmentService;
@Setter private EventTrackingService eventTrackingService;
@Setter private GradebookService gradebookService;
@Setter private GradingService gradingService;
@Setter private UserDirectoryService userDirectoryService;

public void init() {
Expand Down Expand Up @@ -75,7 +75,7 @@ public void update(Observable o, Object arg) {
Optional<AssignmentSubmission> submission = Optional.empty();
// Assignments stores the gradebook item name and not the id :(, so we need to look it up
try {
org.sakaiproject.service.gradebook.shared.Assignment gradebookAssignment = gradebookService.getAssignmentByNameOrId(event.getContext(), itemId);
org.sakaiproject.grading.api.Assignment gradebookAssignment = gradingService.getAssignmentByNameOrId(event.getContext(), itemId);
assignment = Optional.ofNullable(assignmentService.getAssignmentForGradebookLink(event.getContext(), gradebookAssignment.getName()));
if (assignment.isPresent()) {
final Assignment a = assignment.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,42 @@
import org.sakaiproject.authz.api.AuthzGroupService;
import org.sakaiproject.authz.api.SecurityAdvisor;
import org.sakaiproject.authz.api.SecurityService;
import org.sakaiproject.grading.api.ExternalAssignmentProvider;
import org.sakaiproject.grading.api.ExternalAssignmentProviderCompat;
import org.sakaiproject.grading.api.GradingService;
import org.sakaiproject.entity.api.Entity;
import org.sakaiproject.entity.api.EntityManager;
import org.sakaiproject.entity.api.Reference;
import org.sakaiproject.exception.IdUnusedException;
import org.sakaiproject.exception.PermissionException;
import org.sakaiproject.service.gradebook.shared.ExternalAssignmentProvider;
import org.sakaiproject.service.gradebook.shared.ExternalAssignmentProviderCompat;
import org.sakaiproject.service.gradebook.shared.GradebookExternalAssessmentService;
import org.sakaiproject.site.api.SiteService;
import org.sakaiproject.tool.api.SessionManager;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Getter
@Setter
public class AssignmentGradeInfoProvider implements ExternalAssignmentProvider, ExternalAssignmentProviderCompat {

// Sakai Service Beans
private AssignmentService assignmentService;
private SiteService siteService;
private GradebookExternalAssessmentService geaService;
private GradingService gradingService;
private AuthzGroupService authzGroupService;
private EntityManager entityManager;
private SecurityService securityService;
private SessionManager sessionManager;

public void init() {
log.info("INIT and register AssignmentGradeInfoProvider");
geaService.registerExternalAssignmentProvider(this);
gradingService.registerExternalAssignmentProvider(this);
}

public void destroy() {
log.info("DESTROY and unregister AssignmentGradeInfoProvider");
geaService.unregisterExternalAssignmentProvider(getAppKey());
gradingService.unregisterExternalAssignmentProvider(getAppKey());
}

public String getAppKey() {
Expand Down Expand Up @@ -171,58 +174,5 @@ public Map<String, List<String>> getAllExternalAssignments(String gradebookUid,
}
return allExternals;
}

public void setGradebookExternalAssessmentService(GradebookExternalAssessmentService geaService) {
this.geaService = geaService;
}

public GradebookExternalAssessmentService getGradebookExternalAssessmentService() {
return geaService;
}

public void setAssignmentService(AssignmentService assignmentService) {
this.assignmentService = assignmentService;
}

public AssignmentService getAssignmentService() {
return assignmentService;
}

public void setSiteService(SiteService siteService) {
this.siteService = siteService;
}

public SiteService getSiteService() {
return siteService;
}

public void setAuthzGroupService(AuthzGroupService authzGroupService) {
this.authzGroupService = authzGroupService;
}

public AuthzGroupService getAuthzGroupService() {
return authzGroupService;
}

public void setEntityManager(EntityManager entityManager) {
this.entityManager = entityManager;
}

public EntityManager getEntityManager() {
return entityManager;
}

public void setSecurityService(SecurityService securityService) {
this.securityService = securityService;
}

public SecurityService getSecurityService() {
return securityService;
}

public void setSessionManager(SessionManager sessionManager) {
this.sessionManager = sessionManager;
}

}

Loading

0 comments on commit c16dc00

Please sign in to comment.