Class FcWithFormElementContextHandler

java.lang.Object
de.xima.fc.workflow.designer.registry.nodes.FcWithFormElementContextHandler
All Implemented Interfaces:
IResourceBundleLocator, IWorkflowNodeFlowAnalyzer<FcWithFormElementContextProps>, IElementHandler<FcWithFormElementContextProps, WorkflowNode>, IExecutionResultDescriptor, IRefinedExecutionResultDescriptor<FcWithFormElementContextProps>, ICustomParametersUpdateable, IWorkflowElementTypeProviding, IBeanValidatingElement<FcWithFormElementContextProps, WorkflowNode>, IBeanValidatingNode<FcWithFormElementContextProps>, IExecutingLikeSequenceNode<FcWithFormElementContextProps>, IHierarchyValidatingNode<FcWithFormElementContextProps>, IKeyValueSummarizableElement<FcWithFormElementContextProps, WorkflowNode>, IKeyValueSummarizableNode<FcWithFormElementContextProps>, IOfficialHelpPageElement<FcWithFormElementContextProps, WorkflowNode>, IOfficialHelpPageNode<FcWithFormElementContextProps>, ISingleElementPrototype<FcWithFormElementContextProps, WorkflowNode>, ISingleNodePrototype<FcWithFormElementContextProps>, INodeHandler<FcWithFormElementContextProps>, IWorkflowNodeTypeProviding, IListenerRegistrator, IOrderable, ISingleBuiltinNodePrototype<FcWithFormElementContextProps>, IBuiltinResourcesHandler<FcWithFormElementContextProps, WorkflowNode>, IBuiltinNodeType<FcWithFormElementContextProps>, IFcWithFormElementContextDescriptors, Comparable<IOrderable>

