Search in sources :

Example 1 with PyramusCompositeGrade

use of fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCompositeGrade 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;
}
Also used : SchoolDataIdentifier(fi.otavanopisto.muikku.schooldata.SchoolDataIdentifier) ArrayList(java.util.ArrayList) PyramusCompositeGrade(fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCompositeGrade) PyramusCompositeGradingScale(fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCompositeGradingScale) CompositeGrade(fi.otavanopisto.muikku.schooldata.entity.CompositeGrade) PyramusCompositeGrade(fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCompositeGrade) PyramusCompositeGradingScale(fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCompositeGradingScale) CompositeGradingScale(fi.otavanopisto.muikku.schooldata.entity.CompositeGradingScale)

Aggregations

PyramusCompositeGrade (fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCompositeGrade)1 PyramusCompositeGradingScale (fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCompositeGradingScale)1 SchoolDataIdentifier (fi.otavanopisto.muikku.schooldata.SchoolDataIdentifier)1 CompositeGrade (fi.otavanopisto.muikku.schooldata.entity.CompositeGrade)1 CompositeGradingScale (fi.otavanopisto.muikku.schooldata.entity.CompositeGradingScale)1 ArrayList (java.util.ArrayList)1