private void init() {
   Server server = serverController.getSelectedServer();
   partnershipList = null;
   if (server != null) {
     jDBCDataSource.setParameters(
         server.getDbAddress(),
         server.getDbPort(),
         server.getDbName(),
         server.getDbUser(),
         server.getDbPassword());
     partnershipManager.setjDBCDataSource(jDBCDataSource);
     partnershipList = partnershipManager.getAllPartnerships();
     //            selectedPartnership = null;
   }
 }
 public void addPartnership() {
   Server server = serverController.getSelectedServer();
   if (server != null) {
     partnershipManager.addPartnership(newPartnership);
   }
   // TODO cos na widok jesli blad
 }
 public void deletePartnership() {
   if (selectedPartnership != null) {
     if (partnershipManager.deletePartnership(selectedPartnership)) {
       init();
     } else {
       Messages.addError("partnershipDelete", bundle.getString("partnership.dialog.delete.error"));
       Faces.getContext().validationFailed();
     }
   } else {
     Messages.addError("partnershipDelete", bundle.getString("partnership.dialog.delete.error"));
     Faces.getContext().validationFailed();
   }
 }
 public void deleteAllPartnerships() {
   boolean error = false;
   init();
   for (PartnershipDVO partnershipDVO : partnershipList) {
     if (false == partnershipManager.deletePartnership(partnershipDVO)) {
       error = true;
     }
   }
   init();
   if (error) {
     Faces.getContext().validationFailed();
   }
 }
 public void editPartnership() {
   if (selectedPartnership != null) {
     if (partnershipManager.updatePartnership(selectedPartnership) == true) {
       init();
     } else {
       Messages.addError("partnershipUpdate", bundle.getString("partnership.dialog.update.error"));
       Faces.getContext().validationFailed();
     }
   } else {
     Messages.addError(
         "partnershipUpdate", bundle.getString("partnership.dialog.update.error.notselected"));
     Faces.getContext().validationFailed();
   }
 }
 public void createNewPartnership() {
   newPartnership = partnershipManager.createPartnershipDVO();
 }