The INodeHandler for nodes of type FC_WITH_FORM_ELEMENT_CONTEXT. Has a single child. Sets the form element repetition context or the form element field value while its child is executed. When the execution of any child results in an abrupt completion, the sequence node will immediately stop executing and also ends abruptly with the same result.
Since:
8.5.0
Author:
XIMA MEDIA GmbH
  • Constructor Details

    • FcWithFormElementContextHandler

      public FcWithFormElementContextHandler()
  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • execute

      Description copied from interface: INodeHandler
      Executes the given workflow node. You may perform any action required by this node type, such as creating files, sending HTTP requests etc.

      If this node has children that need to be executed (such as for control nodes like conditions or switches), you must use IWorkflowExecutionContext.executor() to execute the children instead of attempting to call their execute method directly. Note that a node must never attempt to execute any other node that is not in the subtree (= a child, a grand-child, a grand-grand-child etc.) of this node.

      In case you throw any other exceptions other than the exceptions mentioned in the throws clause, it will be wrapped in a NodeThrewException with a general error code.

      Specified by:
      execute in interface INodeHandler<FcWithFormElementContextProps>
      Parameters:
      params - The node that needs to be executed and the current workflow context.
      Returns:
      The result value or values created by the executed node.
      Throws:
      AbstractAbruptCompletionException - When the node's execution did not finish normally, see below for subclasses.
    • extractName

      public String extractName(FcWithFormElementContextProps data)
      Description copied from interface: IElementHandler
      Retrieves the name that will be stored as AWorkflowElement.getName(). For example, actions may let the user enter the name of the action, which would be returned by this method. A condition node may use a summary of the test condition as the name. A button trigger event may use the name of the button.

      The default implementation checks whether the IElementHandler.getDataModelClass() implements INameProviding and if it does, returns INameProviding.getName().

      Specified by:
      extractName in interface IElementHandler<FcWithFormElementContextProps, WorkflowNode>
      Parameters:
      data - The data of the workflow element for which to retrieve the name.
      Returns:
      The name of the workflow element with the given data.
    • getBpmnModeler

      Description copied from interface: INodeHandler
      Gets the BPMN modeler to be used for creating a BPMN 2.0 diagram of the workflow.

      The modeler should not have any state and be immutable. It must be thread-safe.

      Specified by:
      getBpmnModeler in interface INodeHandler<FcWithFormElementContextProps>
      Returns:
      The BPMN modeler for this node.
    • getBuiltinType

      public EWorkflowNodeType getBuiltinType()
      Specified by:
      getBuiltinType in interface IBuiltinNodeType<FcWithFormElementContextProps>
      Returns:
      The built-in node type.
    • getDataModelClass

      public Class<FcWithFormElementContextProps> getDataModelClass()
      Description copied from interface: IElementHandler
      Returns the class of the custom properties used by the elements handled by this element logic handler.

      The custom properties of a workflow element are internally stored as JSON. To ease the development work, you can specify a model class, and the JSON is automatically converted to an instance of that model class. Please note that the model class must be compatible with serialization mechanism used by JSON.

      See IElementHandler.getVersion() for how custom properties are updated.

      If you need more control over serialization and deserialization, specify JSONObject as the type parameter and return JSONObject.class. You will then receive the raw JSON data and may perform the serialization in whatever way you like.

      Specified by:
      getDataModelClass in interface IElementHandler<FcWithFormElementContextProps, WorkflowNode>
      Returns:
      The class corresponding to the type parameter TData.
    • getElementSummaryKeyValueModel

      public ISummaryKeyValueModel getElementSummaryKeyValueModel(IGetElementSummaryParams<FcWithFormElementContextProps> params)
      Specified by:
      getElementSummaryKeyValueModel in interface IKeyValueSummarizableElement<FcWithFormElementContextProps, WorkflowNode>
      Parameters:
      params - The custom properties of the node or trigger.
      Returns:
      A list of key value pairs to display in a table in the overview panel.
    • getMainCategory

      public IElementCategory getMainCategory(IGetElementPrototypesParams params)
      Specified by:
      getMainCategory in interface ISingleElementPrototype<FcWithFormElementContextProps, WorkflowNode>
      Parameters:
      params - Parameters with the current client, locale, entity context etc.
      Returns:
      IElementCategory element's main category, which is used for grouping the elements.
    • getPropertiesViewXhtml

      public URL getPropertiesViewXhtml() throws MalformedURLException
      Description copied from interface: IElementHandler
      This method must return the path to the XHTML page for the custom user interface. Usually the XHTML file is part of the JAR resources of the module or plugin. In this case, you should return a URL to a JAR file resource (jar:file:/...) like so:
      @Override
      public URL getXhtmlView() {
        return getClass().getResource("/path/to/view.xhtml");
      }
      

      The contents of this XHTML page is included in the properties panel, without a fieldset or container around it, but already inside a form (i.e. do not use a h:form as that would result in an error). You should wrap your custom UI in a naming container to ensure unique IDs that do not clash with other plugins or actions. The following is a recommended template on which you may base your UI:

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://xmlns.jcp.org/jsf/html"
        xmlns:f="http://xmlns.jcp.org/jsf/core"
        xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
        xmlns:o="http://omnifaces.org/ui" xmlns:p="http://primefaces.org/ui"
        xmlns:xi="http://www.xima.de/taglib/xfc">
      
        <!-- Enable bean validation (when #validateLocal is implemented via the bean validator)-->
        <o:validateBean value="#{model}" showMessageFor="@violating"  method="validateActual" />
      
        <xi:namingContainer id="myAwesomeWorkflowElement">
      
          <!--Base info with name and description (when TData extends BaseActionProps) -->
          <xi:newWorkflowActionBase id="base" value="#{model}" legend="#{msg['wf.node.myawesomelememnt']}" />
      
          <!-- Remove when TData does not have a ISingleFileProviding field -->
          <xi:singleFile id="resource" value="#{model.singleFile}" required="true" />
      
          <!-- Remove when TData does not have a IMultiFileProviding field -->
          <xi:multiFile id="resource" value="#{model.multiFile}" required="true" />
      
          <!-- Remove when TData does not implement IProviding -->
          <xi:fileProvision id="providing" value="#{model.fileProvision}" />
      
          <!-- Custom section with editors specific to your workflow element -->
          <p:fieldset legend="#{msg['MyAwesomeWorkflowElementProps.fieldset.base']}" styleClass="fc-fieldset">
      
            <!-- A simple input field bound to the mail property of your properties model -->
            <xi:inputText id="mail" label="#{msg['MyAwesomeWorkflowElementProps.mail']}" formPlaceholder="true"
              value="#{model.mail}" forceIndicateRequired="true" >
              <p:ajax event="change" partialSubmit="true"
                listener="#{elementPropertiesBean.storeCurrent}" process="@this"
                update=":flowchartForm:flowchart" global="false" />
            </xi:inputText>
      
         </p:fieldset>
      
        </xi:namingContainer>
      </ui:composition>
      

      The XHTML page may access the following expression language variables:

      • model: The deserialized custom properties of the workflow element, of the type TData.
      • provider: An object that implements IWorkflowProvider, for accessing various data, such as a list of all users or text templates.
      • msg: The localized messages as returned by IElementHandler.getResourceBundle(Locale). Empty when that method returns null. For example, if the resource bundle contains the key mail.label, you can access the localized message via the EL expression msg['mail.label']

      To access the values of an enum or the constants defined by a class, consider using

      <xi:importConstants type="my.fully.classified.path.MyEnum" var="MyEnum" loader="#{model}"/>
      
      The loader argument is only required for plugins and ensures that the correct class loader is used that knows about the plugin class. Without the loader attribute, the above is equivalent to the PrimeFaces tag handler <p:importConstants />.
      Specified by:
      getPropertiesViewXhtml in interface IElementHandler<FcWithFormElementContextProps, WorkflowNode>
      Returns:
      Path to the XHTML view. If the action can be configured, this must not return null. If you do return null, it will be treated as an error and an appropriate message is displayed to the user informing them that the properties panel could not be loaded. If the action cannot be configured (i.e. when the action is not selectable), this should return null.
      Throws:
      MalformedURLException - This exception is declared for convenience - normally you would use new URL(String) with a constant URL string that should not throw. In case an exception is thrown, it is treated the same as if this returned null.
    • getPrototypeElementChildren

      public Iterable<WorkflowNode> getPrototypeElementChildren(IGetElementPrototypesParams params)
      Description copied from interface: ISingleNodePrototype
      Gets the children of the prototype node. By default, the prototype node has no children, but you can override this method to provide children for the prototype node. Can be useful if your node type has mandatory child nodes.
      Specified by:
      getPrototypeElementChildren in interface ISingleNodePrototype<FcWithFormElementContextProps>
      Parameters:
      params - The parameters for getting the element prototypes.
      Returns:
      An iterable of the children of the prototype node, null or empty if there are no children.
    • getPrototypeModelData

      public FcWithFormElementContextProps getPrototypeModelData(String label, IGuiIcon icon, IGetElementPrototypesParams params)
      Specified by:
      getPrototypeModelData in interface ISingleElementPrototype<FcWithFormElementContextProps, WorkflowNode>
      Parameters:
      label - Label of the prototype, as returned by ISingleElementPrototype.getPrototypeLabel(IGetElementPrototypesParams). Can be used to prefill the properties model with the label.
      icon - Icon of the prototype, as returned by ISingleElementPrototype.getPrototypeIcon(IGetElementPrototypesParams). Can be used to prefill the properties model with the icon.
      params - Parameters with the current client, locale, entity context etc.
      Returns:
      The properties model for the element prototype. This is the initial configuration when the user adds the prototype to the flowchart (via drag & drop).
    • getSubCategory

      public IElementCategory getSubCategory(IGetElementPrototypesParams params)
      Description copied from interface: ISingleElementPrototype
      Optional sub category. When not set or this returns null, the element is shown under the category miscellaneous.
      Specified by:
      getSubCategory in interface ISingleElementPrototype<FcWithFormElementContextProps, WorkflowNode>
      Parameters:
      params - Parameters with the current client, locale, entity context etc.
      Returns:
      IElementCategory element's sub category, which is used for grouping the element within the given main group.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isCreateProtocolEntryAfterExecution

      public boolean isCreateProtocolEntryAfterExecution(ICreateProtocolEntryAfterExecutionParams params)
      Description copied from interface: INodeHandler
      Controls whether a protocol entry is created after the node was executed.

      The default implementation returns true iff result was created by the current node.

      When some action throws an exception, all parent control flow node such as if-else statements also throw an exception. This would result in multiple protocol entries for a single error.

      Specified by:
      isCreateProtocolEntryAfterExecution in interface INodeHandler<FcWithFormElementContextProps>
      Parameters:
      params - Parameters with the node that was executed and the result of the node's execution.
      Returns:
      true to create a protocol entry, or false otherwise.
    • isValidChildCount

      public boolean isValidChildCount(WorkflowNode node, int childCount)
      Description copied from interface: IHierarchyValidatingNode
      Checks whether the given number of children is allowed. The default implementation enforces no restriction on the number of children.
      Specified by:
      isValidChildCount in interface IHierarchyValidatingNode<FcWithFormElementContextProps>
      Parameters:
      node - The parent node with the children to check.
      childCount - The number of children of the node node.
      Returns:
      true if the number of children are allowed.
    • isValidChildType

      public boolean isValidChildType(WorkflowNode node, int childIndex, String nodeType)
      Description copied from interface: IHierarchyValidatingNode
      Checks whether the type of a certain workflow node child is allowed for that node. The default implementation enforces no restriction on the child type.
      Specified by:
      isValidChildType in interface IHierarchyValidatingNode<FcWithFormElementContextProps>
      Parameters:
      node - The parent node with the children to check.
      childIndex - 0-based index of the child to check.
      nodeType - Node type of the child to check.
      Returns:
      true if the child type is allowed.