PartyType.DEGREE))
PartyTypeEnum.DEGREE))
    private void setDegree(Integer degreeID, Unit unit)            throws ExcepcaoPersistencia {        Degree degree = null;        if (degreeID != null                && unit.getType() != null                && (unit.getType().equals(PartyType.DEGREE) || unit.getType().equals(                        PartyType.MASTER_DEGREE))) {            degree = (Degree) persistentObject.readByOID(Degree.class,                    degreeID);            if ((degree.getTipoCurso().equals(DegreeType.DEGREE) && unit.getType().equals(                    PartyType.DEGREE))                    || (degree.getTipoCurso().equals(DegreeType.MASTER_DEGREE) && unit.getType().equals(                            PartyType.MASTER_DEGREE))){                unit.setDegree(degree);               }                            else if(unit.getDegree() != null){                unit.removeDegree();            }        } else if (((degreeID != null && unit.getType() != null) || degreeID == null)                && unit.getDegree() != null) {            unit.removeDegree();        }    }