Class FcUserInvocationHandler

java.lang.Object
de.xima.fc.workflow.designer.registry.triggers.FcUserInvocationHandler
All Implemented Interfaces:
IResourceBundleLocator, IElementHandler<FcUserInvocationProps, WorkflowTrigger>, IRefinedTriggerDataDescriptor<FcUserInvocationProps>, ITriggerDataDescriptor, ICustomParametersUpdateable, IWorkflowElementTypeProviding, IBeanValidatingElement<FcUserInvocationProps, WorkflowTrigger>, IBeanValidatingTrigger<FcUserInvocationProps>, IKeyValueSummarizableElement<FcUserInvocationProps, WorkflowTrigger>, IKeyValueSummarizableTrigger<FcUserInvocationProps>, IOfficialHelpPageElement<FcUserInvocationProps, WorkflowTrigger>, IOfficialHelpPageTrigger<FcUserInvocationProps>, ISingleElementPrototype<FcUserInvocationProps, WorkflowTrigger>, ISingleTriggerPrototype<FcUserInvocationProps>, ISpecificTriggerListener<FcUserInvocationProps>, ITriggerHandler<FcUserInvocationProps>, IWorkflowTriggerTypeProviding, IListenerRegistrator, IOrderable, ISingleBaseBuiltinTriggerPrototype<FcUserInvocationProps>, ISingleBuiltinTriggerPrototype<FcUserInvocationProps>, IBuiltinResourcesHandler<FcUserInvocationProps, WorkflowTrigger>, IBaseTrigger<FcUserInvocationProps>, IBuiltinTriggerType<FcUserInvocationProps>, ISingleBaseTriggerPrototype<FcUserInvocationProps>, IFcUserInvocationDescriptors, Comparable<IOrderable>

  • Method Details

    • equals

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

      Description copied from interface: ITriggerHandler
      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 ITriggerHandler<FcUserInvocationProps>
      Returns:
      The BPMN modeler for this node.
    • getBuiltinType

      public EWorkflowTriggerType getBuiltinType()
      Specified by:
      getBuiltinType in interface IBuiltinTriggerType<FcUserInvocationProps>
      Returns:
      The built-in trigger type.
    • getDataModelClass

      public Class<? extends FcUserInvocationProps> 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<FcUserInvocationProps, WorkflowTrigger>
      Returns:
      The class corresponding to the type parameter TData.
    • getElementSummaryKeyValueModel

      public ISummaryKeyValueModel getElementSummaryKeyValueModel(IGetElementSummaryParams<FcUserInvocationProps> params)
      Specified by:
      getElementSummaryKeyValueModel in interface IKeyValueSummarizableElement<FcUserInvocationProps, WorkflowTrigger>
      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.
    • getFilterCriteriaForEvent

      public de.xima.cmn.criteria.FilterCriterion getFilterCriteriaForEvent(ITriggerFilterCriteriaForEventParams params)
      Description copied from interface: ITriggerHandler
      Called once with the event data when an event is fired. Each handler may add filter criteria to locate the triggers that match the event data.

      This method must return a non-null value to indicate that the event applies to this type of trigger at all. When this returns null, no triggers of this handler type are considered. The filter criterion returned by this method is used for a query for WorkflowTrigger entities, i.e. all attribute names must be relative to that entity.

      For example, to limit the result to triggers which have a search term with the key customKey set to valueForCustomKey, use:

      return params.searchTermExists("customKey", valueForCustomKey);
      
      To create a complex filter, use or / and etc. If you cannot use a database filter to check whether a trigger applies, use always to fetch all triggers for this handler type, and implement isAppliesToEvent to filter the applicable triggers via Java code.

      Basic restrictions such as the trigger type, the form record and project are applied automatically by the system and do not need to be included in the returned filter.

      See the class level documentation ITriggerHandler for more details.

      Specified by:
      getFilterCriteriaForEvent in interface ISpecificTriggerListener<FcUserInvocationProps>
      Specified by:
      getFilterCriteriaForEvent in interface ITriggerHandler<FcUserInvocationProps>
      Parameters:
      params - Parameters with the event data of the event that occurred.
      Returns:
      A filter criterion to restrict the list of matching triggers for this handler type. When null is returned, no triggers of this handler type are considered.
    • getMainCategory

      public IElementCategory getMainCategory(IGetElementPrototypesParams params)
      Specified by:
      getMainCategory in interface ISingleElementPrototype<FcUserInvocationProps, WorkflowTrigger>
      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<FcUserInvocationProps, WorkflowTrigger>
      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.
    • getRequiredEventDataType

      public Class<? extends ISpecificTriggerProvidingEvent> getRequiredEventDataType()
      Description copied from interface: ISpecificTriggerListener
      Allows you to limit the type of events this trigger reacts to a specific subtype of ISpecificTriggerProvidingEvent.
      Specified by:
      getRequiredEventDataType in interface ISpecificTriggerListener<FcUserInvocationProps>
      Returns:
      The class of the event data type this trigger reacts to.
    • 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<FcUserInvocationProps, WorkflowTrigger>
      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
    • isAvailable

      public boolean isAvailable(IIsAvailableParams<FcUserInvocationProps> params)
      Description copied from interface: IElementHandler
      Checks whether this workflow element is available to the given client. If this return false, this action cannot be used in the workflow designer. When attempting to execute a workflow with an unavailable action, an error of type NODE_UNAVAILABLE is thrown. The default implementation always returns true.
      Specified by:
      isAvailable in interface IBuiltinTriggerType<FcUserInvocationProps>
      Specified by:
      isAvailable in interface IElementHandler<FcUserInvocationProps, WorkflowTrigger>
      Parameters:
      params - The node's data, the entity context, and the current client.
      Returns:
      Whether the workflow element is available to the given client.
    • isPreconditionSatisfied

      public boolean isPreconditionSatisfied(ITriggerPreconditionSatisfiedParams<FcUserInvocationProps> params)
      Description copied from interface: ITriggerHandler
      Called once the task of a trigger is about to be executed. This method may return false to prevent the task from being executed. When an event triggers multiple tasks, the execution of one task may invalidate the preconditions for a later task, so this method can be used to check whether the precondition is still satisfied.

      See the class level documentation ITriggerHandler for more details.

      Specified by:
      isPreconditionSatisfied in interface ISpecificTriggerListener<FcUserInvocationProps>
      Specified by:
      isPreconditionSatisfied in interface ITriggerHandler<FcUserInvocationProps>
      Parameters:
      params - The parameters with the task about to be executed.
      Returns:
      true to proceed with the task's execution, false to skip the task's execution.
    • getInstance

      public static FcUserInvocationHandler getInstance()
      Returns:
      The immutable, stateless instance of this handler.