Changeset 20981 in main


Ignore:
Timestamp:
07/07/20 13:48:58 (4 weeks ago)
Author:
GarthBraithwaite_STG
Message:

java, view - added comments to injecting webapp base request path into QM xinclude processing. Updated the include xslt code to centralized handling and better docs.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/ibisph-view/src/main/webapp/WEB-INF/config/spring/common.xml

    r20174 r20981  
    344344                        must be prefixed with the value to reliably work. 
    345345
    346                         Issue: If not specified ie. blank and built from first HTTP request
     346                        Issue: If not specified i.e. blank and built from first HTTP request
    347347                        and the first request is NOT the wanted value then is set wrong. 
    348348                        An example of this being a problem is in a local dev environment where
  • trunk/ibisph-view/src/main/webapp/WEB-INF/config/spring/query-definition.xml

    r20639 r20981  
    1515        <!--  M O D E L S   /   C O N T R O L L E R   R E S O R U C E S -->
    1616        <bean id="queryDefinitionModelMapKey" class="org.ibisph.model.StringHolder">
    17                 <constructor-arg type="java.lang.String" value="QueryDefinition"/>
    18         </bean>
    19         <bean id="queryDefinitionStickyQueryDefinitionSessionName" class="org.ibisph.model.StringHolder">
    20                 <constructor-arg type="java.lang.String" value="StickyQueryDefinition"/>
     17                <constructor-arg value="QueryDefinition"/>
    2118        </bean>
    2219        <bean id="queryDefinitionUseCurrentUserIfRequestSegmentEquals" class="java.util.ArrayList">
     
    115112        </bean>
    116113
    117         <bean id="queryDefinitionApplyToQueryModuleModelMap" class="org.ibisph.querydefinition.modelmap.QueryDefinitionToQueryModule">
    118                 <description>
    119                         Model processor that supplements the query module selections with
    120                         the saved query definition selections.  General rules are 1) check
    121                         the model map for a query definition.  If it has one use it. 2) Else
    122                         check if sticky definition exists in the session and if so use it.
    123                         3) Next try and get the QM from the model map and use.  4) If not
    124                         found try get the QM from the session and if found use.  5) Lastly
    125                         (nothing) load the QM from the associated QD configuration path.
    126                         Use service to load the QD into the QM.
    127                 </description>
    128                 <property name="queryDefinitionModelMapKey"          value="#{queryDefinitionModelMapKey.string}"/>
    129                 <property name="stickyQueryDefinitionSessionName"    value="#{queryDefinitionStickyQueryDefinitionSessionName.string}"/>
    130                 <property name="queryModuleModelMapKey"              value="#{commonXMLModelMapKey.string}"/>
    131                 <property name="queryModuleSessionName"              value="#{queryModuleSessionName.string}"/>
    132                 <property name="queryModuleService"                  ref="queryModuleXMLService"/>
    133                 <property name="queryDefinitionToQueryModuleService" ref="queryDefinitionDefinitionToModuleService"/>
    134         </bean>
    135 
    136114        <bean id="queryDefinitionMiscDetailsModelMap" class="org.ibisph.querydefinition.modelmap.MiscQueryDefinitionDetailsFromHTTPRequest">
    137115                <description>
     
    142120                <property name="queryModuleModelMapKey"           value="#{commonXMLModelMapKey.string}"/>
    143121                <property name="sessionQueryModuleTitleMapKey"    value="SessionQueryModuleTitle"/>
    144                 <property name="stickyQueryDefinitionSessionName" value="#{queryDefinitionStickyQueryDefinitionSessionName.string}"/>
     122<!--
     123                <property name="stickyQueryDefinitionSessionName" value="#{queryStickyDefinitionDefinitionSessionName.string}"/>
    145124                <property name="stickyQueryDefinitionModelMapKey" value="StickyQueryDefinition"/>
    146         </bean>
    147 
    148         <bean id="queryDefinitionAddStickyQueryDefinitionToSessionModelMap"
    149           class="org.ibisph.querydefinition.modelmap.AddStickyQueryDefinitionToSession"
    150         >
    151                 <description>
    152                         Used to set the user's "sticky" query definition into their session.
    153                 </description>
    154                 <property name="queryDefinitionModelMapKey"       value="#{queryDefinitionModelMapKey.string}"/>
    155                 <property name="stickyQueryDefinitionSessionName" value="#{queryDefinitionStickyQueryDefinitionSessionName.string}"/>
    156         </bean>
    157 
     125-->
     126        </bean>
    158127
    159128
     
    200169                        use the QM XSLT code which relies on the QM being the primary XML
    201170                        (both use queryDefinitionQueryModuleFromQueryDefinitionModelMap).
    202                         The Misc modelmap contains session QM title (if exists)
    203                         and the sticky session QD (if exists). Requests are of the form:
    204                         query/definition/detail/[defs name]/[def name].html
    205171
    206172                        NOTE: The QM is retrieved and loaded based on the QD QM and NEVER
     
    213179
    214180                                <ref bean="queryDefinitionQueryModuleFromQueryDefinitionModelMap"/>
    215                                 <ref bean="queryDefinitionMiscDetailsModelMap"/>
    216 
    217                                 <ref bean="commonDimensionsModelMap"/>
    218                                 <ref bean="commonMeasuresModelMap"/>
    219                                 <ref bean="commonValueTypesModelMap"/>
    220                                 <ref bean="commonChartsModelMap"/>
    221                                 <ref bean="commonMapsModelMap"/>
     181
     182                                <ref bean="commonMeasuresModelMap"/>
     183                                <ref bean="commonValueTypesModelMap"/>
    222184                        </list>
    223185                </property>
     
    239201                                <ref bean="queryDefinitionQueryModuleToSessionModelMap"/>
    240202
    241                                 <ref bean="commonDimensionsModelMap"/>
    242                                 <ref bean="commonMeasuresModelMap"/>
    243                                 <ref bean="commonValueTypesModelMap"/>
    244                                 <ref bean="commonChartsModelMap"/>
    245                                 <ref bean="commonMapsModelMap"/>
     203                                <ref bean="commonMeasuresModelMap"/>
     204                                <ref bean="commonValueTypesModelMap"/>
    246205                        </list>
    247206                </property>
     
    267226                                <ref bean="queryDefinitionFromHTTPRequestModelMap"/>
    268227                                <ref bean="queryDefinitionQueryModuleFromQueryDefinitionModelMap"/>
    269 <ref bean="queryModuleAddIBISQResultModelMap"/>
     228                                <ref bean="queryModuleAddIBISQResultModelMap"/>
    270229                                <ref bean="queryDefinitionQueryModuleToSessionModelMap"/>
    271230
    272231                                <ref bean="commonAncillaryValuesModelMap"/>
    273232                                <ref bean="commonDataSourcesModelMap"/>
    274                                 <ref bean="commonDimensionsModelMap"/>
    275233                                <ref bean="commonMeasuresModelMap"/>
    276234                                <ref bean="commonValueTypesModelMap"/>
    277235                                <ref bean="commonValueAttributesModelMap"/>
    278                                 <ref bean="commonChartsModelMap"/>
    279                                 <ref bean="commonMapsModelMap"/>
    280236                        </list>
    281237                </property>
     
    289245                </description>
    290246                <property name="view" ref="queryResultContentBlocksView"/>
    291         </bean>
    292 
    293         <bean id="queryDefinitionApplyController" parent="commonModelMapListController">
    294                 <description>
    295                         Get the existing session stored QM, load the URL specified query def,
    296                         merge QD into QM and show the builder/qm edit page.  IF the session
    297                         has a sticky query def then save this query def to the session.
    298                 </description>
    299                 <property name="modelMapList">
    300                         <list>
    301                                 <ref bean="queryDefinitionFromHTTPRequestModelMap"/>
    302                                 <ref bean="queryDefinitionApplyToQueryModuleModelMap"/>
    303                                 <ref bean="queryDefinitionAddStickyQueryDefinitionToSessionModelMap"/>
    304                         </list>
    305                 </property>
    306                 <property name="view" ref="queryBuilderView"/>
    307247        </bean>
    308248
     
    322262                                <ref bean="queryModuleAddUserSelectionsModelMap"/>
    323263
    324                                 <ref bean="commonDimensionsModelMap"/>
    325                                 <ref bean="commonMeasuresModelMap"/>
    326                                 <ref bean="commonValueTypesModelMap"/>
    327                                 <ref bean="commonChartsModelMap"/>
    328                                 <ref bean="commonMapsModelMap"/>
     264                                <ref bean="commonMeasuresModelMap"/>
     265                                <ref bean="commonValueTypesModelMap"/>
    329266                        </list>
    330267                </property>
     
    343280                                <ref bean="queryModuleDocumentFromSessionModelMap"/>
    344281
    345                                 <ref bean="commonDimensionsModelMap"/>
    346                                 <ref bean="commonMeasuresModelMap"/>
    347                                 <ref bean="commonValueTypesModelMap"/>
    348                                 <ref bean="commonChartsModelMap"/>
    349                                 <ref bean="commonMapsModelMap"/>
     282                                <ref bean="commonMeasuresModelMap"/>
     283                                <ref bean="commonValueTypesModelMap"/>
    350284                        </list>
    351285                </property>
     
    427361        </bean>
    428362
    429         <bean id="queryDefinitionToggleStickySessionController" class="org.ibisph.web.springmvc.ToggleSessionFlagController">
    430                 <description>
    431                         AJAX handler that sets the user's session sticky flag.  The way this
    432                         works is that the detail or list page has a checkbox that when the
    433                         user checks/unchecks the sticky query def in the session is either
    434                         cleared (unchecked) or set to something (checked).  When the apply
    435                         request is made, the selected query defintion in the request is added
    436                         to the session under the queryDefinitionStickyQueryDefinitionSessionName.
    437                         The query builder model map code then sees that there's a sticky
    438                         definition in the session and applys it.
    439                 </description>
    440                 <property name="flagSessionName" value="#{queryDefinitionStickyQueryDefinitionSessionName.string}"/>
    441                 <property name="flagSessionValue">
    442                         <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    443                                 <property name="targetClass"><value>org.ibisph.util.XMLLib</value></property>
    444                                 <property name="targetMethod"><value>newNode</value></property>
    445                                 <property name="arguments">
    446                                         <list><value>EMPTY_QUERY_DEFINITION</value></list>
    447                                 </property>
    448                         </bean>
    449                 </property>
    450         </bean>
    451 
    452 
    453363
    454364        <!--  V I E W S  -->
     
    463373        </bean>
    464374
    465         <bean id="queryDefinitionDefinitionListRedirectionView" class="org.ibisph.web.springmvc.SimpleClientRedirectionView">
    466                 <property name="redirectionAddress" value="/query/definition/List.html"/>
    467         </bean>
    468 
    469375</beans>
  • trunk/ibisph-view/src/main/webapp/WEB-INF/config/spring/query.xml

    r20835 r20981  
    3333        </bean>
    3434
     35        <bean id="queryDefaultQueryDefinitionSessionName" class="org.ibisph.model.StringHolder">
     36                <constructor-arg value="DefaultQueryDefinition"/>
     37        </bean>
     38
    3539        <bean id="queryIBISQRequestPath" class="org.ibisph.model.StringHolder">
    3640                <constructor-arg value="http://localhost/cgi-bin/hi_iq_func.exe"/>
     
    7882        </bean>
    7983
     84<!-- NOT USED
    8085        <bean id="queryModuleAddGroupBySelectedDimensionValueRecordsModelMap" class="org.ibisph.querymodule.modelmap.AddGroupBySelectedDimensionValueRecords">
    8186                <description>
     
    9398                <property name="modelMapKey"        value="#{commonXMLModelMapKey.string}"/>
    9499        </bean>
     100-->
    95101
    96102        <bean id="queryModuleAddIBISQResultModelMap" class="org.ibisph.querymodule.modelmap.AddIBISQResultToQueryModule">
     
    170176                        <list>
    171177                                <ref bean="queryModuleDocumentFromHTTPRequestModelMap"/>
    172                                 <ref bean="queryDefinitionApplyToQueryModuleModelMap"/>
    173 
    174                                 <ref bean="commonDimensionsModelMap"/>
     178
    175179                                <ref bean="commonMeasuresModelMap"/>
    176180                                <ref bean="commonValueTypesModelMap"/>
    177                                 <ref bean="commonChartsModelMap"/>
    178                                 <ref bean="commonMapsModelMap"/>
    179181                        </list>
    180182                </property>
     
    186188                <description>
    187189                        Processing Business Rule:
    188                         If submitting/posting e.g. coming from the builder page then all REQUEST
    189                         selections must be cleared.  This includes any and all selected dim values
    190                         AND user display selections.  It also include any previous errors and any
    191                         previous IBISQ result (which is the flag for the XSLT to know to show the
    192                         please wait or try and display actual results). 
     190                        If submitting/posting e.g. coming from the builder page then any REQUEST
     191                        selections must be cleared.  Also cleared are all selected dim values,
     192                        user display selections, previous errors, and previous IBISQ result
     193                        (which is the flag for the XSLT to know to show the please wait or try
     194                        and display actual results). 
    193195
    194196                        Otherwise if not submitting (this is a comment for the rest of the
     
    213215                                <ref bean="queryModuleDeleteUserSelectionsModelMap"/>
    214216                                <ref bean="queryModuleDeleteIBISQResultModelMap"/>
    215                                 <ref bean="queryModuleAddUserSelectionsModelMap"/>
     217<ref bean="queryModuleAddUserSelectionsModelMap"/>
    216218
    217219<ref bean="commonAncillaryValuesModelMap"/>
     
    220222<ref bean="commonValueTypesModelMap"/>
    221223<ref bean="commonValueAttributesModelMap"/>
    222 <ref bean="commonChartsModelMap"/>
    223 <ref bean="commonMapsModelMap"/>
    224224                        </list>
    225225                </property>
     
    245245<ref bean="commonValueTypesModelMap"/>
    246246<ref bean="commonValueAttributesModelMap"/>
    247 <ref bean="commonChartsModelMap"/>
    248 <ref bean="commonMapsModelMap"/>
    249247                        </list>
    250248                </property>
     
    285283        </bean>
    286284
     285        <bean id="queryModuleToDefaultCriteriaController" class="org.ibisph.web.springmvc.SetDefaultQueryDefinitionSessionController">
     286                <description>
     287                        AJAX handler that converts the user's current session query module
     288                        selections to a saved query definition and puts that into the user's
     289                        session.  If the "clear" http request parameter value is sent then
     290                        the saved query is removed from the user's session so that it is not
     291                        applied when loading new QMs.
     292                </description>
     293                <property name="queryModuleSessionName"            value="#{queryModuleSessionName.string}"/>
     294                <property name="defaultQueryDefinitionSessionName" value="#{queryDefaultQueryDefinitionSessionName.string}"/>
     295                <property name="queryModuleXMLToQueryDefinitionXMLService" ref="queryDefinitionModuleToDefinitionService"/>
     296        </bean>
     297
    287298
    288299
  • trunk/ibisph-view/src/main/webapp/xsd/query_module.xsd

    r20835 r20981  
    215215                                                        <xsd:element ref ="PARAMETERS" minOccurs="0"/>
    216216
     217                                                        <!-- Set into the REQUEST element via the
     218                                                                QuerModuleXML.initQueryModule java code.
     219                                                        -->
    217220                                                        <xsd:element name="DEFAULT_CATEGORY_DIMENSION_NAME" type="xsd:string" minOccurs="0"/>
    218221                                                        <xsd:element name="DEFAULT_SERIES_DIMENSION_NAME"   type="xsd:string" minOccurs="0"/>
  • trunk/ibisph-view/src/main/webapp/xslt/_ibis-include.xslt

    r20976 r20981  
    1313                <summary>Library of generic/common ibis include related functions</summary>
    1414        </ibis:doc>
    15 
    1615
    1716
     
    117116        <xsl:template match="ibis:include" mode="#all"
    118117                ibis:doc="
    119                         'ibis:' namespace specific match template which opens
     118                        'ibis:' namespace specific match template which opens and includes
    120119                        the document via the 'href' attribute and does an 'apply-template'
    121                         operation on its contents to process sub 'ibis:include' statements
    122                         and to copy its text, attributes, and processing instructions.
     120                        operation on its contents to process potential sub 'ibis:' matches
     121                        and to copy its text, attributes, and processing instructions.  This
     122                        is a simple match template that calls the main include template so
     123                        that logic is centralized between this general ibis: match and the
     124                        ConfigurationIncludeCriteriaExclude's config name ibis: match.
    123125
    124126                        Provides the IBISPH system the ability to do simple xinclude type
    125127                        operations.  As of 6-2004 the xerces parser 2.6.x has xinclude support
    126128                        but it must be configured when starting the Java JVM or with Java system
    127                         properties.  Since this might not be an option for some deployments (like
     129                        properties.  Since this is not a safe option for some deployments (like
    128130                        Utah's state wide ITS app server) the system wide property solution is not
    129131                        an option.  To handle being able to deploy into environments where we don't
     
    137139
    138140                        See: http://www.sagehill.net/docbookxsl/Xinclude.html
    139 
    140                         This page simply copies the contents of the base document and when it
    141                         hits the ibis:include element it opens the document with an XSLT document
    142                         call based on the href attribute of the xi:include element.  These
    143                         elements are then copied into the source document.
    144 
    145                         NOTE: the included document MUST be a valid XML file e.g. well
    146                         formed with a root/master/parent element.
     141                "
     142        >
     143                <xsl:call-template name="ibis.include">
     144                        <xsl:with-param name="ibisIncludeElement" select="."/>
     145                </xsl:call-template>
     146        </xsl:template>
     147
     148
     149        <xsl:template name="ibis.include"
     150                ibis:doc="
     151                        Core processing template called when matching an ibis:include.  Opens
     152                        the document via the 'href' attribute and does an 'apply-template'
     153                        operation on its contents to copy and process content (like sub
     154                        'ibis:include' statements and/or other processing instructions).
     155
     156                        This code simply copies the contents of the base document and when it
     157                        hits the other processing elements like sub ibis:include elements it
     158                        matches and recursively calls this template to process...
    147159
    148160                        If a children-only-flag attribute exists in the element then only the
     
    150162                        for including an element's text without having to include its root
    151163                        element or for custom dimension lists for query modules.
    152                 "
    153         >
    154                 <xsl:variable name="url" select="if(0 != string-length(@use-prefix)) then concat($ibis.baseRequestPath, @href) else @href"/>
    155                 <xsl:apply-templates select=
    156                         "if(exists(@children-only-flag))
    157                                 then document($url, /)/(*/text() | */*)
    158                                 else document($url, /)
    159                         "
    160                         mode="ibis.copy"
    161                 />
    162         </xsl:template>
    163 
    164 
    165         <xsl:template match="ibis:include[boolean(@child-name-list)]" mode="#all"
    166                 ibis:doc="
    167                         Provides the ability to limit included DIMENSION and any other include
     164                       
     165                        child-name-list (with list of delimited values) provides the ability
     166                        to limit included elements (like DIMENSION) and any other include
    168167                        that has the standard NAME element.  This provides a mechanism to
    169168                        limit child elements to a given name or a CSV or white space delimited
    170                         list of names.  See the ibis:include function for more info about
    171                         this template mechanism works.
    172 
    173                         This template should only be implemented for child elements that
    174                         contain a sub NAME element.
     169                        list of names.  This template by definition is limited to including
     170                        only child elements so the  children-only-flag is not needed/used.
     171
     172                        apply-baseRequestPath causes the doc href to be prefixed with the
     173                        ibis.baseRequestPath value.  For normal XSLT views the ibis.baseRequestPath
     174                        value IS injected as a parameter into the transformation engine. 
     175                        This value is NOT available and thus not injected into the special
     176                        query module XSLT include processing (see the notes in the
     177                        ConfigurationIncludeCriteriaExclude) so this attribute as of 7/7/2020
     178                        can NOT be applied for any QM ibis:includes.
     179
     180                        IMPORTANT NOTE:
     181                        Prior to 7/7/2020 had various include attribute matching templates
     182                        that handled more specialized processing.  However, as things evolved
     183                        into more complex functionality that code was moved into this template
     184                        so that more explicit processing could be implemented that is easier
     185                        to follow and so that it could be called from various include matches 
     186                        (like ConfigurationIncludeCriteriaExclude) so that didn't have to
     187                        duplicate handling rules.  See that code for some of the attempts to
     188                        allow for module matches.
    175189                "
    176190        >
    177                 <xsl:variable name="names"       select="tokenize(normalize-space(replace(@child-name-list, ',', ' ')), '\s+')"/>
    178                 <xsl:variable name="rootElement" select="document(@href)/*"/>
    179 
    180 <xsl:message select="concat('in NEW child name list, href=', @href, ', Count of elements: ', count($rootElement/*), ', ibis.baseRequestPath: ', $ibis.baseRequestPath)"/>
    181 <xsl:message select="."/>
    182                 <xsl:for-each select="$names">
    183 <xsl:message select="."/>
    184                         <xsl:apply-templates select="$rootElement/*[NAME=current()]" mode="ibis.copy"/>
    185                 </xsl:for-each>
    186         </xsl:template>
    187 
    188 
    189 
    190         <xsl:template match="ibis:xxxxxxxinclude[boolean(@child-name-list)]" mode="#all"
    191                 ibis:doc="
    192                         Provides the ability to limit included DIMENSION and any other include
    193                         that has the standard child NAME element.  This provides a mechanism to
    194                         limit child elements to a given name or a CSV or white space delimited
    195                         list of names.  By definition this include already handles the child
    196                         only inclusions so no special include processing is done for this. 
    197                         Also the special QM config name list processing is handled in specific
    198                         QM XSLT XML code.  See the ibis:include function for more info about
    199                         how the ibis:include mechanism works.
    200                 "
    201         >
    202                 <xsl:variable name="names"       select="tokenize(normalize-space(replace(@child-name-list, ',', ' ')), '\s+')"/>
    203                 <xsl:variable name="rootElement" select="document(@href, /)"/>
    204 
    205                 <xsl:for-each select="$names">
    206 <xsl:message select="."/>
    207 <xsl:message select="$rootElement/*"/>
    208                         <xsl:apply-templates select="$rootElement/*[NAME=current()]" mode="ibis.copy"/>
    209                 </xsl:for-each>
     191                <xsl:param name="ibisIncludeElement"/>
     192
     193                <xsl:variable name="url" select="if(exists($ibisIncludeElement/@apply-baseRequestPath)) then concat($ibis.baseRequestPath, $ibisIncludeElement/@href) else $ibisIncludeElement/@href"/>
     194                <xsl:choose>
     195                        <xsl:when test="exists($ibisIncludeElement/@child-name-list)">
     196                                <xsl:variable name="names" select="tokenize(normalize-space(replace($ibisIncludeElement/@child-name-list, ',', ' ')), '\s+')"/>
     197                                <xsl:apply-templates select="document($url)/*/*[NAME=$names]" mode="ibis.copy"/>
     198                        </xsl:when>
     199                        <xsl:when test="exists($ibisIncludeElement/@children-only-flag)">
     200                                <xsl:apply-templates select="document($url, /)/(*/text() | */*)" mode="ibis.copy"/>
     201                        </xsl:when>
     202                        <xsl:otherwise>
     203                                <xsl:apply-templates select="document($url, /)/*" mode="ibis.copy"/>
     204                        </xsl:otherwise>
     205                </xsl:choose>
    210206        </xsl:template>
    211207
  • trunk/ibisph-view/src/main/webapp/xslt/xml/query/module/ConfigurationIncludeCriteriaExclude.xslt

    r20976 r20981  
    1717                        everything EXCEPT non selected configuration elements (e.g. NAME not
    1818                        equal to the 'ConfigurationName' parameter).  A blank matching technique
    19                         was employed to deal with excluded SECTION, and DIMENSIONs.
     19                        was employed to eat/deal with excluded SECTION, and DIMENSIONs.
    2020                </description>
    2121        </ibis:doc>
    2222
    2323
    24         <xsl:param name="ConfigurationName"
    25                 ibis:doc="Query module configuration name specified by the user and
    26                         passed into the transformation via the Java servlet controller."
     24        <xsl:param name="ConfigurationName" select="/QUERY_MODULE/REQUEST/CONFIGURATION_NAME"
     25                ibis:doc="Query module configuration name specified from the HTTP request
     26                        or selected QD to QM.  This value is passed into the transformation
     27                        via the Java modelmaps and QM XML services.  This value is typically
     28                        that in the select above.  Since this config name is used by the java
     29                        code it is also explicitly passed as a parameter.
     30                "
    2731        />
    2832        <xsl:param name="configuration"
     
    6569
    6670
    67 <!-- Could use this to hook and do config includes for DS, DIMs etc.
    68 
    69         <xsl:template match="/QUERY_MODULE/CONFIGURATIONS/CONFIGURATION[NAME = $ConfigurationName]" mode="ibis.copy"
    70                 ibis:doc="used to include the AV definitions, VT, VA, possibly DIMs?
    71                 "
    72         >
    73                 <xsl:message select="concat('QM XSLT - CONFIG NAME: ', $ConfigurationName)"/>
    74                 <xsl:message select="self::*"/>
    75 <xsl:copy>
    76                 <xsl:apply-templates mode="ibis.copy"/>
    77 </xsl:copy>
    78         </xsl:template>
    79 -->
    80 
    81 
    82 
    8371        <xsl:template match="SECTION[NAME = $configuration/CRITERIA/EXCLUDE/SECTION_NAMES/SECTION_NAME]" mode="ibis.copy"
    8472                ibis:doc="Eat the SECTION element if in configuration criteria exclusion.
     
    10694        <xsl:template match="ibis:include[boolean(@configuration-name-list)]" mode="#all"
    10795                ibis:doc="
    108                         Provides the ability to limit includes to a given configuration name(s)
    109                         via a delimited list of names.  The list can be space and/or comma
    110                         and or line break separated list of configuration names. 
     96                        Provides the ability to limit includes to QM configuration name(s)
     97                        via an ibis:include configuration-name-list attribute.  The value
     98                        of this attribute is a delimited list of QM configuration names
     99                        which are space and/or comma and/or line break separated. 
    111100
    112101                        If the name matches the Java injected QM config name then this
    113                         template recreates a similar ibis:include sans the configuration-name-list
    114                         and calls apply templates so that the standard ibis:include code is
    115                         applied.  See the ibis:include function for more info. 
     102                        template processes the content using the standard ibis.include template
     103                        call.  Tried many options for module match templates of which some
     104                        appear in a temp commit 7/6/2020.  The '@* except' results in a set
     105                        of the include element's attributes (sans what is excepted).  This
     106                        works as long as only the attributes are processed.  If the node()
     107                        is included then the href attribute is duplicated which causes a
     108                        runtime execption.  Tried creating an element which works except
     109                        internal xslt elements have a document path that is relative to the
     110                        XSLT NOT the current XML document path.  This works as long as an
     111                        explicit full path is used.  However, since this would be confusing 
     112                        to the QM developers and inconsist, the current solution of calling
     113                        the centralized include code (which contains clearer, explici
     114                        processing steps/rules) was used.
     115
     116                        ibis:include attributes: Since this calls the main ibis.include
     117                        template all attributes are handled except:
     118
     119                        apply-baseRequestPath causes the doc href to be prefixed with the
     120                        ibis.baseRequestPath value.  For normal XSLT views the ibis.baseRequestPath
     121                        value IS injected as a parameter into the transformation engine. 
     122                        This value is NOT available and thus not injected into the special
     123                        query module XSLT include processing so this attribute as of 7/7/2020
     124                        can NOT be applied for any QM ibis:includes.
     125
     126                        TODO: at some future point if needed the ibis.baseRequestPath value
     127                        could be injected into the parameters that are passed to the common
     128                        transformation engine that is used for the QM XML service. 
    116129                "
    117130        >
    118131                <xsl:variable name="configurationNames" select="tokenize(normalize-space(replace(@configuration-name-list, ',', ' ')), '\s+')"/>
    119132                <xsl:if test="$configurationNames = $ConfigurationName">
    120                         <xsl:variable name="url" select="if(0 != string-length(@use-prefix)) then concat($ibis.baseRequestPath, @href) else @href"/>
    121                         <xsl:choose>
    122                                 <xsl:when test="exists(@child-name-list)">
    123                                         <xsl:variable name="names"       select="tokenize(normalize-space(replace(@child-name-list, ',', ' ')), '\s+')"/>
    124                                         <xsl:variable name="rootElement" select="document($url)/*"/>
    125                                         <xsl:for-each select="$names">
    126                                                 <xsl:apply-templates select="$rootElement/*[NAME=current()]" mode="ibis.copy"/>
    127                                         </xsl:for-each>
    128                                 </xsl:when>
    129                                 <xsl:when test="exists(@children-only-flag)">
    130                                         <xsl:apply-templates select="document($url, /)/(*/text() | */*)" mode="ibis.copy"/>
    131                                 </xsl:when>
    132                                 <xsl:otherwise>
    133                                         <xsl:apply-templates select="document($url, /)/*" mode="ibis.copy"/>
    134                                 </xsl:otherwise>
    135                         </xsl:choose>
     133                        <xsl:call-template name="ibis.include">
     134                                <xsl:with-param name="ibisIncludeElement" select="."/>
     135                        </xsl:call-template>
    136136                </xsl:if>
    137137        </xsl:template>
    138138
    139 
    140 
    141 <!--
    142 UNSUCCESSFUL TRIES:
    143 
    144 <xsl:variable name="ibisIncludeElement">
    145                                 <xsl:element name="ibis:include">
    146                                         <xsl:attribute name="href"><xsl:value-of select="if(exists(@use-prefix)) then concat($ibis.baseRequestPath, @href) else @href"/></xsl:attribute>
    147                                         <xsl:if test="0 != string-length(@child-name-list)"><xsl:attribute name="child-name-list"><xsl:value-of select="@child-name-list"/></xsl:attribute></xsl:if>
    148                                         <xsl:if test="0 != string-length(@children-only-flag)"><xsl:attribute name="children-only-flag"><xsl:value-of select="@children-only-flag"/></xsl:attribute></xsl:if>
    149                                 </xsl:element>
    150                         </xsl:variable>
    151 <xsl:message select="$ibisIncludeElement"/>
    152 
    153                         <xsl:apply-templates select="$ibisIncludeElement" mode="ibis.copy"/>
    154 
    155 
    156 <xsl:attribute-set name="font">
    157   <xsl:attribute name="fname">Arial</xsl:attribute>
    158   <xsl:attribute name="size">14px</xsl:attribute>
    159   <xsl:attribute name="color">red</xsl:attribute>
    160 </xsl:attribute-set>
    161 
    162 <xsl:element
    163   name="element-name"
    164   namespace="URI"
    165   use-attribute-sets="qname"
    166 >
    167 </xsl:element>
    168 
    169 <xsl:variable name="ibisIncludeElement">
    170                         <xsl:copy-of select=". | @* except @configuration-name-list"/>
    171 </xsl:variable>
    172 
    173 <xsl:variable name="ibisIncludeElement" select="@* except @configuration-name-list | *"/>
    174 
    175                         <xsl:apply-templates select="$ibisIncludeElement" mode="ibis.copy"/>
    176 
    177 
    178 <xsl:variable name="ibisIncludeElement">
    179                                 <xsl:element name="ibis:include" >
    180                                         <xsl:attribute name="href"><xsl:value-of select="if(exists(@use-prefix)) then concat($ibis.baseRequestPath, @href) else @href"/></xsl:attribute>
    181                                         <xsl:if test="0 != string-length(@child-name-list)"><xsl:attribute name="child-name-list"><xsl:value-of select="@child-name-list"/></xsl:attribute></xsl:if>
    182                                         <xsl:if test="0 != string-length(@children-only-flag)"><xsl:attribute name="children-only-flag"><xsl:value-of select="@children-only-flag"/></xsl:attribute></xsl:if>
    183                                 </xsl:element>
    184                         </xsl:variable>
    185 
    186                         <xsl:apply-templates select="$ibisIncludeElement" mode="ibis.copy"/>
    187 
    188                         <xsl:apply-templates select="node()  | @* except @configuration-name-list"/>
    189 
    190 
    191 <xsl:message select="$ConfigurationName"/>
    192 <xsl:message select="node() | @* except @configuration-name-list"/>
    193                         <xsl:apply-templates select="node() | (@* except @configuration-name-list)"  mode="ibis.copy"/>
    194 
    195                         <xsl:variable name="rootElement" select="document(@href)/*">
    196                                 <xsl:if test="0 != string-length(@child-name-list)"><xsl:attribute name="child-name-list"><xsl:value-of select="@child-name-list"/></xsl:attribute></xsl:if>
    197                                 <xsl:if test="0 != string-length(@children-only-flag)"><xsl:attribute name="children-only-flag"><xsl:value-of select="@children-only-flag"/></xsl:attribute></xsl:if>
    198                         </xsl:variable>
    199                         <xsl:apply-templates select="$rootElement" mode="ibis.copy"/>
    200 
    201 <xsl:message select="$ConfigurationName"/>
    202                         <xsl:apply-templates select="node() | (@* except @configuration-name-list)" mode="ibis.copy"/>
    203 -->
    204 
    205 
    206139</xsl:stylesheet>
    207140<!-- ============================= End of File ============================= -->
  • trunk/ibisph/src/main/java/org/ibisph/querydefinition/service/QueryDefinitionXMLToQueryModuleXML.java

    r20915 r20981  
    6969   * after loading the QM.  The called funcs clear all existing QM user selected
    7070   * dims, group bys, chart, map, and replaces with those from the QD (if they
    71    * are eligible).  Hidden params are NOT set with this code.  This is a mixed
    72    * bag as if same module then these should be set to make sure things run properly.
    73    * However, this "apply" criteria is used for studies and for multiple 
     71   * are eligible).  See the dev comments within QueryModuleFromHTTPRequest
     72   * getModel for more info.
     73   *
     74   * IMPORTANT NOTE: Hidden params are NOT set with this code.  This is a mixed
     75   * bag - if same module then these should be set to make sure things run properly.
     76   * However, this code is used for "apply" criteria - for studies over multiple
     77   * QM requests.  Even though hiddens can be processed for the param name to
     78   * match we still can't rely on the value as this is set via script that relies
     79   * on other selected values.  As such it's is safer to not set any hiddens and
     80   * rely on the user going through the builder and the builder submit java script
     81   * to set (hiddens are not widely used by QMs so it's not a huge risk either way).
    7482   *
    7583   * @param queryModule query module document to have the saved query definition's
     
    181189   * Sets the query module document's selected groupby dim names, chart, and
    182190   * map request element values.  This method is used for the "apply" use case
    183    * as the load QD to QM is 1:1 and uses the entire REQUEST element.  Since
    184    * apply can go through the builder or result the ACTUAL selected group bys
    185    * need to be set.  Since it is an apply any other non QD set values will be
    186    * cleared.
     191   * as the load or run QD is 1:1 with the QM and uses the entire QD REQUEST.
     192   * The QM submit to IBISQ code handles setting the ACTUAL selected group bys
     193   * so all that is needed is the selecteds.  Since it is an apply and only when
     194   * the module is loaded need to make a best attempt to clean any non selected
     195   * QD values is possible.  See rules below:
    187196   *
    188197   * @param queryDefinition provides the source values to apply to the query module.
     
    191200   */
    192201  protected void setSelectedControls(Node queryDefinition, Node queryModule) {
     202    // Set selected group bys (actuals are set via IBISQ result modelmap).
     203    // The QD stores has all assoc selected values via the copied QM RESULT
     204    // element.  When the QM is first loaded by the QueryModuleXML service, it
     205    // populates the default QM REQUEST using the QM config's DEFAULT_ and
     206    // _MapName type parameters.  That service then loads any "apply" session
     207    // QD selections to that just loaded QM.  The issues are with the apply is
     208    // that the QM might not have the QD's group by dims. 
     209    // HIGH LEVEL RULES:
     210    // 1. CAT:  check QD's cat dim is valid for this QM.  If not valid then
     211    //    don't set - leave the QM default cat group by as is. 
     212    // 2. If valid dim for that QM then set to the QD's selected cat dim. 
     213    // 3. SERIES.  if QD not set then clear QM series.
     214    // 4. If QD SERIES is valid for that QM then set it. 
     215    // 5. If QD SERIES is not valid then clear it.
     216    // 6. OTHER: Other is typically used as a constant.  Leave the QM other as is.
     217    // 7. Finally clear any dups.  Start with other against the series and cat.
     218    //    If matches clear other.  Next try series against the cat and again if
     219    //    matches clear the series.
     220    // More Concise Rules:
     221    // - Delete the default QM series.  Either way it will either be cleared or replaced.
     222    // - Set the QM category to the QD category if valid.  Otherwise leave QM as is.
     223    // - Set the QM series to the QD series if valid AND not same as category or other.
     224    Node queryDefinitionRequestSelectedGroupBy = XMLLib.getNode(queryDefinition, "REQUEST/SELECTED_GROUP_BY");
     225    Node queryModuleRequestSelectedGroupBy     = XMLLib.getNode(queryModule,     "/QUERY_MODULE/REQUEST/SELECTED_GROUP_BY");
     226    XMLLib.deleteNodes(queryModuleRequestSelectedGroupBy, "SERIES_DIMENSION_NAME");
     227    processSelectedGroupByDimensionName(queryDefinitionRequestSelectedGroupBy, "CATEGORY_DIMENSION_NAME", queryModule, queryModuleRequestSelectedGroupBy);
     228    processSelectedGroupByDimensionName(queryDefinitionRequestSelectedGroupBy, "SERIES_DIMENSION_NAME",   queryModule, queryModuleRequestSelectedGroupBy);
     229
     230    // If the cat or other GROUP_BYs are same as series delete the series group by.
     231    XMLLib.deleteNodes(queryModuleRequestSelectedGroupBy, "SERIES_DIMENSION_NAME[(text() = ../CATEGORY_DIMENSION_NAME) or (text() = ../OTHER_DIMENSION_NAME)");
     232   
     233    // set the chart name and map name.
    193234    String configurationName = XMLLib.getText(queryModule, "/QUERY_MODULE/REQUEST/CONFIGURATION_NAME");
    194235    Node queryModuleConfiguration = XMLLib.getNode(queryModule, "/QUERY_MODULE/CONFIGURATIONS/CONFIGURATION[NAME='" + configurationName + "']");
    195 
    196     // process the group bys.  Since
    197     Node queryDefinitionRequestSelectedGroupBy = XMLLib.getNode(queryDefinition, "REQUEST/SELECTED_GROUP_BY");
    198     Node queryModuleRequestSelectedGroupBy     = XMLLib.getNode(queryModule,     "/QUERY_MODULE/REQUEST/SELECTED_GROUP_BY");
    199     setSelectedGroupByDimensionName(queryDefinitionRequestSelectedGroupBy, "CATEGORY_DIMENSION_NAME", queryModule, queryModuleRequestSelectedGroupBy);
    200     setSelectedGroupByDimensionName(queryDefinitionRequestSelectedGroupBy, "SERIES_DIMENSION_NAME",   queryModule, queryModuleRequestSelectedGroupBy);
    201     setSelectedGroupByDimensionName(queryDefinitionRequestSelectedGroupBy, "OTHER_DIMENSION_NAME",    queryModule, queryModuleRequestSelectedGroupBy);
    202 
    203     // If measure name specified as part of the saved query def AND the measure
    204     // is part of the QM's selected config then set it.
    205     String queryDefinitionMeasureName = XMLLib.getText(queryDefinition, "REQUEST/MEASURE_NAME");
    206     if(StrLib.isSomething(queryDefinitionMeasureName) &&
    207       (null != XMLLib.getNode(queryModuleConfiguration, "MEASURES/MEASURE[NAME='" + queryDefinitionMeasureName +"' and not(NO_DISPLAY_FLAG)]" ))
    208     ) {
    209       XMLLib.replaceContainedNode(
    210         queryModule,
    211         "/QUERY_MODULE/REQUEST",
    212         XMLLib.newNode("MEASURE_NAME", queryDefinitionMeasureName)
    213       );
    214     }
    215 
    216     // do a similar thing for the chart name and map name.
    217236    String queryDefinitionChartName = XMLLib.getText(queryDefinition, "REQUEST/CHART_NAME");
    218237    if(StrLib.isSomething(queryDefinitionChartName) &&
     
    240259
    241260  /**
    242    * Helper that localizes setting the QM request GroupByDimensionName type
    243    * element.  This is used for "apply" type merges with the following rules:
    244    * If the QD's GROUP_BY does not exist delete it from the QM.
    245    * Else check that the QD's GROUP_BY value is a valid QM GROUP_BY by checking
    246    *   that it exists as a QM DIMENSION.
    247    *   Check the QM already having that value set in a group by and if found
    248    *     delete it from the QM so no chance of duplication.
    249    *   Add the valid group by dimension to the QM (which because of the call
    250    *     order has everything in the correct position).
     261   * Helper that localizes setting the QM request GroupByDimensionName element. 
     262   * This tests to make sure the QD's group by is valid (QM has the dim and is
     263   * not excluded).  If valid then sets the QM's value otherwise leaves QM as
     264   * is. 
    251265   *
    252266   * @param queryDefinitionRequestSelectedGroupBy source to read
     
    255269   * @param queryModuleRequestSelectedGroupBy destination to set
    256270   */
    257   protected void setSelectedGroupByDimensionName(
    258     Node queryDefinitionRequestSelectedGroupBy,
    259     String groupByElementName,
    260     Node queryModule,
    261     Node queryModuleRequestSelectedGroupBy
    262   ) {
    263     String queryDefinitionGroupByValue = XMLLib.getText(queryDefinitionRequestSelectedGroupBy, groupByElementName);
    264 
    265     // If the QD GROUP_BY is not set need to delete it from the QM.
    266     if(!StrLib.isSomething(queryDefinitionGroupByValue)) {
    267       XMLLib.deleteNodes(queryModule, "/QUERY_MODULE/REQUEST/SELECTED_GROUP_BY/" + groupByElementName);
    268     }
    269 
    270     // check that the QM has the group by DIMENSION.  If not then skip.
    271     else if(
    272       (null != XMLLib.getNode(queryModule, "/QUERY_MODULE/DIMENSIONS/DIMENSION[NAME='" + queryDefinitionGroupByValue + "']")) &&
    273       (null == XMLLib.getNode(queryModule, "/QUERY_MODULE/CONFIGURATIONS/CONFIGURATION/CRITERIA/EXCLUDE/DIMENSION_NAMES[DIMENSION_NAME='" + queryDefinitionGroupByValue + "']"))
     271  protected String processSelectedGroupByDimensionName(
     272      Node queryDefinitionRequestSelectedGroupBy,
     273      String groupByElementName,
     274      Node queryModule,
     275      Node queryModuleRequestSelectedGroupBy
    274276    ) {
    275  
    276       // Delete any QM GROUP_BYs that are grouping by the same dimension - duplicate.
    277       XMLLib.deleteNodes(queryModule, "/QUERY_MODULE/REQUEST/SELECTED_GROUP_BY/*[text() = '" + queryDefinitionGroupByValue + "']");
    278 
    279       // set the QM's with the QD's
    280       Node groupBy = XMLLib.newNode(groupByElementName, queryDefinitionGroupByValue);
    281       XMLLib.replaceContainedNode(queryModuleRequestSelectedGroupBy, groupBy);
    282     }
    283   } //-------------------------- End of Method ------------------------------
    284 
    285 
    286   /**
    287    * Sets the query module document's PARAMETER VALUE elements which have a
    288    * HIDDEN_INPUT_FLAG element AND has a name that matches the saved query
     277      String queryDefinitionGroupByDimension = XMLLib.getText(queryDefinitionRequestSelectedGroupBy, groupByElementName);
     278      if(
     279        (null != XMLLib.getNode(queryModule, "/QUERY_MODULE/DIMENSIONS/DIMENSION[NAME='" + queryDefinitionGroupByDimension + "']")) &&
     280        (null == XMLLib.getNode(queryModule, "/QUERY_MODULE/CONFIGURATIONS/CONFIGURATION/CRITERIA/EXCLUDE/DIMENSION_NAMES[DIMENSION_NAME='" + queryDefinitionGroupByDimension + "']"))
     281      ) {
     282        Node groupBy = XMLLib.newNode(groupByElementName, queryDefinitionGroupByDimension);
     283        XMLLib.replaceContainedNode(queryModuleRequestSelectedGroupBy, groupBy);
     284      }
     285
     286      return(queryDefinitionGroupByDimension);
     287    } //-------------------------- End of Method ------------------------------
     288
     289
     290 
     291 
     292 
     293 
     294 
     295 
     296 
     297 
     298 
     299 
     300 
     301 
     302  /**
     303   * Sets the query module document's hidden PARAMETER VALUE elements (have a
     304   * HIDDEN_INPUT_FLAG element) AND has a name that matches the saved query
    289305   * definition parameter name.  HIDDEN_INPUT_FLAG results in the parameter
    290    * being placed on the builder page's form for javascript to adjust the value
    291    * on the fly as a user makes different selections.  This method sets those
    292    * saved query def param values that were submitted from the builder page. 
    293    * Note that this method does NOT clear any existing values - it simply sets
    294    * ALL values that have a hidden input flag and a matching name.  This is not
    295    * an issue for all QD detail, QD run, or QD builder requests as these are
    296    * clean QMs. 
    297    *
    298    * IMPORTANT NOTE: The main issue is that if the builder page cleared a param
    299    * then the QD would not have it and it would not get cleared when doing this
    300    * merge.  The alternative is to delete all hidden params before loading the
    301    * QDs params (but only doing this for the request result request).  The issue
    302    * with this is that subsequent builder requests *might* not contain the full
    303    * set of hidden params and thus a page script error would occur.  This is not
    304    * likely but could happen if deleted.  The flip side is also not likely where
    305    * the script cleared a value and not it reappears.  The saft thing is to
    306    * simply no do any script and if doing script always set the value to a non
    307    * blank value.
     306   * being put into a hidden INPUT within the builder page's form.  Javascript
     307   * can then adjust the hidden value on the fly as a user makes different
     308   * selections. 
     309   *
     310   * HIDDEN NOTES: this method does NOT clear any existing param values - it 
     311   * simply sets ALL values that have a hidden input flag and a matching name. 
     312   * Also, hiddens are rarely used by adopters because specific jscript is needed
     313   * to make it work.  The processing of hiddens is not needed for QD detail or 
     314   * QD builder requests but must be done when a QD is being ran directly.
     315   *
     316   * The main issue is that if the builder page cleared a param then the QD would
     317   * not have it and it would not get cleared when doing this merge.  The
     318   * alternative is to delete all hidden params before loading the QDs params
     319   * (but only doing this for the request result request).  The issue with this
     320   * is that subsequent builder requests *might* not contain the full set of hidden
     321   * params (because of a blank value not being posted back to the controller)
     322   * and thus a page script error would occur.  This is not likely but could
     323   * happen if deleted.  The flip side is also not likely where the script cleared
     324   * a value and not it reappears. 
    308325   *
    309326   * @param queryModule query module document to have selected dimensions added to.
  • trunk/ibisph/src/main/java/org/ibisph/querydefinition/service/QueryModuleXMLToQueryDefinitionXML.java

    r20915 r20981  
    66import org.dom4j.Node;
    77
    8 import org.ibisph.util.StrLib;
    98import org.ibisph.util.XMLLib;
    109
     
    149148  } // -------------------------- End of Method ------------------------------
    150149
    151 
    152 // GARTH TODO: REMOVE
    153  
    154   /**
    155    * Sets the query definition document's selected groupby dim names, graphic,
    156    * and measure elements. This method sets those values based on the passed
    157    * query module which was submitted from the builder page. Note that this
    158    * method does NOT clear any existing values - it simply sets the values and
    159    * adds any that are missing.
    160    * @param queryModule query module document to get the selected dimensions
    161    *   from.
    162    * @param queryDefinition destination query definition to have the controls
    163    *   added to.
    164    */
    165   public void setSelectedControls(Node queryModule, Node queryDefinition) {
    166     Node queryModuleRequestNode = XMLLib.getNode(queryModule, "/QUERY_MODULE/REQUEST");
    167     XMLLib.deleteNode(queryModuleRequestNode.selectSingleNode("SELECTED_GROUP_BY"));
    168     Node queryModuleRequestSelectedGroupByNode = XMLLib.newNode("SELECTED_GROUP_BY");
    169     XMLLib.addNode(queryModuleRequestNode, queryModuleRequestSelectedGroupByNode);
    170 
    171     // set the group bys...
    172     setSelectedGroupByDimensionName(
    173       queryModuleRequestSelectedGroupByNode,
    174       queryDefinition,
    175       "CATEGORY_DIMENSION_NAME"
    176     );
    177     setSelectedGroupByDimensionName(
    178       queryModuleRequestSelectedGroupByNode,
    179       queryDefinition,
    180       "SERIES_DIMENSION_NAME"
    181     );
    182     setSelectedGroupByDimensionName(
    183       queryModuleRequestSelectedGroupByNode,
    184       queryDefinition,
    185       "OTHER_DIMENSION_NAME"
    186     );
    187 
    188     // Set specified measure name. If not specified then leave as is - default.
    189     String measureName = XMLLib.getText(queryDefinition, "REQUEST/MESAURE_NAME");
    190     if (StrLib.isSomething(measureName)) {
    191       XMLLib.setText(queryModule, "QUERY_MODULE/REQUEST", "MESAURE_NAME", measureName);
    192     }
    193 
    194     // do a similar thing for the chart and names.
    195     String chartName = XMLLib.getText(queryDefinition, "REQUEST/CHART_NAME");
    196     if (StrLib.isSomething(chartName)) {
    197       XMLLib.setText(queryModule, "QUERY_MODULE/REQUEST", "CHART_NAME", chartName);
    198     }
    199 
    200     String mapName = XMLLib.getText(queryDefinition, "REQUEST/MAP_NAME");
    201     if (StrLib.isSomething(mapName)) {
    202       XMLLib.setText(queryModule, "QUERY_MODULE/REQUEST", "MAP_NAME", mapName);
    203     }
    204 
    205   } // -------------------------- End of Method ------------------------------
    206 
    207 
    208   /**
    209    * Helper that localizes setting the query definition Group By Dimension Name.
    210    * @param queryModuleRequestSelectedGroupByElement source of the group by.
    211    * @param queryDefinition destination definition to be set.
    212    * @param groupByElementName Element name used to looked up and stored.
    213    */
    214   protected void setSelectedGroupByDimensionName(
    215     Node queryModuleRequestSelectedGroupByNode,
    216     Node queryDefinition,
    217     String groupByElementName
    218   ) {
    219     String groupByValue = XMLLib.getText(queryDefinition, "REQUEST/SELECTED_GROUP_BY/" + groupByElementName);
    220     if (StrLib.isSomething(groupByValue)) {
    221       XMLLib.setText(queryModuleRequestSelectedGroupByNode, groupByElementName, groupByValue);
    222     }
    223   } // -------------------------- End of Method ------------------------------
    224 
    225150} // ============================ END OF CLASS =================================
  • trunk/ibisph/src/main/java/org/ibisph/querymodule/modelmap/QueryModuleFromHTTPRequest.java

    r20915 r20981  
    146146      || (StrLib.isSomething(this.reloadRequestParameterName) && StrLib.isSomething(request.getParameter(this.reloadRequestParameterName)))
    147147    ) {
     148// GARTH TODO: model map has the webapp context path that could be injected into 
     149// the service.  It's not part of the request so have to change the model map
     150// type and pass the current modelmap in with the key value to get the value (key
     151// is the same value for both from model map and destination XSLT parameter).
     152// Issues are that there are several places the service is used so all would need
     153// to have this base path retrieved and injected.  Also, have to test when extra
     154// params are put into the map to make sure that they are in the map so it can
     155// be retrieved.  So code would be something like: 
     156// queryModule = this.queryModuleService.getQueryModule(configurationPath, webappBaseContextPath);
    148157      queryModule = this.queryModuleService.getQueryModule(configurationPath);
    149158
    150       // Now that the QM has been loaded need to process for any session apply
     159      // Now that the QM has been loaded need to process for session apply saved
    151160      // query criteria.  This "apply" is only performed when a QM is first loaded
    152161      // from an http request (e.g. builder or result UI).  This code prior to
    153162      // 6/2020 was implemented as a model map for builder and result which made
    154       // it have incorrect hehavior as it should only be applied once so the user
    155       // can override it.  Also don't want this applied to loading a saved query
    156       // or query content blocks etc.
     163      // it have incorrect behavior it was being applied each and every time the
     164      // request was made even though the user might have changed the values. 
     165      // This new behavior is to only apply the criteria once when the QM is
     166      // first loaded and only for builder or result requests (i.e. not for loading
     167      // saved query or query content requests.  This allows the user to have
     168      // the applied criteria initially with the ability to override it. As such
     169      // this code can't be implemented within another model map because it doesn't
     170      // know if the QM was just loaded.  Also, can't implement within the
     171      // QueryModuleXML service's init code because this is used for all QM loads.
    157172      if(StrLib.isSomething(this.defaultQueryDefinitionSessionName) && (null != queryDefinitionXMLToQueryModuleXMLService)) {
    158173        Node queryDefinition = (Node)request.getSession().getAttribute(this.defaultQueryDefinitionSessionName);
  • trunk/ibisph/src/main/java/org/ibisph/querymodule/service/QueryModuleXML.java

    r19940 r20981  
    109109      parameterMap.put(this.transformationConfigurationNameParameterName, configurationName);
    110110      parameterMap.put(this.contentBasePathURLParameterName, this.contentBasePathURL);
     111
     112// GARTH TODO: at some future need to somehow inject the WebAppBaseRequestPath
     113// parameter so the includes can use the @apply-baseRequestPath.  This value
     114// is set upon the app startup's initial request.  Could be something like:
     115//    protected String webappBaseRequestPathParameterName = "WebAppBaseRequestPath";
     116//    public Node getQueryModule(String configurationPath, String webappBaseRequestPath) throws Exception {
     117// parameterMap.put(this.webappBaseRequestPathParameterName, webappBaseRequestPath);
     118// the QM from QD uses this service and would also need to have the value injected
     119// in it's getQueryModule call.
    111120      queryModule = ((IncludeProcessingGetModel)this.getModelService).get(filePathAndName, parameterMap);
    112121    }
  • trunk/ibisph/src/main/java/org/ibisph/xml/service/IncludeProcessingGetModel.java

    r16437 r20981  
    132132      xmlSource = new StreamSource(url.toString());
    133133    }
    134    
     134
    135135    DocumentResult domResult = new DocumentResult();
    136136    transformation.transform(
Note: See TracChangeset for help on using the changeset viewer.