private void setIndividuals() throws SQLException, RemoteException { try { setCohorts(); List<Object[]> tmpIndividuals = MedSavantClient.PatientManager.getBasicPatientInfo( LoginController.getSessionID(), ProjectController.getInstance().getCurrentProjectID(), Integer.MAX_VALUE); List<Object[]> updatedIndividuals = new ArrayList<Object[]>(); for (Object[] row : tmpIndividuals) { row[INDEX_OF_GENDER] = ClientMiscUtils.genderToString((Integer) row[INDEX_OF_GENDER]); String s; Object o = row[INDEX_OF_AFFECTED]; if (o instanceof Boolean) { Boolean b = (Boolean) o; s = b ? "Yes" : "No"; } else if (o instanceof Integer) { Integer i = (Integer) o; s = (i > 0) ? "Yes" : "No"; } else { s = "Unknown"; } row[INDEX_OF_AFFECTED] = s; /*Boolean b = (Boolean) row[INDEX_OF_AFFECTED]; String s = b ? "Yes" : "No"; row[INDEX_OF_AFFECTED] = s;*/ List<String> cohorts = hospitalIDToCohortMap.get((String) row[INDEX_OF_HOSPITAL_ID]); String cohortString = ""; if (cohorts != null) { cohortString = StringUtils.join(cohorts.toArray(), ", "); } row = ArrayUtils.addAll(row, new String[] {cohortString}); updatedIndividuals.add(row); } individuals = updatedIndividuals; } catch (SessionExpiredException e) { MedSavantExceptionHandler.handleSessionExpiredException(e); } }
@Override public void editItem(Object[] items) { try { String projName = (String) items[0]; int projID = MedSavantClient.ProjectManager.getProjectID( LoginController.getInstance().getSessionID(), projName); // Check for existing unpublished changes to this project. if (ProjectController.getInstance().promptForUnpublished()) { try { // Get lock. if (MedSavantClient.SettingsManager.getDBLock( LoginController.getInstance().getSessionID())) { try { ProjectWizard wiz = new ProjectWizard( projID, projName, MedSavantClient.PatientManager.getCustomPatientFields( LoginController.getInstance().getSessionID(), projID), MedSavantClient.ProjectManager.getProjectDetails( LoginController.getInstance().getSessionID(), projID)); wiz.setVisible(true); } finally { try { MedSavantClient.SettingsManager.releaseDBLock( LoginController.getInstance().getSessionID()); } catch (Exception ex1) { LOG.error("Error releasing database lock.", ex1); } } } else { DialogUtils.displayMessage( "Cannot Modify Project", "The database is currently locked.\nTo unlock, see the Projects page in the Administration section."); } } catch (Exception ex) { ClientMiscUtils.reportError("Error getting database lock: %s", ex); } } } catch (Exception ex) { ClientMiscUtils.reportError("Error checking for changes: %s", ex); } }