@Override public Map<String, String> convertMapFromPageConfig( Map<String, String> properties, TPersonBean user, Locale locale, Integer entityId, Integer entityType, List<LabelValueBean> errors) { Map<String, String> map = super.convertMapFromPageConfig(properties, user, locale, entityId, entityType, errors); String tql = properties.get("tql"); if (tql == null || tql.length() == 0) { String localizedErr = LocalizeUtil.getParametrizedString( "common.err.required", new Object[] {BasePluginDashboardBL.getText("myTqlView.tql", locale)}, locale); errors.add(new LabelValueBean(localizedErr, "params.tql")); } else { List<ErrorData> criteriaErrors = new ArrayList<ErrorData>(); TqlBL.luceneQuery(tql, false, locale, null, criteriaErrors); if (!criteriaErrors.isEmpty()) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < criteriaErrors.size(); i++) { sb.append(ErrorHandlerJSONAdapter.createMessage(criteriaErrors.get(i), locale) + "</BR>"); } errors.add(new LabelValueBean(sb.toString(), "params.tql")); } } return map; }
/** * Get the attribute values for a TQL expression * * @param tqlExpression * @param personBean * @param locale * @param errors * @return */ @Override public List<TAttributeValueBean> loadTQLFilterAttributeValues( String tqlExpression, TPersonBean personBean, Locale locale, List<ErrorData> errors) { try { return getCustomAttributeValues( TqlBL.createCriteria(tqlExpression, personBean, locale, errors)); } catch (TorqueException e) { LOGGER.error( "Loading the custom option attribute values for TQL report failed with " + e.getMessage()); return new ArrayList<TAttributeValueBean>(); } }