try {
boolean printResponsable = false;
boolean printCodeBar = false;
if(viewStudentRadio.getSelection()){
personList.clear();
Map<String, Person> personMap = (Map<String, Person>) system.query(new GetStudent());
for (Person person : personMap.values()) {
personList.add(person);
}
orderPersonList();
printResponsable = false;
printCodeBar = false;
} else if(viewStudentRegisteredRadio.getSelection()){
boolean isNotAdd = true;
personList.clear();
Map<String, Person> personMap = (Map<String, Person>) system.query(new GetStudent());
for (Person person : personMap.values()) {
try {
isNotAdd = true;
List<Registration> registrationMap = (List<Registration>) (system.query(new GetRegistrationByPerson(person.getId())));
for (Registration registration : registrationMap) {
if(registration.isActive() && isNotAdd) {
personList.add(person);
isNotAdd = false;
}
}
} catch (RegistrationDoesNotExistsInPersistenceException e) {
}
}
orderPersonList();
printResponsable = false;
printCodeBar = false;
} else if(viewStudentWithoutRegistrationRadio.getSelection()){
personList.clear();
boolean canBeAdd = false;
Map<String, Person> personMap = (Map<String, Person>) system.query(new GetStudent());
for (Person person : personMap.values()) {
try {
canBeAdd = false;
List<Registration> registrationMap = (List<Registration>) system.query(new GetRegistrationByPerson(person.getId()));
for (Registration registration : registrationMap) {
if(!registration.isActive()) {
canBeAdd = true;
} else {
canBeAdd = false;
break;
}
}
if(canBeAdd) {
personList.add(person);
}
} catch (RegistrationDoesNotExistsInPersistenceException e) {
}
}
orderPersonList();
printResponsable = false;
printCodeBar = false;
} else if(viewCodeBarStudentsRadio.getSelection()){
personList.clear();
Map<String, Person> personMap = (Map<String, Person>) system.query(new GetStudent());
for (Person person : personMap.values()) {
personList.add(person);
}
orderPersonList();
printResponsable = false;