for (Registration registration : RootDomainObject.getInstance().getRegistrations()) { Person person = registration.getPerson(); if (registration.getDegreeType().equals(DegreeType.MASTER_DEGREE) && ((studentNameToMatch != null && person.getName().toLowerCase().matches( studentNameToMatch)) || studentNameToMatch == null) && ((docIdNumber != null && person.getDocumentIdNumber().equals(docIdNumber)) || docIdNumber == null) && ((idType != null && person.getIdDocumentType().equals(idType)) || idType == null) && ((studentNumber != null && registration.getNumber().equals(studentNumber)) || studentNumber == null)) {
for (Registration registration : RootDomainObject.getInstance().getRegistrations()) { Person person = registration.getPerson(); if ((registration.getDegreeType().equals(DegreeType.MASTER_DEGREE) || registration .getDegreeType().equals(DegreeType.BOLONHA_ADVANCED_FORMATION_DIPLOMA)) && ((studentNameToMatch != null && person.getName().toLowerCase().matches( studentNameToMatch)) || studentNameToMatch == null) && ((docIdNumber != null && person.getDocumentIdNumber().equals(docIdNumber)) || docIdNumber == null) && ((idType != null && person.getIdDocumentType().equals(idType)) || idType == null) && ((studentNumber != null && registration.getNumber().equals(studentNumber)) || studentNumber == null)) {
    public static List<Registration> readMasterDegreeStudentsByNameDocIDNumberIDTypeAndStudentNumber(            String studentName, String docIdNumber, IDDocumentType idType, Integer studentNumber) {        final List<Registration> students = new ArrayList();        final String studentNameToMatch = (studentName == null) ? null : studentName.replaceAll("%",                ".*").toLowerCase();        for (Registration registration : RootDomainObject.getInstance().getRegistrations()) {            Person person = registration.getPerson();            if (registration.getDegreeType().equals(DegreeType.MASTER_DEGREE)                    && ((studentNameToMatch != null && person.getName().toLowerCase().matches(                            studentNameToMatch)) || studentNameToMatch == null)                    && ((docIdNumber != null && person.getDocumentIdNumber().equals(docIdNumber)) || docIdNumber == null)                    && ((idType != null && person.getIdDocumentType().equals(idType)) || idType == null)                    && ((studentNumber != null && registration.getNumber().equals(studentNumber)) || studentNumber == null)) {                students.add(registration);            }        }        return students;    }