- Timestamp:
- 07/30/08 15:52:50 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs/trunk/src/api/org/openmrs/api/db/hibernate/HibernatePatientDAO.java
r4551 r5094 142 142 143 143 /** 144 * @see org.openmrs.api.db.PatientDAO#getPatients(java.lang.String, java.lang.String, java.util.List )144 * @see org.openmrs.api.db.PatientDAO#getPatients(java.lang.String, java.lang.String, java.util.List, boolean) 145 145 */ 146 146 @SuppressWarnings("unchecked") 147 147 public List<Patient> getPatients(String name, String identifier, 148 List<PatientIdentifierType> identifierTypes ) throws DAOException {148 List<PatientIdentifierType> identifierTypes, boolean matchIdentifierExactly) throws DAOException { 149 149 150 150 Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Patient.class); … … 202 202 AdministrationService adminService = Context.getAdministrationService(); 203 203 String regex = adminService.getGlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_PATIENT_IDENTIFIER_REGEX, ""); 204 205 // if the regex is empty, default to a simple "like" search or if 206 // we're in hsql world, also only do the simple like search (because 207 // hsql doesn't know how to deal with 'regexp' 208 if (regex.equals("") || HibernateUtil.isHSQLDialect(sessionFactory)) { 209 String prefix = adminService.getGlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_PATIENT_IDENTIFIER_PREFIX, ""); 204 205 // if the user wants an exact search, match on that. 206 if (matchIdentifierExactly) { 207 criteria.add(Expression.eq("ids.identifier", identifier)); 208 } 209 // if the regex is empty, default to a simple "like" search or if 210 // we're in hsql world, also only do the simple like search (because 211 // hsql doesn't know how to deal with 'regexp' 212 else if (regex.equals("") || HibernateUtil.isHSQLDialect(sessionFactory)) { 213 String prefix = adminService.getGlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_PATIENT_IDENTIFIER_PREFIX, ""); 210 214 String suffix = adminService.getGlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_PATIENT_IDENTIFIER_SUFFIX, ""); 211 215 StringBuffer likeString = new StringBuffer(prefix).append(identifier)