Example usage for org.springframework.dao IncorrectResultSizeDataAccessException getMessage

List of usage examples for org.springframework.dao IncorrectResultSizeDataAccessException getMessage

Introduction

In this page you can find the example usage for org.springframework.dao IncorrectResultSizeDataAccessException getMessage.

Prototype

@Override
@Nullable
public String getMessage() 

Source Link

Document

Return the detail message, including the message from the nested exception if there is one.

Usage

From source file:com.sfs.whichdoctor.dao.WhichDoctorDAOImpl.java

/**
 * Load sibling beans./*  w ww  .  j a v  a2  s.c o  m*/
 *
 * @param guid the guid
 * @param type the type
 *
 * @return the tree map< integer, collection< which doctor bean>>
 *
 * @throws WhichDoctorDaoException the whichdoctor dao exception
 */
@SuppressWarnings("unchecked")
private TreeMap<Integer, Collection<WhichDoctorBean>> loadSiblingBeans(final int guid, final String type)
        throws WhichDoctorDaoException {

    dataLogger.info("Sibling history of GUID: " + guid + " requested");

    String loadSQL = getSQL().getValue("whichdoctor/load/memo");

    if (type.compareToIgnoreCase("membership") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/membership");
    }
    if (type.compareToIgnoreCase("address") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/address");
    }
    if (type.compareToIgnoreCase("phone") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/phone");
    }
    if (type.compareToIgnoreCase("email") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/email");
    }
    if (type.compareToIgnoreCase("specialty") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/specialty");
    }
    if (type.compareToIgnoreCase("workshop") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/workshop");
    }
    if (type.compareToIgnoreCase("rotation") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/rotationSibling");
    }
    if (type.compareToIgnoreCase("project") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/project");
    }
    if (type.compareToIgnoreCase("exam") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/exam");
    }
    if (type.compareToIgnoreCase("qualification") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/qualification");
    }
    if (type.compareToIgnoreCase("accreditation") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/accreditation");
    }
    if (type.compareToIgnoreCase("assessment") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/assessment");
    }
    if (type.compareToIgnoreCase("report") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/report");
    }
    if (type.compareToIgnoreCase("expenseclaim") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/expenseClaim");
    }
    if (type.compareToIgnoreCase("payment") == 0) {
        loadSQL = getSQL().getValue("whichdoctor/load/payment");
    }

    TreeMap<Integer, Collection<WhichDoctorBean>> siblings = new TreeMap<Integer, Collection<WhichDoctorBean>>();

    try {
        Collection<WhichDoctorBean> siblingCollection = this.getJdbcTemplateReader().query(loadSQL,
                new Object[] { guid }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        WhichDoctorBean whichdoctorBean = loadHistory(rs);
                        whichdoctorBean.setObjectType(type);

                        return whichdoctorBean;
                    }
                });

        for (WhichDoctorBean whichdoctorBean : siblingCollection) {

            Collection<WhichDoctorBean> history = new ArrayList<WhichDoctorBean>();
            if (siblings.containsKey(whichdoctorBean.getGUID())) {
                history = siblings.get(whichdoctorBean.getGUID());
            }
            history.add(whichdoctorBean);

            siblings.put(whichdoctorBean.getGUID(), history);
        }

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No results found for this search: " + ie.getMessage());
    }
    return siblings;
}

From source file:com.sfs.whichdoctor.dao.AddressVerificationDAOImpl.java

/**
 * Load a collection of address verification beans that are capable of being
 * processed by WhichDoctor and are pending processing.
 *
 * @param count the requested number/*from  ww  w.  j a va2s . co m*/
 * @return the pending address verification beans
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
@SuppressWarnings("unchecked")
public final Collection<AddressVerificationBean> loadPending(final int count) throws WhichDoctorDaoException {

    Collection<AddressVerificationBean> addressVerifications = new ArrayList<AddressVerificationBean>();

    Collection<Object> parameters = new ArrayList<Object>();
    parameters.add(PENDING);

    StringBuffer sqlWHERE = new StringBuffer();

    Collection<String> codes = this.getProcessableReturnCodes();
    for (String code : codes) {
        if (sqlWHERE.length() > 0) {
            sqlWHERE.append(" OR ");
        }
        sqlWHERE.append("address_verification.ReturnCode LIKE ?");
        parameters.add(code + "%");
    }
    if (sqlWHERE.length() > 0) {
        sqlWHERE.insert(0, " AND (");
        sqlWHERE.append(")");
    }

    parameters.add(count);
    sqlWHERE.append(" LIMIT ?");

    String loadPending = this.getSQL().getValue("addressVerification/loadPending") + sqlWHERE.toString();

    try {
        addressVerifications = this.getJdbcTemplateReader().query(loadPending, parameters.toArray(),
                new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadAddressVerification(rs);
                    }
                });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("Could not find any pending addresses: " + ie.getMessage());
    }

    // Update the status of these pending records
    for (AddressVerificationBean av : addressVerifications) {
        // Update the process status to 'Processing' for these records
        updateProcessStatus(av.getAddressVerificationId(), PROCESSING, "");
    }

    return addressVerifications;
}

From source file:com.sfs.whichdoctor.dao.IsbEntityDAOImpl.java

/**
 * Loads an IsbEntityBean for a specified id.
 *
 * @param id the id/* w  w  w. ja  v  a  2  s. c o  m*/
 *
 * @return the isb entity bean
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
public final IsbEntityBean load(final int id) throws WhichDoctorDaoException {
    dataLogger.info("ISB entitiy for Id: " + id);

    IsbEntityBean entity = null;
    try {
        entity = (IsbEntityBean) this.getJdbcTemplateReader().queryForObject(
                this.getSQL().getValue("isbentity/loadId"), new Object[] { id }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadIsbEntity(rs);
                    }
                });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No results found for search: " + ie.getMessage());
    }
    return entity;
}

From source file:com.sfs.whichdoctor.dao.IsbEntityDAOImpl.java

/**
 * Loads an IsbEntityBean for an identified target/guid combination. If none
 * found returns null//from  w  w  w. j  av  a 2s. c om
 *
 * @param target the target
 * @param guid the guid
 *
 * @return the isb entity bean
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
public final IsbEntityBean load(final String target, final int guid) throws WhichDoctorDaoException {

    if (target == null) {
        throw new NullPointerException("The supplied target cannot be null");
    }

    dataLogger.info("ISB entities  for target: " + target + " requested");

    IsbEntityBean entity = null;

    try {
        entity = (IsbEntityBean) this.getJdbcTemplateReader().queryForObject(
                this.getSQL().getValue("isbentity/loadTargetId"), new Object[] { target, guid, true },
                new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadIsbEntity(rs);
                    }
                });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No results found for search: " + ie.getMessage());
    }
    return entity;
}

From source file:com.sfs.whichdoctor.dao.IsbEntityDAOImpl.java

/**
 * Loads an entity bean for an identified target/identifier combination.
 *
 * @param target the target//from www . j  av  a 2 s .  c om
 * @param identifier the identifier
 *
 * @return the isb entity bean
 *
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
public final IsbEntityBean load(final String target, final String identifier) throws WhichDoctorDaoException {

    if (target == null) {
        throw new NullPointerException("The supplied target cannot be null");
    }
    if (identifier == null) {
        throw new NullPointerException("The supplied identifier cannot be null");
    }

    dataLogger.info("ISB entities  for target: " + target + " requested");

    IsbEntityBean entity = null;
    try {
        entity = (IsbEntityBean) this.getJdbcTemplateReader().queryForObject(
                this.getSQL().getValue("isbentity/loadTargetIdentifier"),
                new Object[] { target, identifier, true }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadIsbEntity(rs);
                    }
                });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No results found for search: " + ie.getMessage());
    }
    return entity;
}

From source file:com.sfs.dao.GadgetPreferencesDAOImpl.java

/**
 * Load a GadgetPreferencesBean with the specified gadgetPreferencesId.
 *
 * @param gadgetPreferenceId the gadget preference id
 *
 * @return the gadget preferences bean//from   w w w .  jav a  2s .  co m
 *
 * @throws SFSDaoException the SFS dao exception
 */
public final GadgetPreferencesBean load(final int gadgetPreferenceId) throws SFSDaoException {
    if (gadgetPreferenceId == 0) {
        throw new SFSDaoException("Cannot load a Gadget preference with an Id of 0");
    }

    GadgetPreferencesBean gadgetPreferences = null;

    dataLogger.debug("Load gadget preferences for gadget preference id: " + gadgetPreferenceId);

    try {
        gadgetPreferences = (GadgetPreferencesBean) this.getJdbcTemplateReader().queryForObject(
                getSQL().getValue("gadget/preferences/loadId"), new Object[] { gadgetPreferenceId },
                new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadGadgetPreferences(rs);
                    }
                });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No results found for this search: " + ie.getMessage());
    }
    return gadgetPreferences;
}

From source file:com.sfs.whichdoctor.dao.AddressVerificationDAOImpl.java

/**
 * Load the address verification beans associated with the supplied address guid.
 *
 * @param guid the guid/* w  w  w .j  a v a2s  .co  m*/
 * @return the address verification bean
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
@SuppressWarnings("unchecked")
public final Collection<AddressVerificationBean> loadGUID(final int guid) throws WhichDoctorDaoException {

    Collection<AddressVerificationBean> addressVerifications = new ArrayList<AddressVerificationBean>();

    String loadGUID = this.getSQL().getValue("addressVerification/loadGUID");

    try {
        addressVerifications = this.getJdbcTemplateReader().query(loadGUID, new Object[] { guid },
                new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadAddressVerification(rs);
                    }
                });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug(
                "Could not find an address verification record for GUID (" + guid + "): " + ie.getMessage());
    }
    return addressVerifications;
}

From source file:com.sfs.whichdoctor.dao.AddressVerificationDAOImpl.java

/**
 * Load a collection of address verification beans that are pending verification
 * which are  associated with the supplied address guid.
 *
 * @param guid the guid//from w  w  w .ja  va2s  .c o m
 * @return the address verification beans
 * @throws WhichDoctorDaoException the which doctor dao exception
 */
@SuppressWarnings("unchecked")
public final Collection<AddressVerificationBean> loadPendingForGUID(final int guid)
        throws WhichDoctorDaoException {

    Collection<AddressVerificationBean> addressVerifications = new ArrayList<AddressVerificationBean>();

    String loadGUID = this.getSQL().getValue("addressVerification/loadGUID") + " AND processstatus.Class = ?";

    try {
        addressVerifications = this.getJdbcTemplateReader().query(loadGUID, new Object[] { guid, PENDING },
                new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadAddressVerification(rs);
                    }
                });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug(
                "Could not find an address verification record for GUID (" + guid + "): " + ie.getMessage());
    }
    return addressVerifications;
}

From source file:com.sfs.dao.GadgetPreferencesDAOImpl.java

/**
 * Load a HashMap of GadgetPreferencesBean for a supplied userDn.
 *
 * @param userDn the user dn//from ww w  . ja  v  a 2  s  .  com
 *
 * @return the hash map< integer, gadget preferences bean>
 *
 * @throws SFSDaoException the SFS dao exception
 */
@SuppressWarnings("unchecked")
public final HashMap<Integer, GadgetPreferencesBean> loadMap(final String userDn) throws SFSDaoException {
    if (userDn == null) {
        throw new SFSDaoException("User DN cannot be null");
    }
    if (userDn.compareTo("") == 0) {
        throw new SFSDaoException("User DN cannot be an empty string");
    }

    HashMap<Integer, GadgetPreferencesBean> gadgetMap = new HashMap<Integer, GadgetPreferencesBean>();
    Collection<GadgetPreferencesBean> gadgetCollection = new ArrayList<GadgetPreferencesBean>();

    dataLogger.debug("Load gadget preferences for: " + userDn);

    try {
        gadgetCollection = this.getJdbcTemplateReader().query(getSQL().getValue("gadget/preferences/load"),
                new Object[] { userDn }, new RowMapper() {
                    public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException {
                        return loadGadgetPreferences(rs);
                    }
                });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No results found for this search: " + ie.getMessage());
    }

    for (GadgetPreferencesBean gadgetPreferences : gadgetCollection) {
        gadgetMap.put(gadgetPreferences.getId(), gadgetPreferences);
    }
    return gadgetMap;
}

From source file:com.sfs.dao.GadgetPreferencesDAOImpl.java

/**
 * Delete the supplied GadgetPreferencesBean from the datastore.
 *
 * @param gadgetPreferences the gadget preferences
 *
 * @return true, if delete/*from  w ww  .j a  v a2s. c  o m*/
 *
 * @throws SFSDaoException the SFS dao exception
 */
public final boolean delete(final GadgetPreferencesBean gadgetPreferences) throws SFSDaoException {
    if (gadgetPreferences.getId() == 0) {
        throw new SFSDaoException("Gadget preference Id cannot be zero");
    }
    if (gadgetPreferences.getUserDn() == null) {
        throw new SFSDaoException("User DN cannot be null");
    }
    if (gadgetPreferences.getUserDn().compareTo("") == 0) {
        throw new SFSDaoException("User DN cannot be an empty string");
    }

    boolean success = false;

    dataLogger.info(gadgetPreferences.getUserDn() + " attempting to delete gadget preference id: "
            + gadgetPreferences.getId());

    int deleteCount = 0;
    try {
        deleteCount = this.getJdbcTemplateWriter().update(getSQL().getValue("gadget/preferences/delete"),
                new Object[] { gadgetPreferences.getId() });

    } catch (IncorrectResultSizeDataAccessException ie) {
        dataLogger.debug("No results found for this search: " + ie.getMessage());
    }

    if (deleteCount > 0) {
        dataLogger.info(gadgetPreferences.getUserDn() + " successfully deleted gadget preference entry");
        success = true;
    }
    return success;
}