Skip to content

Commit

Permalink
SAK-42176 - Tests & Quizzes: Can't delete exceptions (sakaiproject#7481)
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Pellicer authored Oct 23, 2019
1 parent c770816 commit 2d1aaad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
4 changes: 4 additions & 0 deletions samigo/samigo-hibernate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import java.util.Iterator;
import java.util.Set;

import org.apache.commons.collections4.CollectionUtils;

import org.sakaiproject.tool.assessment.data.dao.shared.TypeD;
import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAccessControlIfc;
import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentFeedbackIfc;
Expand Down Expand Up @@ -328,29 +330,25 @@ public Set getAssessmentMetaDataSet() {

public void setAssessmentMetaDataSet(Set assessmentMetaDataSet) {
this.assessmentMetaDataSet = assessmentMetaDataSet;
this.assessmentMetaDataMap = getAssessmentMetaDataMap(assessmentMetaDataSet);
try{
this.assessmentMetaDataMap = this.getAssessmentMetaDataMap(assessmentMetaDataSet);
} catch (Exception ex) {
this.assessmentMetaDataMap = new HashMap();
}
}

public HashMap getAssessmentMetaDataMap(Set assessmentMetaDataSet) {
HashMap assessmentMetaDataMap = new HashMap();
if (assessmentMetaDataSet != null){
for (Iterator i = assessmentMetaDataSet.iterator(); i.hasNext(); ) {
AssessmentMetaData assessmentMetaData = (AssessmentMetaData) i.next();
assessmentMetaDataMap.put(assessmentMetaData.getLabel(), assessmentMetaData.getEntry());
}
if (CollectionUtils.isNotEmpty(assessmentMetaDataSet)) {
for (AssessmentMetaData assessmentMetaData : (Set<AssessmentMetaData>) assessmentMetaDataSet) {
assessmentMetaDataMap.put(assessmentMetaData.getLabel(), assessmentMetaData.getEntry());
}
}
return assessmentMetaDataMap;
}

public HashMap getAssessmentMetaDataMap() {
HashMap assessmentMetaDataMap = new HashMap();
if (this.assessmentMetaDataSet != null){
for (Iterator i = this.assessmentMetaDataSet.iterator(); i.hasNext(); ) {
AssessmentMetaData assessmentMetaData = (AssessmentMetaData) i.next();
assessmentMetaDataMap.put(assessmentMetaData.getLabel(), assessmentMetaData.getEntry());
}
}
return assessmentMetaDataMap;
return this.getAssessmentMetaDataMap(this.assessmentMetaDataSet);
}

public String getAssessmentMetaDataByLabel(String label) {
Expand Down

0 comments on commit 2d1aaad

Please sign in to comment.