/** * Take an array of anything and turn it into a string * * @param array any array * @return a string representing that array */ public static String arrayToString(Object[] array) { return ArrayUtils.arrayToString(array); }
/** * Take an array of anything and turn it into a string * * @param array any array * @return a string representing that array */ public static String arrayToString(Object[] array) { return ArrayUtils.arrayToString(array); }
/** * MUST override this method */ protected <T> int baseDeleteSet(Class<T> type, Serializable[] ids) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < ids.length; i++) { Object id = ids[i]; if (id != null) { if (i > 0) { sb.append(','); } sb.append('?'); } } String sql = makeSQL(getDeleteTemplate(type), getTableNameFromClass(type), StatementMapper.WHERE, "where " + getIdColumn(type) + " in (" + sb + ")"); if (showSQL) { logInfo("SQL="+sql+":\n BatchDelete="+ArrayUtils.arrayToString(ids)); } int changes = getSpringJdbcTemplate().update(sql, ids); return changes; }
newC = matched.newInstance(args); } catch (Exception e) { throw new IllegalArgumentException("Failure constructing object for class (" + type.getName() + ") with the given params: " + ArrayUtils.arrayToString(params), e); throw new IllegalArgumentException("Could not construct object for class (" + type.getName() + ") with the given params: " + ArrayUtils.arrayToString(params));
newC = matched.newInstance(args); } catch (Exception e) { throw new IllegalArgumentException("Failure constructing object for class (" + type.getName() + ") with the given params: " + ArrayUtils.arrayToString(params), e); throw new IllegalArgumentException("Could not construct object for class (" + type.getName() + ") with the given params: " + ArrayUtils.arrayToString(params));
if ( String.class.equals(toType) && ConstructorUtils.isClassSimple(componentType)) { return (T) ArrayUtils.arrayToString((Object[]) value); } else {
/** * MUST be overridden */ protected <T> boolean baseDelete(Class<T> type, Serializable id) { String idColumn = getIdColumn(type); String sql = makeSQL(getDeleteTemplate(type), getTableNameFromClass(type), StatementMapper.WHERE, "where " + idColumn + " = ?"); // convert the type if needed try { id = (Serializable) convertColumn(type, idColumn, id); } catch (ClassCastException e) { throw new IllegalArgumentException("all ids must be Serializable, change the property type defined in the names record for the id to be a Serializable type: " + e.getMessage(), e); } Object[] params = new Object[] {id}; if (showSQL) { logInfo("SQL="+sql+":\n Params="+ArrayUtils.arrayToString(params)); } int rows = getSpringJdbcTemplate().update(sql, params); return rows > 0; }
if ( String.class.equals(toType) && ConstructorUtils.isClassSimple(componentType)) { return (T) ArrayUtils.arrayToString((Object[]) value); } else {
protected <T> long baseCountBySearch(Class<T> type, Search search) { QueryData sd = makeQueryFromSearch(type, search); String sql = makeSQL(getSelectTemplate(type), getTableNameFromClass(type), StatementMapper.SELECT, "count(*)", StatementMapper.WHERE, sd.getAfterTableSQL()); if (showSQL) { logInfo("SQL="+sql+":\n Params="+ArrayUtils.arrayToString(sd.getArgs())); } long count = getSpringJdbcTemplate().queryForObject(sql, Long.class, sd.getArgs()); return count; }
+ArrayUtils.arrayToString(refs)+")", EntityRequestHandler.SLASH_BATCH, HttpServletResponse.SC_BAD_REQUEST);
+ArrayUtils.arrayToString(refs)+")", EntityRequestHandler.SLASH_BATCH, HttpServletResponse.SC_BAD_REQUEST);
/** * MUST be overridden */ @SuppressWarnings("unchecked") protected <T> T baseFindById(Class<T> type, Serializable id) { String idColumn = getIdColumn(type); String sql = makeSQL(getSelectTemplate(type), getTableNameFromClass(type), StatementMapper.WHERE, "where " + getIdColumn(type) + " = ?"); T entity = null; try { // convert the type if needed try { id = (Serializable) convertColumn(type, idColumn, id); } catch (ClassCastException e) { throw new IllegalArgumentException("all ids must be Serializable, change the property type defined in the names record for the id to be a Serializable type: " + e.getMessage(), e); } // get the map of values Object[] params = new Object[] {id}; if (showSQL) { logInfo("SQL="+sql+":\n Params="+ArrayUtils.arrayToString(params)); } Map<String, Object> data = getSpringJdbcTemplate().queryForMap(sql, params); entity = makeEntityFromMap(type, data); } catch (IncorrectResultSizeDataAccessException e) { entity = null; } return entity; }
logInfo("SQL="+sql+":\n Params="+ArrayUtils.arrayToString(sd.getArgs()));