Skip to content
Snippets Groups Projects
Commit 37c3a43e authored by srosse's avatar srosse
Browse files

FXOLAT-437: small refactoring

parent 9c4cd468
No related branches found
No related tags found
No related merge requests found
...@@ -121,7 +121,7 @@ public class CoreSpringFactory implements ServletContextAware, BeanFactoryAware ...@@ -121,7 +121,7 @@ public class CoreSpringFactory implements ServletContextAware, BeanFactoryAware
if (m.size() == 1) { if (m.size() == 1) {
return m.values().iterator().next(); return m.values().iterator().next();
} }
throw new OLATRuntimeException("found more than one bean for: "+ interfaceClass +". Calling this method should only find one bean!", null); throw new OLATRuntimeException("found " + m.size() + " bean for: "+ interfaceClass +". Calling this method should only find one bean!", null);
} }
/** /**
......
...@@ -427,18 +427,7 @@ AssessmentMainController(UserRequest ureq, WindowControl wControl, OLATResourcea ...@@ -427,18 +427,7 @@ AssessmentMainController(UserRequest ureq, WindowControl wControl, OLATResourcea
} }
// init edit controller for this identity and this course node // init edit controller for this identity and this course node
// or use identity assessment overview if no course node is defined // or use identity assessment overview if no course node is defined
if (this.currentCourseNode == null) { initIdentityEditController(ureq, course);
UserCourseEnvironment chooseUserCourseEnv = assessedIdentityWrapper.getUserCourseEnvironment();
removeAsListenerAndDispose(identityAssessmentController);
identityAssessmentController = new IdentityAssessmentEditController(getWindowControl(),ureq, chooseUserCourseEnv, course, true);
listenTo(identityAssessmentController);
setContent(identityAssessmentController.getInitialComponent());
} else {
removeAsListenerAndDispose(assessmentEditController);
assessmentEditController = new AssessmentEditController(ureq, getWindowControl(),course, currentCourseNode, assessedIdentityWrapper);
listenTo(assessmentEditController);
main.setContent(assessmentEditController.getInitialComponent());
}
} }
} else if (event.equals(TableController.EVENT_FILTER_SELECTED)) { } else if (event.equals(TableController.EVENT_FILTER_SELECTED)) {
ShortName filter = userListCtr.getActiveFilter(); ShortName filter = userListCtr.getActiveFilter();
...@@ -644,6 +633,27 @@ AssessmentMainController(UserRequest ureq, WindowControl wControl, OLATResourcea ...@@ -644,6 +633,27 @@ AssessmentMainController(UserRequest ureq, WindowControl wControl, OLATResourcea
} }
} }
/**
* Init edit controller for this identity and this course node or use identity assessment
* overview if no course node is defined. (Rely on the instance variable currentCourseNode
* and assessedIdentityWrapper)
* @param ureq
* @param course
*/
private void initIdentityEditController(UserRequest ureq, ICourse course) {
if (currentCourseNode == null) {
UserCourseEnvironment chooseUserCourseEnv = assessedIdentityWrapper.getUserCourseEnvironment();
removeAsListenerAndDispose(identityAssessmentController);
identityAssessmentController = new IdentityAssessmentEditController(getWindowControl(),ureq, chooseUserCourseEnv, course, true);
listenTo(identityAssessmentController);
setContent(identityAssessmentController.getInitialComponent());
} else {
removeAsListenerAndDispose(assessmentEditController);
assessmentEditController = new AssessmentEditController(ureq, getWindowControl(),course, currentCourseNode, assessedIdentityWrapper);
listenTo(assessmentEditController);
main.setContent(assessmentEditController.getInitialComponent());
}
}
/** /**
* Initialize the group list table according to the users access rights * Initialize the group list table according to the users access rights
...@@ -1231,10 +1241,7 @@ AssessmentMainController(UserRequest ureq, WindowControl wControl, OLATResourcea ...@@ -1231,10 +1241,7 @@ AssessmentMainController(UserRequest ureq, WindowControl wControl, OLATResourcea
} }
if(assessedIdentityWrapper != null) { if(assessedIdentityWrapper != null) {
removeAsListenerAndDispose(assessmentEditController); initIdentityEditController(ureq, course);
assessmentEditController = new AssessmentEditController(ureq, getWindowControl(), course, currentCourseNode, assessedIdentityWrapper);
listenTo(assessmentEditController);
main.setContent(assessmentEditController.getInitialComponent());
} }
} }
} }
......
...@@ -10,7 +10,9 @@ Ext.onReady(function(){ ...@@ -10,7 +10,9 @@ Ext.onReady(function(){
#end #end
<div class="o_efficiencystatement"> <div class="o_efficiencystatement">
$r.render("collectArtefactLink") #if($r.available("collectArtefactLink"))
$r.render("collectArtefactLink")
#end
<h3 class="b_with_small_icon_left o_efficiencystatement_icon">$r.translate("efficiencystatement.title")</h3> <h3 class="b_with_small_icon_left o_efficiencystatement_icon">$r.translate("efficiencystatement.title")</h3>
<table class="b_table"> <table class="b_table">
......
...@@ -156,4 +156,21 @@ public class BGContextImpl extends PersistentObject implements BGContext { ...@@ -156,4 +156,21 @@ public class BGContextImpl extends PersistentObject implements BGContext {
public void setDefaultContext(boolean defaultContext) { public void setDefaultContext(boolean defaultContext) {
this.defaultContext = defaultContext; this.defaultContext = defaultContext;
} }
}
\ No newline at end of file @Override
public int hashCode() {
return getKey() == null ? 836785 : getKey().hashCode();
}
@Override
public boolean equals(Object obj) {
if(this == obj) {
return true;
}
if(obj instanceof BGContext) {
BGContext ctx = (BGContext)obj;
return equalsByPersistableKey(ctx);
}
return false;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment