use of fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCompositeGradingScale in project muikku by otavanopisto.
the class PyramusGradingSchoolDataBridge method listCompositeGradingScales.
@Override
public List<CompositeGradingScale> listCompositeGradingScales() {
List<CompositeGradingScale> localGradingScales = new ArrayList<fi.otavanopisto.muikku.schooldata.entity.CompositeGradingScale>();
fi.otavanopisto.pyramus.rest.model.composite.CompositeGradingScale[] restGradingScales = pyramusClient.get("/composite/gradingScales/", fi.otavanopisto.pyramus.rest.model.composite.CompositeGradingScale[].class);
Set<Long> gradingScaleFilter = getGradingScaleFilter();
for (int i = 0; i < restGradingScales.length; i++) {
if (!gradingScaleFilter.isEmpty() && !gradingScaleFilter.contains(restGradingScales[i].getScaleId())) {
continue;
}
List<CompositeGrade> localGrades = new ArrayList<CompositeGrade>();
List<fi.otavanopisto.pyramus.rest.model.composite.CompositeGrade> restGrades = restGradingScales[i].getGrades();
for (fi.otavanopisto.pyramus.rest.model.composite.CompositeGrade restGrade : restGrades) {
SchoolDataIdentifier gradeIdentifier = identifierMapper.getGradeIdentifier(restGrade.getGradeId());
localGrades.add(new PyramusCompositeGrade(gradeIdentifier.getIdentifier(), restGrade.getGradeName()));
}
SchoolDataIdentifier gradingScaleIdentifier = identifierMapper.getGradingScaleIdentifier(restGradingScales[i].getScaleId());
localGradingScales.add(new PyramusCompositeGradingScale(gradingScaleIdentifier.getIdentifier(), restGradingScales[i].getScaleName(), localGrades));
}
return localGradingScales;
}
Aggregations