@Override public String getI18nMessage(ITranslationProvider translationProvider, Locale locale) { StringBuilder boundsSpec = new StringBuilder(); boundsSpec.append("x"); if (getMaxMillis() != null) { boundsSpec.append(" <= ").append(getMaxMillis()); } return translationProvider.getTranslation("integrity.property.toobig", new Object[]{getI18nName(translationProvider, locale), boundsSpec, component}, locale); }
/** * Handles max value. * <p/> * {@inheritDoc} */ @Override public void preprocessSetter(final Object component, final Object newValue) { super.preprocessSetter(component, newValue); if (newValue != null && getMaxMillis() != null && (Long) newValue > getMaxMillis()) { IntegrityException ie = new IntegrityException("[" + getName() + "] value is too high on [" + component + "].") { private static final long serialVersionUID = 7459823123892198831L; @Override public String getI18nMessage(ITranslationProvider translationProvider, Locale locale) { StringBuilder boundsSpec = new StringBuilder(); boundsSpec.append("x"); if (getMaxMillis() != null) { boundsSpec.append(" <= ").append(getMaxMillis()); } return translationProvider.getTranslation("integrity.property.toobig", new Object[]{getI18nName(translationProvider, locale), boundsSpec, component}, locale); } }; throw ie; } }
/** * {@inheritDoc} */ @Override public BasicPropertyDescriptor createQueryDescriptor() { BasicDurationPropertyDescriptor queryDescriptor = (BasicDurationPropertyDescriptor) super.createQueryDescriptor(); queryDescriptor.setMaxMillis(null); return queryDescriptor; }