/** @param gratuitySituation */ private void updateGratuitySituation(GratuitySituation gratuitySituation) { // check if there isnt any persistentSupportecialization for a 2nd year if (gratuitySituation .getStudentCurricularPlan() .getSpecialization() .equals(Specialization.STUDENT_CURRICULAR_PLAN_SPECIALIZATION)) { if (this.firstYear == null) { this.firstYear = gratuitySituation.getGratuityValues().getExecutionDegree().isFirstYear(); } if (!this.firstYear) { // TODO: check if this is right (sana) removeWrongGratuitySituation(gratuitySituation); return; } } gratuitySituation.updateValues(); }
private void removeWrongGratuitySituation(GratuitySituation gratuitySituation) { // find gratuity situation of first persistentSupportecialization year for (GratuitySituation correctSituation : gratuitySituation.getStudentCurricularPlan().getGratuitySituations()) { if (correctSituation.getGratuityValues().getExecutionDegree().isFirstYear()) { // transfer transactions from wrong to correct gratuity // situation for (GratuityTransaction gratuityTransaction : gratuitySituation.getTransactionList()) { correctSituation.addTransactionList(gratuityTransaction); } break; } } gratuitySituation.setEmployee(null); gratuitySituation.setGratuityValues(null); gratuitySituation.setStudentCurricularPlan(null); this.gratuitySituationsToDelete.add(gratuitySituation); }