}
private void addCommunication() {
String[] selected = getSessionBean1().getChoices();
CommunicationController comCtl = new CommunicationController();
ContactController contactCtl = new ContactController();
Contact contact = getContact();
Communication communication = getCommunication();
//Create communication (needed for new object)
communication = comCtl.update(communication);
//Insert the participants after converting the array to List
java.util.List<Contact> participants = new ArrayList<Contact>();
participants.add(contact);
if (selected != null) {
for (int i= 0; i < selected.length; i++) {
Contact aParticipant = contactCtl.parse("["+selected[i]+"]");
if (aParticipant != null && !aParticipant.equals(contact)) {
participants.add(aParticipant);
}
}
}
communication = comCtl.updateParticipants(communication, participants);
// update the current properties in the session
setCommunication(communication);
contact = contactCtl.read(contact.getIdContact());
setContact(contact);
}