if (studentCurricularPlan.getSpecialization().equals(Specialization.SPECIALIZATION)) {
if (studentCurricularPlan.getSpecialization().equals(Specialization.STUDENT_CURRICULAR_PLAN_SPECIALIZATION)) {
    public byte[] run(Integer executionYearID, Date paymentEndDate) throws FenixServiceException,            ExcepcaoPersistencia {        StringBuilder outgoingSibsPaymentFile = new StringBuilder();        ExecutionYear executionYear = rootDomainObject.readExecutionYearByOID(executionYearID);        InsuranceValue insuranceValue = executionYear.getInsuranceValue();        if (insuranceValue == null) {            throw new InsuranceNotDefinedServiceException("error.insurance.notDefinedForThisYear");        }        Date insurancePaymentStartDate = Calendar.getInstance().getTime();        Date insurancePaymentEndDate = paymentEndDate;        String shortYear = executionYear.getYear().split("/")[0].trim().substring(2);        // read master degree and persistentSupportecialization execution        // degrees        List executionDegreeList = ExecutionDegree.getAllByExecutionYearAndDegreeType(executionYear                .getYear(), DegreeType.MASTER_DEGREE);        int totalLines = 0;        Set<Integer> studentsWithInsuranceChecked = new HashSet<Integer>();        // add file header        addHeader(outgoingSibsPaymentFile);        // add lines gratuity        for (Iterator iter = executionDegreeList.iterator(); iter.hasNext();) {            ExecutionDegree executionDegree = (ExecutionDegree) iter.next();            DegreeCurricularPlan degreeCurricularPlan = executionDegree.getDegreeCurricularPlan();            List studentCurricularPlanList = degreeCurricularPlan.getStudentCurricularPlans();            // add insurance lines            for (Iterator iterator = studentCurricularPlanList.iterator(); iterator.hasNext();) {                StudentCurricularPlan studentCurricularPlan = (StudentCurricularPlan) iterator.next();                if (studentCurricularPlan.getSpecialization().equals(Specialization.SPECIALIZATION)) {                    if (!executionDegree.isFirstYear()) {                        continue;                    }                }                Registration registration = studentCurricularPlan.getStudent();                if (studentsWithInsuranceChecked.contains(registration.getIdInternal()) == false) {                    studentsWithInsuranceChecked.add(registration.getIdInternal());                    List insuranceTransactionList = registration                            .readAllNonReimbursedInsuranceTransactionsByExecutionYear(executionYear);                    if (insuranceTransactionList.size() == 0) {                        // the student hasn't payed the insurance for this                        // year                        // yet                        addLine(outgoingSibsPaymentFile,                                SibsOutgoingPaymentFileConstants.LINE_REGISTER_TYPE,                                SibsOutgoingPaymentFileConstants.LINE_PROCESSING_CODE, shortYear,                                registration.getNumber(), SibsPaymentCodeFactory                                        .getCode(SibsPaymentType.INSURANCE)                                        + "", insurancePaymentStartDate, insurancePaymentEndDate,                                insuranceValue.getAnnualValue(), insuranceValue.getAnnualValue());                        totalLines++;                    }                }                GratuityValues gratuityValues = executionDegree.getGratuityValues();                if (gratuityValues != null) {                    // Add gratuity lines                    GratuitySituation gratuitySituation = studentCurricularPlan                            .getGratuitySituationByGratuityValues(executionDegree.getGratuityValues());                    if (gratuitySituation != null) {                        totalLines += addGratuityLines(outgoingSibsPaymentFile, gratuitySituation,                                shortYear, paymentEndDate);                    } else {                        System.out.println("Registration " + registration.getNumber()                                + " does not have a gratuity situation for year "                                + executionDegree.getExecutionYear().getYear() + " Degree "                                + executionDegree.getDegreeCurricularPlan().getName());                    }                }            }        }        // add file footer        addFooter(outgoingSibsPaymentFile, totalLines);        byte[] fileContent = writeOutgoingSibsPaymentFile(executionYear, outgoingSibsPaymentFile);        return fileContent;    }