Package de.xima.fc.form
Class FormHelper
- java.lang.Object
-
- de.xima.fc.form.FormHelper
-
public class FormHelper extends Object
Class for different helper-methods for the usage with forms- Author:
- XIMA MEDIA GmbH
-
-
Constructor Summary
Constructors Constructor Description FormHelper()
-
Method Summary
-
-
-
Method Detail
-
buildXForm
public static IXForm buildXForm(IFormRenderContext renderCtx) throws com.alibaba.fastjson.JSONException, IOException
- Throws:
com.alibaba.fastjson.JSONException
IOException
-
buildXFormConfig
public static IXFormRenderConfig buildXFormConfig(IFormRenderContext renderCtx) throws IOException
- Throws:
IOException
-
renderAsString
@Deprecated public static String renderAsString(IXForm form, IXFormRenderConfig config, Map<String,List<String[]>> valuesMap) throws com.alibaba.fastjson.JSONException, IOException
Deprecated.- Throws:
com.alibaba.fastjson.JSONException
IOException
-
renderAsString
public static String renderAsString(IXForm form, IXFormRenderConfig config, Map<String,List<String[]>> valuesMap, Map<String,IFormContainerMetaData> dynContainerMap) throws com.alibaba.fastjson.JSONException, IOException
- Throws:
com.alibaba.fastjson.JSONException
IOException
-
renderToRequestContext
@Deprecated public static void renderToRequestContext(IXForm form, IXFormRenderConfig config, Map<String,List<String[]>> valuesMap, IExtendedFormRequestContext requestCtx)
-
renderToRequestContext
public static void renderToRequestContext(IXForm form, IXFormRenderConfig config, Map<String,List<String[]>> valuesMap, Map<String,IFormContainerMetaData> dynContainerMap, IExtendedFormRequestContext requestCtx)
-
renderToRequestResponse
@Deprecated public static void renderToRequestResponse(IXForm form, IXFormRenderConfig config, IXFormRenderContext formRenderContext, Map<String,List<String[]>> valuesMap, javax.servlet.http.HttpServletResponse response) throws com.alibaba.fastjson.JSONException
Deprecated.- Throws:
com.alibaba.fastjson.JSONException
-
renderToRequestResponse
public static void renderToRequestResponse(IXForm form, IXFormRenderConfig config, IXFormRenderContext formRenderContext, Map<String,List<String[]>> valuesMap, Map<String,IFormContainerMetaData> dynContainerMap, javax.servlet.http.HttpServletResponse response) throws com.alibaba.fastjson.JSONException
- Throws:
com.alibaba.fastjson.JSONException
-
renderAsString
public static String renderAsString(IXForm form, IXFormRenderConfig config, IXFormRenderContext formRenderCtx) throws com.alibaba.fastjson.JSONException, IOException
- Throws:
com.alibaba.fastjson.JSONException
IOException
-
renderToRequestContext
@Deprecated public static void renderToRequestContext(IXForm form, IXFormRenderConfig config, IExtendedFormRequestContext requestCtx, Map<String,List<String[]>> values)
-
renderToRequestContext
public static void renderToRequestContext(IXForm form, IXFormRenderConfig config, IExtendedFormRequestContext requestCtx, Map<String,List<String[]>> values, Map<String,IFormContainerMetaData> dynContainerMap)
-
renderToRequestContext
public static void renderToRequestContext(IXForm form, IXFormRenderConfig config, IExtendedFormRequestContext requestCtx)
-
renderToRequestResponse
public static void renderToRequestResponse(IXForm form, IXFormRenderConfig config, IXFormRenderContext formRenderCtx, javax.servlet.http.HttpServletResponse response) throws com.alibaba.fastjson.JSONException
- Throws:
com.alibaba.fastjson.JSONException
-
getFormElementWidgetPlugin
public static IPluginFormElementWidget getFormElementWidgetPlugin(Mandant client, String pluginName)
-
getFormElementWidgetPlugins
public static Map<String,IPluginFormElementWidget> getFormElementWidgetPlugins(Mandant client)
-
getWidgetFormItems
public static Map<String,IXItemBasic> getWidgetFormItems(Mandant client)
Reads all widget plugins from the system scope and from the given client scope, and returns a map of all widgets provided by these plugins. The key of the map is the class name of the widget, e.g.XMap
orXRating
.- Parameters:
client
- Client scope in which to look for plugin,null
to only search the system scope.- Returns:
- A map of all plugin widgets, indexed by their class name.
- Since:
- 8.1.0
-
getWidgetFormItems
public static Map<String,IXItemBasic> getWidgetFormItems(UUID clientUuid)
Reads all widget plugins from the system scope and from the given client scope, and returns a map of all form items provided by these plugins.The key of the map is the class name of the widget form item, e.g.
XMap
orXRating
.- Parameters:
clientUuid
- Client scope in which to look for plugins,null
to only search the system scope.- Returns:
- A map of all form items provided by plugins, indexed by their class name.
- Since:
- 8.1.0
-
getBuiltinFieldNameConventions
public static Map<String,IXItemFieldNameConventions> getBuiltinFieldNameConventions()
Gets allIXItemFieldNameConventions
for builtin form item types.The key of the map is the class name of the widget form item, e.g.
XMap
orXRating
.- Returns:
- A map of all name conventions for builtin form items, indexed by their class name.
- Since:
- 8.1.0
-
getWidgetFieldNameConventions
public static Map<String,IXItemFieldNameConventions> getWidgetFieldNameConventions(UUID clientUuid)
Reads all widget plugins from the system scope and from the given client scope, and returns a map with theIXItemFieldNameConventions
for the widgets provided by these plugins.The key of the map is the class name of the widget form item, e.g.
XMap
orXRating
.- Parameters:
clientUuid
- Client scope in which to look for plugins,null
to only search the system scope.- Returns:
- A map of all name conventions for form items provided by widgets, indexed by their class name.
- Since:
- 8.1.0
-
getAllFieldNameConventions
public static Map<String,IXItemFieldNameConventions> getAllFieldNameConventions(UUID clientUuid)
Gets allIXItemFieldNameConventions
for the builtin widgets and widgets provided by plugins.The key of the map is the class name of the widget form item, e.g.
XMap
orXRating
.- Parameters:
clientUuid
- Client scope in which to look for plugins,null
to only search the system scope.- Returns:
- A map of all name conventions for builtin form items and form items provided by widgets, indexed by their class name.
- Since:
- 8.1.0
-
getBuiltinFormItems
public static Map<String,IXItemBasic> getBuiltinFormItems()
Returns a map of all builtin form items provided by the formcycle core, such as text fields and text areas.The key of the map is the class name of the widget form item, e.g.
XTextField
orXSpan
.- Returns:
- A map of all builtin form items, indexed by their class name.
- Since:
- 8.1.0
-
getFormElementWidgetPluginsWithInstanceTime
public static Map<String,org.apache.commons.lang3.tuple.Pair<IPluginFormElementWidget,Long>> getFormElementWidgetPluginsWithInstanceTime(Mandant client)
-
buildXFormJSON
@Deprecated public static com.alibaba.fastjson.JSONObject buildXFormJSON(FormRenderContext renderCtx) throws IOException, com.alibaba.fastjson.JSONException
Deprecated.- Throws:
IOException
com.alibaba.fastjson.JSONException
-
clearUploads
public static void clearUploads(IXForm xForm, IXFormRenderConfig config, IExtendedFormRequestContext requestCtx, Map<String,List<String[]>> values)
-
validateFD2Form
public static boolean validateFD2Form(IXForm xForm, IXFormRenderConfig config, IExtendedFormRequestContext requestCtx)
-
validateFD2Form
public static boolean validateFD2Form(IXForm xForm, IXFormRenderConfig config, IExtendedFormRequestContext requestCtx, IFormRenderContext renderCtx)
-
createClientResourceUrl
public static String createClientResourceUrl(IFormRenderContext renderCtx, IXFormRenderConfig xformConfig, MandantRessource res)
- Parameters:
renderCtx
- Form render context with the current client.xformConfig
- Form render config with the base include URLres
- Resource for which to create the URL.- Returns:
- The URL for the given client resource that can be used in web forms.
-
createFieldFilter
public static Predicate<String> createFieldFilter(FRQSession frqSession)
Creates the filter for request values. The returned predicate takes the name of a request value (e.g.tf1
orxfc-pp-inline
) and returnsfalse
when the server should not accept and discard the value. The filter checks for example the availability conditions and disabled conditions of form fields (e.g. when a form field is unavailable in a certain state or for a certain user group).- Parameters:
frqSession
- Current form request session.- Returns:
- A predicate for deciding whether a request value with a given name should be accepted or discarded.
-
createProjectResourceUrl
public static String createProjectResourceUrl(IFormRenderContext renderCtx, IXFormRenderConfig xformConfig, ProjektRessource res)
- Parameters:
renderCtx
- Form render context with the current project.xformConfig
- Form render config with the base include URL.res
- Resource for which to create the URL.- Returns:
- The URL for the given project resource that can be used in web forms.
-
createWidgetResourceUrl
public static String createWidgetResourceUrl(IFormRenderContext renderCtx, IXFormRenderConfig xformConfig, XItemWidgetWrapper wrapper, IXItemWidget widget)
- Parameters:
renderCtx
- Form render context with the current project.xformConfig
- Form render config with the base include URL.wrapper
- Wrapper for the widget.widget
- Widget instance with a CSS resource for which to create a URL.- Returns:
- The URL for the given widget CSS resource that can be used in web forms.
-
getFormDesignerResourcePlugin
public static IPluginFormDesignerResource getFormDesignerResourcePlugin(Mandant client, String pluginName)
-
getFormDesignerResourcePlugins
public static Map<String,IPluginFormDesignerResource> getFormDesignerResourcePlugins(Mandant client)
-
getFormDesignerResourcePluginsWithInstanceTime
public static Map<String,org.apache.commons.lang3.tuple.Pair<IPluginFormDesignerResource,Long>> getFormDesignerResourcePluginsWithInstanceTime(Mandant client)
-
createPluginResourceUrl
public static String createPluginResourceUrl(IFormRenderContext renderCtx, IXFormRenderConfig xformConfig, IFormResource res, boolean useSystemPlugins)
- Parameters:
renderCtx
- Form render context with the current client.xformConfig
- Form render config with the base include URLres
- Resource for which to create the URL.useSystemPlugins
- Whether the resource was obtained from a system or client plugin.- Returns:
- The URL for the given client resource that can be used in web forms.
-
-