Esempio n. 1
0
 private Map<String, Serializable> resolveDisplayExpressions(
     final List<FormWidget> widgets,
     final Map<String, Object> context,
     final FormServiceProvider formServiceProvider)
     throws FormNotFoundException, SessionTimeoutException, FileTooBigException, IOException,
         FormInitializationException {
   final Map<String, Serializable> resolvedExpressions =
       formServiceProvider.resolveExpressions(new DisplayExpressions(widgets).asList(), context);
   return resolvedExpressions != null ? resolvedExpressions : new HashMap<String, Serializable>();
 }
Esempio n. 2
0
  /**
   * set the widget values of a form page
   *
   * @param tenantID the tenant ID
   * @param widgets the widgets of the page
   * @param context the context including the URL parameters
   * @throws FormServiceProviderNotFoundException
   * @throws FormNotFoundException
   * @throws SessionTimeoutException
   * @throws IOException
   * @throws FileTooBigException
   * @throws FormInitializationException
   */
  public void setFormWidgetsValues(
      final long tenantID, final List<FormWidget> widgets, final Map<String, Object> context)
      throws FormNotFoundException, FormServiceProviderNotFoundException, SessionTimeoutException,
          IOException, FileTooBigException, FormInitializationException {
    final FormServiceProvider formServiceProvider =
        FormServiceProviderFactory.getFormServiceProvider(tenantID);

    final Map<String, Serializable> evaluatedDisplayExpressions =
        resolveDisplayExpressions(widgets, context, formServiceProvider);
    final Map<String, Serializable> evaluatedExpressions =
        formServiceProvider.resolveExpressions(
            getExpressionsToEvaluation(widgets, evaluatedDisplayExpressions, context), context);
    evaluatedExpressions.putAll(evaluatedDisplayExpressions);

    for (final FormWidget formWidget : widgets) {
      setFormWidgetValues(tenantID, formWidget, evaluatedExpressions, context);
      setTablesParams(formWidget, evaluatedExpressions, context);
    }
  }