Class GenericOaiPromptServiceHandler

    • Method Detail

      • getConnectionViewXhtml

        public URL getConnectionViewXhtml()
        Description copied from interface: IPromptServiceHandler
        This method must return the path to the XHTML page for the custom user interface of a prompt connection. 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 getConnectionViewXhtml() {
           return getClass().getResource("/path/to/view.xhtml");
         }
         

        The contents of this XHTML page is included in the backend menu for prompt connections, already inside a form (i.e. do not add an additional 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 prompt services. Implementations may (but need not) use the components provided by the http://www.xima.de/taglib/xfc/prompt tag library. 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:ui="http://xmlns.jcp.org/jsf/facelets"
           xmlns:xp="http://www.xima.de/taglib/xfc/prompt">
        
           <xp:ui id="CHANGE_THIS_TO_A_UNIQUE_ID">
        
             <!-- Custom section with editors specific to your workflow element -->
             <xp:fieldset legend="#{msg['MyAwesomePromptService.connection.fs.base']}">
               <!-- A simple input field for the API key -->
               <xp:apiKey id="apiKey" value="#{model.apiKey}" required="true"/>
            </xp:fieldset>
        
           </xp:ui>
         </ui:composition>
         

        The XHTML page may access the following expression language variables:

        • model: The deserialized configuration of the connection.
        • msg: A virtual ResourceBundle for the localized messages, backed by the message localizer. Empty when that method returns null. For example, if the resource bundle contains the key prompt.label, you can access the localized message via the EL expression msg['prompt.label']
        • bean: An instance of the bean class returned by getConnectionViewBeanClass. Will be null if that method does not define a bean class.
        The XHTML page may use the following additional search expressions (e.g. for the process and update attributes of a <p:ajax />):
        • @promptUi: Resolves to the closest <xp:ui /> component from the http://www.xima.de/taglib/xfc/prompt tag library.
        • @promptFieldset: Resolves to the closest <xp:promptFieldset /> component from the http://www.xima.de/taglib/xfc/prompt tag library.

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

         <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:o="http://omnifaces.org/ui">
           <o:importConstants type="my.fully.classified.path.MyEnum" var="MyEnum" loader="#{model}"/>
         </ui:composition>
         
        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:
        getConnectionViewXhtml in interface IPromptServiceHandler<GenericOaiConnectionConfig,​GenericOaiQueryConfig>
        Returns:
        Path to the XHTML view, must noe be 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.
      • getQueryViewXhtml

        public URL getQueryViewXhtml()
        Description copied from interface: IPromptServiceHandler
        This method must return the path to the XHTML page for the custom user interface of a prompt query. 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 getQueryViewXhtml() {
           return getClass().getResource("/path/to/view.xhtml");
         }
         

        The contents of this XHTML page is included in the backend menu for prompt queries, already inside a form (i.e. do not add an additional 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 prompt services. Implementations may (but need not) use the components provided by the http://www.xima.de/taglib/xfc/prompt tag library. 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:ui="http://xmlns.jcp.org/jsf/facelets"
           xmlns:xp="http://www.xima.de/taglib/xfc/prompt">
        
           <xp:ui id="CHANGE_THIS_TO_A_UNIQUE_ID">
        
             <!-- Custom section for the UI of your prompt queries -->
             <xp:fieldset legend="#{msg['MyAwesomePromptService.prompt.fs.base']}>
               <!-- A simple select field for the type of the task -->
                 <xp:task id="task" value="#{model.task}" options="#{bean.taskTypeOptions}">
                   <p:ajax global="false" listener="#{bean.onPromptQueryParamFieldChanged}"
                     process="@this,@promptUi:taskConfig"
                     update="@promptUi:taskConfig" />
                 </xp:task>
             </xp:fieldset>
           </xp:ui>
        
         </xp:composition>
         

        The XHTML page may access the following expression language variables:

        • model: The deserialized configuration of the query.
        • msg: A virtual ResourceBundle for the localized messages, backed by the message localizer. Empty when that method returns null. For example, if the resource bundle contains the key prompt.label, you can access the localized message via the EL expression msg['prompt.label']
        • bean: An instance of the bean class returned by getQueryViewBeanClass. Will be null if that method does not define a bean class.
        The XHTML page may use the following additional search expressions (e.g. for the process and update attributes of a <p:ajax />):
        • @promptUi: Resolves to the closest <xp:ui /> component from the http://www.xima.de/taglib/xfc/prompt tag library.
        • @promptFieldset: Resolves to the closest <xp:promptFieldset /> component from the http://www.xima.de/taglib/xfc/prompt tag library.

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

         <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:o="http://omnifaces.org/ui">
           <o:importConstants type="my.fully.classified.path.MyEnum" var="MyEnum" loader="#{model}"/>
         </ui:composition>
         
        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:
        getQueryViewXhtml in interface IPromptServiceHandler<GenericOaiConnectionConfig,​GenericOaiQueryConfig>
        Returns:
        Path to the XHTML view, must noe be 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.
      • getType

        public String getType()
        Description copied from interface: IPromptServiceHandler
        The technical type of this prompt service. Must be unique across all prompt services, including built-in and plugin services. For plugins, we recommend using a prefix to avoid clashes with built-in services and other plugin services, such as the group and artifact ID of the plugin.
        Specified by:
        getType in interface IPromptServiceHandler<GenericOaiConnectionConfig,​GenericOaiQueryConfig>
        Returns:
        The type of the prompt service.