List of usage examples for org.springframework.dao IncorrectResultSizeDataAccessException getMessage
@Override
@Nullable
public String getMessage()
From source file:com.sfs.whichdoctor.dao.RelationshipDAOImpl.java
/** * Used to get a Collection of RelationshipBeans that are dependent on the * supplied GUID.// www .j ava2 s. c om * * @param guid the guid * @param loadDetails the load details * @return the collection< relationship bean> * * @throws WhichDoctorDaoException the which doctor dao exception */ @SuppressWarnings("unchecked") public final Collection<RelationshipBean> findDependencies(final int guid, final BuilderBean loadDetails) throws WhichDoctorDaoException { dataLogger.info("Dependent relationships for GUID: " + guid + " requested"); final String loadDependent = this.getSQL().getValue("relationship/findDependent"); Collection<RelationshipBean> relationships = new ArrayList<RelationshipBean>(); try { relationships = this.getJdbcTemplateReader().query(loadDependent, new Object[] { guid, true }, new RowMapper() { public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException { return loadRelationship(rs, loadDetails); } }); } catch (IncorrectResultSizeDataAccessException ie) { dataLogger.debug("No results found for search: " + ie.getMessage()); } return relationships; }
From source file:com.sfs.whichdoctor.dao.RelationshipDAOImpl.java
/** * Used to get a Collection of RelationshipBeans for a specified GUID. * * @param guid the guid/* w ww . ja v a 2s. com*/ * @param loadDetails the load details * @return the collection of relationship beans * @throws WhichDoctorDaoException the which doctor dao exception */ @SuppressWarnings("unchecked") public final Collection<RelationshipBean> load(final int guid, final BuilderBean loadDetails) throws WhichDoctorDaoException { dataLogger.info("Relationships for GUID: " + guid + " requested"); final String loadRelationships = this.getSQL().getValue("relationship/load") + " AND relationships.GUID = ?"; Collection<RelationshipBean> relationships = new ArrayList<RelationshipBean>(); try { relationships = this.getJdbcTemplateReader().query(loadRelationships, new Object[] { true, guid }, new RowMapper() { public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException { return loadRelationship(rs, loadDetails); } }); } catch (IncorrectResultSizeDataAccessException ie) { dataLogger.debug("No results found for search: " + ie.getMessage()); } return relationships; }
From source file:com.sfs.whichdoctor.dao.RelationshipDAOImpl.java
/** * Used to get a Collection of RelationshipBeans for a specified objecttype. * * @param objectType the ObjectTypeBean to load * @param loadDetails the load details//from w ww . ja v a 2 s. com * @return the collection< relationship bean> * * @throws WhichDoctorDaoException the which doctor dao exception */ @SuppressWarnings("unchecked") public final Collection<RelationshipBean> load(final ObjectTypeBean objectType, final BuilderBean loadDetails) throws WhichDoctorDaoException { dataLogger.info("Relationships for objectType: " + objectType.getObjectTypeId()); final String loadRelationships = this.getSQL().getValue("relationship/load") + " AND relationships.RelationshipTypeId = ?"; Collection<RelationshipBean> relationships = new ArrayList<RelationshipBean>(); try { relationships = this.getJdbcTemplateReader().query(loadRelationships, new Object[] { true, objectType.getObjectTypeId() }, new RowMapper() { public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException { return loadRelationship(rs, loadDetails); } }); } catch (IncorrectResultSizeDataAccessException ie) { dataLogger.debug("No results found for search: " + ie.getMessage()); } return relationships; }
From source file:com.sfs.whichdoctor.dao.RelationshipDAOImpl.java
/** * A private function to load the collection of supervisor * RelationshipBeans.// w w w .j a va2s. c o m * * @param relationshipClass the relatinship class * @return the collection< relationship bean> */ @SuppressWarnings("unchecked") private Collection<RelationshipBean> loadSupervisors(final String relationshipClass) { final String loadSupervisors = this.getSQL().getValue("relationship/loadSupervisors"); Collection<RelationshipBean> relationships = new ArrayList<RelationshipBean>(); try { relationships = this.getJdbcTemplateReader().query(loadSupervisors, new Object[] { "Relationship Type", relationshipClass }, new RowMapper() { public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException { RelationshipBean rel = new RelationshipBean(); rel.setRelationshipClass(rs.getString("RelationshipClass")); rel.setRelationshipType(rs.getString("RelationshipType")); rel.setDivision(rs.getString("Division")); rel.setHierarchy(rs.getInt("Hierarchy")); return rel; } }); } catch (IncorrectResultSizeDataAccessException ie) { dataLogger.debug("No results found for search: " + ie.getMessage()); } return relationships; }
From source file:com.sfs.whichdoctor.dao.AddressDAOImpl.java
/** * Load all the active AddressBeans./*from w w w. j av a 2 s . com*/ * * @return the collection * @throws WhichDoctorDaoException the which doctor dao exception */ @SuppressWarnings("unchecked") public final Collection<AddressBean> loadActive() throws WhichDoctorDaoException { final String loadActive = getSQL().getValue("address/load") + " WHERE address.Active = true"; Collection<AddressBean> addresses = new ArrayList<AddressBean>(); try { addresses = this.getJdbcTemplateReader().query(loadActive, new RowMapper() { public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException { return loadAddress(rs); } }); } catch (IncorrectResultSizeDataAccessException ie) { dataLogger.debug("No results found for search: " + ie.getMessage()); } return addresses; }
From source file:com.sfs.whichdoctor.dao.AddressDAOImpl.java
/** * Load and AddressBean based on its id. * * @param addressId the address id// w w w. j a va 2 s . c om * @return the address bean * @throws WhichDoctorDaoException the which doctor dao exception */ @SuppressWarnings("unchecked") public final AddressBean load(final int addressId) throws WhichDoctorDaoException { dataLogger.info("Getting addressId:" + addressId); final String loadId = this.getSQL().getValue("address/load") + " WHERE address.AddressId = ?"; AddressBean address = null; try { address = (AddressBean) this.getJdbcTemplateReader().queryForObject(loadId, new Object[] { addressId }, new RowMapper() { public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException { return loadAddress(rs); } }); } catch (IncorrectResultSizeDataAccessException ie) { dataLogger.debug("No results found for search: " + ie.getMessage()); } return address; }
From source file:com.sfs.whichdoctor.dao.AddressDAOImpl.java
/** * Load and AddressBean based on its guid. * * @param guid the guid/* w w w. ja v a 2 s .c om*/ * @return the address bean * @throws WhichDoctorDaoException the which doctor dao exception */ @SuppressWarnings("unchecked") public final AddressBean loadGUID(final int guid) throws WhichDoctorDaoException { dataLogger.info("Getting guid:" + guid); final String loadGUID = getSQL().getValue("address/load") + " WHERE address.GUID = ? AND Active = true"; AddressBean address = null; try { address = (AddressBean) this.getJdbcTemplateReader().queryForObject(loadGUID, new Object[] { guid }, new RowMapper() { public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException { return loadAddress(rs); } }); } catch (IncorrectResultSizeDataAccessException ie) { dataLogger.debug("No results found for search: " + ie.getMessage()); } return address; }
From source file:com.sfs.whichdoctor.dao.AddressDAOImpl.java
/** * Get a collection of AddressBeans for a specified GUID. * * @param guid the guid//from ww w . j a va2 s. co m * @param allAddresses the all addresses * @param addressClass the address class * @param addressType the address type * * @return the collection< address bean> * * @throws com.sfs.whichdoctor.dao.WhichDoctorDaoException * @throws * WhichDoctorDaoException the which doctor dao exception */ @SuppressWarnings("unchecked") public final Collection<AddressBean> load(final int guid, final boolean allAddresses, final String addressClass, final String addressType) throws WhichDoctorDaoException { dataLogger.info("Addresses for GUID: " + guid + " requested"); boolean specificAddress = false; String sql = getSQL().getValue("address/load") + " WHERE address.Active = true AND address.ReferenceGUID = ?"; Collection<Object> variables = new ArrayList<Object>(); /* The GUID value is the first variable */ variables.add(guid); if (addressClass != null) { if (addressClass.compareTo("") != 0 && addressClass.compareTo("Preferred") != 0) { sql += " AND addresstype.Class = ?"; variables.add(addressClass); specificAddress = true; } } if (addressType != null) { if (addressType.compareTo("") != 0 && addressType.compareTo("Preferred") != 0) { sql += " AND addresstype.Name = ?"; variables.add(addressType); specificAddress = true; } } sql += " ORDER BY PrimaryAddress DESC"; if (!allAddresses) { sql += " LIMIT 1"; } Collection<AddressBean> addresses = new ArrayList<AddressBean>(); try { addresses = this.getJdbcTemplateReader().query(sql, variables.toArray(), new RowMapper() { public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException { return loadAddress(rs); } }); } catch (IncorrectResultSizeDataAccessException ie) { dataLogger.debug("No results found for search: " + ie.getMessage()); } if (specificAddress && addresses.size() == 0) { /** * Specific address type defined but no result found Try getting a * more generic address */ if (addressType != null) { if (addressType.compareTo("") != 0) { addresses = load(guid, allAddresses, addressClass, null); } } if (addresses.size() == 0) { if (addressClass != null) { if (addressClass.compareTo("") != 0) { addresses = load(guid, allAddresses, null, null); } } } } return addresses; }
From source file:com.sfs.whichdoctor.dao.MembershipDAOImpl.java
/** * Check if the same number exists already. If it does then generate a new * number//from www. j a v a 2s .c o m * * @param personGUID the person guid * @param candidateNumber the candidate number * * @return true, if unique candidate number * * @throws WhichDoctorDaoException the which doctor dao exception */ private boolean uniqueCandidateNumber(final int personGUID, final String candidateNumber) throws WhichDoctorDaoException { boolean unique = true; try { int uniquenessCount = this.getJdbcTemplateReader().queryForInt( this.getSQL().getValue("membership/checkCandidateNo"), new Object[] { personGUID, candidateNumber }); if (uniquenessCount > 0) { /* The number is not unique */ unique = false; } } catch (IncorrectResultSizeDataAccessException ie) { dataLogger.debug("No results found for search: " + ie.getMessage()); } return unique; }
From source file:com.sfs.whichdoctor.dao.MembershipDAOImpl.java
/** * Load the MembershipBean based on the supplied membership id. * * @param membershipId the membership id * * @return the membership bean/*from w w w . ja v a2 s . co m*/ * * @throws WhichDoctorDaoException the which doctor dao exception */ public final MembershipBean load(final int membershipId) throws WhichDoctorDaoException { dataLogger.info("Getting membershipId:" + membershipId); final String loadSQL = getSQL().getValue("membership/load") + " WHERE membership.Id = ?"; MembershipBean membership = null; try { membership = (MembershipBean) this.getJdbcTemplateReader().queryForObject(loadSQL, new Object[] { membershipId }, new RowMapper() { public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException { return loadMembership(rs); } }); } catch (IncorrectResultSizeDataAccessException ie) { dataLogger.debug("No results found for search: " + ie.getMessage()); } return membership; }