public static void putPageParameters( final ISelectCallerPage callerPage, final Object dataObject, final Object filterObject, final PageParameters pageParameters, final String[] bookmarkableProperties) { if (bookmarkableProperties == null) { return; } // final String pre = prefix != null ? prefix + "." : ""; for (final String propertyString : bookmarkableProperties) { final InitialPageParameterHolder paramHolder = new InitialPageParameterHolder(propertyString); final Object bean; if (paramHolder.isFilterParameter() == true) { bean = filterObject; } else { bean = dataObject; } try { final Object value = BeanHelper.getProperty(bean, paramHolder.property); WicketUtils.putPageParameter(pageParameters, paramHolder.prefix + paramHolder.alias, value); } catch (final Exception ex) { log.warn( "Couldn't put page parameter '" + paramHolder.property + "' of bean '" + bean + "'. Ignoring this parameter."); } } }
/** * Shorten the length of the property if to long for the data-base. No log message is produced. * The field must be declared with JPA annotations in the given class (clazz). For getting and * setting the property the getter and setter method is used. * * @param clazz The class where the field is declared. * @param object * @param propertyName * @return true If the property was shortened. */ public static boolean shortenProperty( final Class<?> clazz, final Object object, final String propertyName) { final Integer length = getPropertyLength(clazz, propertyName); if (length == null) { return false; } final String value = (String) BeanHelper.getProperty(object, propertyName); if (value != null && value.length() > length) { BeanHelper.setProperty(object, propertyName, value.substring(0, length - 1)); return true; } return false; }