private boolean fieldsOk() { boolean allEmpty = true; for (PatientIdentifier newId : identiers) { if (newId.getValueEdit() == null || newId.getValueEdit().isEmpty()) continue; allEmpty = false; String illegalText = iDARTUtil.checkPatientId(newId.getValueEdit()); if (illegalText != null) { showMessage( MessageDialog.ERROR, MessageFormat.format( Messages.getString("patient.error.badCharacterInPatientId.title"), // $NON-NLS-1$ illegalText), MessageFormat.format( Messages.getString("patient.error.badCharacterInPatientId"), // $NON-NLS-1$ iDartProperties.illegalPatientIdChars)); return false; } if (PatientManager.checkPatientIdentifier( getHSession(), newId.getPatient(), newId.getType(), newId.getValueEdit())) { showMessage( MessageDialog.ERROR, Messages.getString("PatientIdDialog.error.exists.title"), // $NON-NLS-1$ MessageFormat.format( Messages.getString("PatientIdDialog.error.exists.message"), // $NON-NLS-1$ newId.getType().getName(), newId.getValueEdit())); return false; } List<Patient> altPatients = PatientManager.getPatientsByAltId(getHSession(), newId.getType(), newId.getValueEdit()); if (!altPatients.isEmpty()) { String patientsWithThisOldId = EMPTY; for (Patient p : altPatients) { patientsWithThisOldId += (p.getPatientId() + ", "); // $NON-NLS-1$ } patientsWithThisOldId = patientsWithThisOldId.substring(0, patientsWithThisOldId.length() - 2); MessageBox mSave = new MessageBox(getShell(), SWT.ICON_WARNING | SWT.YES | SWT.NO); mSave.setText(Messages.getString("patient.warning.saveDuplicateId.title")); // $NON-NLS-1$ mSave.setMessage( MessageFormat.format( Messages.getString("patient.warning.saveDuplicateId"), // $NON-NLS-1$ patientsWithThisOldId)); if (mSave.open() != SWT.YES) { return false; } } } if (allEmpty) { showMessage( MessageDialog.ERROR, Messages.getString("PatientIdDialog.error.empty.title"), // $NON-NLS-1$ Messages.getString("PatientIdDialog.error.empyt.message")); // $NON-NLS-1$ return false; } return true; }