Skip to content

Commit

Permalink
SAK-44877 - Lessons: getPrerequisiteDataForSubNav NullPointerException (
Browse files Browse the repository at this point in the history
sakaiproject#8967)

* SAK-44877 - Lessons: getPrerequisiteDataForSubNav NullPointerException

Also cleaned up this file with Lombok. Stuck with dao variable since it was used in so many places.

* Updates for Codacy
  • Loading branch information
jonespm authored Jan 20, 2021
1 parent 0170595 commit df03015
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.List;
import java.util.Set;

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

import uk.org.ponder.messageutil.MessageLocator;
Expand All @@ -44,6 +45,7 @@
import org.sakaiproject.memory.api.Cache;
import org.sakaiproject.memory.api.MemoryService;
import org.sakaiproject.site.api.SiteService;
import org.sakaiproject.time.api.UserTimeService;
import org.sakaiproject.tool.api.SessionManager;
import org.sakaiproject.tool.api.ToolManager;
import org.sakaiproject.user.api.UserDirectoryService;
Expand All @@ -68,11 +70,23 @@ public class LessonsAccess {
static final boolean useCache = true;

// Sakai Service Beans
private SimplePageToolDao dao;
private AuthzGroupService authzGroupService;
private SecurityService securityService;
private MemoryService memoryService;
private UserDirectoryService userDirectoryService;
@Setter private SimplePageToolDao dao;
@Setter private MessageLocator messageLocator;
@Setter private AuthzGroupService authzGroupService;
@Setter private SecurityService securityService;
@Setter private MemoryService memoryService;
@Setter private SessionManager sessionManager;
@Setter private ToolManager toolManager;
@Setter private UserDirectoryService userDirectoryService;
@Setter private UserTimeService userTimeService;
@Setter private SiteService siteService;
@Setter private ContentHostingService contentHostingService;
@Setter private GradebookIfc gradebookIfc;

@Setter private LessonEntity forumEntity;
@Setter private LessonEntity quizEntity;
@Setter private LessonEntity assignmentEntity;
@Setter private LessonEntity bltiEntity;

public void init() {
if (useCache) {
Expand Down Expand Up @@ -469,6 +483,7 @@ public SimplePageBean makeSimplePageBean(SimplePageBean simplePageBean, String s
simplePageBean.setCurrentSiteId(siteId);
simplePageBean.setCurrentPage(currentPage);
simplePageBean.setCurrentPageId(currentPage.getPageId());
simplePageBean.setUserTimeService(userTimeService);
simplePageBean.init();
}

Expand Down Expand Up @@ -557,92 +572,4 @@ public boolean isPageOwner(SimplePage page) {
else
return authzGroupService.getUserRole(currentUserId, group) != null;
}

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

public AuthzGroupService getAuthzGroupService() {
return authzGroupService;
}

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

public SecurityService getSecurityService() {
return securityService;
}

public void setSimplePageToolDao(SimplePageToolDao s) {
dao = s;
}

public void setMemoryService(MemoryService m) {
memoryService = m;
}

public void setUserDirectoryService(UserDirectoryService userDirectoryService) {
this.userDirectoryService = userDirectoryService;
}

public MessageLocator messageLocator;

public void setMessageLocator(MessageLocator s) {
messageLocator = s;
}

private ToolManager toolManager;

public void setToolManager(ToolManager s) {
toolManager = s;
}

SessionManager sessionManager = null;

public void setSessionManager(SessionManager s) {
sessionManager = s;
}

private SiteService siteService;

public void setSiteService(SiteService s) {
siteService = s;
}

ContentHostingService contentHostingService = null;

public void setContentHostingService(ContentHostingService s) {
contentHostingService = s;
}

LessonEntity forumEntity = null;

public void setForumEntity(Object e) {
forumEntity = (LessonEntity) e;
}

LessonEntity quizEntity = null;

public void setQuizEntity(Object e) {
quizEntity = (LessonEntity) e;
}

LessonEntity assignmentEntity = null;

public void setAssignmentEntity(Object e) {
assignmentEntity = (LessonEntity) e;
}

LessonEntity bltiEntity = null;
public void setBltiEntity(Object e) {
bltiEntity = (LessonEntity)e;
}

private GradebookIfc gradebookIfc = null;

public void setGradebookIfc(GradebookIfc g) {
gradebookIfc = g;
}

}
3 changes: 2 additions & 1 deletion lessonbuilder/tool/src/webapp/WEB-INF/applicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ simplePageBean.addForumSummary
class="org.sakaiproject.lessonbuildertool.service.LessonsAccess"
init-method="init"
destroy-method="destroy">
<property name="simplePageToolDao" ref="org.sakaiproject.lessonbuildertool.model.SimplePageToolDao" />
<property name="dao" ref="org.sakaiproject.lessonbuildertool.model.SimplePageToolDao" />
<property name="authzGroupService" ref="org.sakaiproject.authz.api.AuthzGroupService"/>
<property name="securityService" ref="org.sakaiproject.authz.api.SecurityService"/>
<property name="memoryService"><ref bean="org.sakaiproject.memory.api.MemoryService"/></property>
Expand All @@ -476,6 +476,7 @@ simplePageBean.addForumSummary
<property name="assignmentEntity" ref="org.sakaiproject.lessonbuildertool.service.AssignmentEntity"/>
<property name="bltiEntity" ref="org.sakaiproject.lessonbuildertool.service.BltiEntity"/>
<property name="gradebookIfc" ref="org.sakaiproject.lessonbuildertool.service.GradebookIfc"/>
<property name="userTimeService" ref="org.sakaiproject.time.api.UserTimeService"/>

</bean>

Expand Down

0 comments on commit df03015

Please sign in to comment.