Changeset 12319 in main


Ignore:
Timestamp:
11/17/16 14:54:10 (2 years ago)
Author:
Garth Braithwaite
Message:

view - redirect controller cleaned up and example of usage with docs in spring/view.xml. Fixed kendo loading png css. Removed the table sorter js from the core as kendo does this better. Shortened the IP report requests like important_facts to simply facts. Fixed a few icon image context built paths - removed the leading/middle "/".

Location:
trunk
Files:
2 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/ibisph-view/src/main/webapp/WEB-INF/config/SiteSpecific.properties

    r8817 r12319  
    4747#    can be one value while the app knows its context path differently). 
    4848#    This value is then used internally by the code to build the actual request
    49 #    URL.  This value defaults to http://localhost/ibisph-view so if any
    50 #    outside requests WILL fail if this value is not overridden.  Note that there
    51 #    is NO trailing slash "/".
     49#    URL.  This value defaults to http://localhost/ibisph-view so if this is not
     50#    the webapp's address and context the outside request WILL fail (ie set this
     51#    to the approp value). Note that there is NO trailing slash "/".
    5252commonWebAppRemoteURLPrefix.string =http://ibis.health.utah.gov
    5353
  • trunk/ibisph-view/src/main/webapp/WEB-INF/config/spring/SiteSpecific.xml

    r10985 r12319  
    122122                                <entry key="/indicator/index/Categorized.html"      value-ref="indicatorCategorizedIndexController"/>
    123123
    124                                 <entry key="/indicator/view/*.html"                 value-ref="indicatorViewController"/>
    125                                 <entry key="/indicator/view/classic/*.html"         value-ref="indicatorViewClassicController"/>
    126                                 <entry key="/indicator/important_facts/*.html"      value-ref="indicatorImportantFactsController"/>
    127                                 <entry key="/indicator/available_services/*.html"   value-ref="indicatorAvailableServicesController"/>
    128                                 <entry key="/indicator/related/*/*.html"            value-ref="indicatorRelatedIndicatorsController"/>
    129                                 <entry key="/indicator/other_resources/*.html"      value-ref="indicatorOtherResourcesController"/>
    130                                 <entry key="/indicator/complete_profile/*.html"     value-ref="indicatorCompleteProfileController"/>
    131                                 <entry key="/indicator/view_numbers/*.html"         value-ref="indicatorViewNumbersController"/>
    132 
    133                                 <entry key="/indicator/chart/**"                    value-ref="indicatorChartGraphicController"/>
    134                                 <entry key="/indicator/graph/**"                    value-ref="indicatorChartGraphicController"/>
     124                                <entry key="/indicator/view/*.html"          value-ref="indicatorViewController"/>
     125                                <entry key="/indicator/view/classic/*.html"  value-ref="indicatorViewClassicController"/>
     126                                <entry key="/indicator/facts/*.html"         value-ref="indicatorImportantFactsController"/>
     127                                <entry key="/indicator/services/*.html"      value-ref="indicatorAvailableServicesController"/>
     128                                <entry key="/indicator/related/*/*.html"     value-ref="indicatorRelatedIndicatorsController"/>
     129                                <entry key="/indicator/resources/*.html"     value-ref="indicatorOtherResourcesController"/>
     130                                <entry key="/indicator/report/*.html"        value-ref="indicatorCompleteProfileController"/>
     131                                <entry key="/indicator/view/numbers/*.html"  value-ref="indicatorViewNumbersController"/>
     132
     133                                <entry key="/indicator/chart/**"             value-ref="indicatorChartGraphicController"/>
     134                                <entry key="/indicator/graph/**"             value-ref="indicatorChartGraphicController"/>
    135135<!--
    136136<entry key="/indicator/all.html"                    value-ref="indicatorAllController"/>
  • trunk/ibisph-view/src/main/webapp/WEB-INF/config/spring/common.xml

    r11197 r12319  
    239239                </description>
    240240                <property name="modelMapKey" value="#{commonXMLModelMapKey.string}"/>
    241                 <property name="model"><value><![CDATA[<BLANK/>]]></value></property>
     241                <property name="model"><value><![CDATA[<?xml version="1.0" encoding="UTF-8"?><BLANK/>]]></value></property>
    242242        </bean>
    243243
  • trunk/ibisph-view/src/main/webapp/WEB-INF/config/spring/view.xml

    r10985 r12319  
    198198
    199199        <bean id="viewAccessDeniedController" class="org.ibisph.web.springmvc.ModelMapAndViewController">
    200                 <!-- Note that the view resolver adds the /WEB-INF/jsp prefix and .jsp suffix. -->
     200                <!-- Note that a view resolver can add the /WEB-INF/jsp prefix and .jsp
     201                        suffix.  However, for the view webapp a view resolver is not configured
     202                        so the path has to be explicit (relative to the webapp).  See the admin
     203                        app for an example of a configured view resolver.
     204                -->
    201205                <property name="view" value="/WEB-INF/jsp/access_denied.jsp"/>
    202206        </bean>
     207
     208
     209        <!-- REDIRECT CONTROLLER EXAMPLE:
     210                This can be used when you want to have a simple URL to share that maps to
     211                a more complex request.  To make this work three things are needed:
     212                1) web.xml has to map the request to the request dispatcher servlet.
     213                2) the request dispatcher needs to have a URL to controller mapping.
     214                3) the controller definition which is provided below:
     215        <bean id="viewStaticWaterController" class="org.ibisph.web.springmvc.ModelMapAndViewController">
     216                <property name="view">
     217                        <bean class="org.ibisph.web.springmvc.SimpleClientRedirectionView">
     218                                <property name="redirectionAddress" value="/environment/water/Introduction.html"/>
     219                                <property name="prependWebappContextToRedirectionAddress" value="true"/>
     220                        </bean>
     221                </property>
     222        </bean>
     223
     224        NOTES:
     225                Aonther approach would be to simply create another hard coded controller
     226                that handles the request.  The redirect is preferred because the user can
     227                actually see and bookmark the "real" request URL.  This lessens the
     228                confusion of how do I get back to this page and hey this page is the same
     229                as that page - what's the diff?
     230        -->
    203231
    204232
  • trunk/ibisph-view/src/main/webapp/css/_kendo_overrides.css

    r8761 r12319  
    2727        margin-left:                    1px;
    2828}
    29 
    3029
    3130.k-icon,
     
    143142}
    144143
     144
     145.k-loading-image
     146{
     147        background-image: none;
     148/*      background-image:               url('Silver/loading-image.gif') */
     149}
     150
     151
    145152/*============================ End of Style Sheet ============================*/
  • trunk/ibisph-view/src/main/webapp/xslt/html/SiteSpecific.xslt

    r11498 r12319  
    363363                                                title="Share this page on Facebook"
    364364                                                rel="nofollow" target="_blank">
    365                                                 <img typeof="foaf:Image" src="{$ibis.urlPrefix}/image/icon/32/facebook-blue.png"
     365                                                <img typeof="foaf:Image" src="{$ibis.urlPrefix}image/icon/32/facebook-blue.png"
    366366                                                alt="Facebook logo"/>
    367367                                        </a>
     
    369369                                                title="Share this page on Twitter"
    370370                                                rel="nofollow" target="_blank">
    371                                                 <img typeof="foaf:Image" src="{$ibis.urlPrefix}/image/icon/32/twitter-blue.png"
     371                                                <img typeof="foaf:Image" src="{$ibis.urlPrefix}image/icon/32/twitter-blue.png"
    372372                                                alt="Twitter logo"/>
    373373                                        </a>
     
    375375                                                title="Share this page on Google+"
    376376                                                rel="nofollow" target="_blank">
    377                                                 <img typeof="foaf:Image" src="{$ibis.urlPrefix}/image/icon/32/google_plus-red.png"
     377                                                <img typeof="foaf:Image" src="{$ibis.urlPrefix}image/icon/32/google_plus-red.png"
    378378                                                alt="Google+ logo"/>
    379379                                        </a>
     
    381381                                                title="Share this page on LinkedIn"
    382382                                                rel="nofollow" target="_blank">
    383                                                 <img typeof="foaf:Image" src="{$ibis.urlPrefix}/image/icon/32/linkedin-blue.png"
     383                                                <img typeof="foaf:Image" src="{$ibis.urlPrefix}image/icon/32/linkedin-blue.png"
    384384                                                alt="LinkedIn logo"/>
    385385                                        </a>
  • trunk/ibisph-view/src/main/webapp/xslt/html/community/highlight/SiteSpecific.xslt

    r9074 r12319  
    2525        <xsl:param name="SiteSpecific.navigationPathSelections">
    2626                <SELECTION>
    27                         <TITLE>Related Links</TITLE>
    28                         <SELECTIONS>
    29                                 <SELECTION>
    30                                         <TITLE>community</TITLE>
    31                                         <LOCAL_URL>community</LOCAL_URL>
    32                                 </SELECTION>
    33                                 <SELECTION>
    34                                         <TITLE>comparison</TITLE>
    35                                         <URL>#</URL>
    36                                 </SELECTION>
    37                                 <SELECTION>
    38                                         <TITLE>selection</TITLE>
    39                                         <LOCAL_URL>community/highlight/Selection.html</LOCAL_URL>
    40                                 </SELECTION>
    41                         </SELECTIONS>
     27                        <TITLE>community</TITLE>
     28                        <LOCAL_URL>community</LOCAL_URL>
     29                </SELECTION>
     30                <SELECTION>
     31                        <TITLE>comparison</TITLE>
     32                        <URL>#</URL>
     33                </SELECTION>
     34                <SELECTION>
     35                        <TITLE>selection</TITLE>
     36                        <LOCAL_URL>community/highlight/Selection.html</LOCAL_URL>
    4237                </SELECTION>
    4338        </xsl:param>
  • trunk/ibisph-view/src/main/webapp/xslt/html/community/highlight/index/Page.xslt

    r9908 r12319  
    133133                <xsl:param name="communityValue"/>
    134134
     135<!-- xsl:message select="$Page.indicatorProfileSetIndicatorNames"/ -->
    135136                <xsl:call-template name="ContentContainer.contentBlock">
    136137                        <xsl:with-param name="title" select="$title"/>
     
    138139                                <ul>
    139140                                        <xsl:for-each select="$Page.communityProfile/INDICATOR_PROFILES/INDICATOR_PROFILE[HEADING_GROUP = $headingGroup]">
    140                                                 <xsl:variable name="indicatorViewName" select="current()[INDICATOR_NAME = $Page.indicatorProfileSet/INDICATOR_NAMES/INDICATOR_NAME]/INDICATOR_VIEW_NAME"/>
     141                                                <xsl:variable name="indicatorViewName" select="current()[INDICATOR_NAME = $Page.indicatorProfileSetIndicatorNames/INDICATOR_NAME]/INDICATOR_VIEW_NAME"/>
    141142                                                <xsl:if test="string-length($indicatorViewName) != 0">
    142143                                                        <xsl:variable name="indicatorView" select="document(concat($Page.indicatorProfileXMLFilePath, '/', $indicatorViewName, '.xml'))/INDICATOR_VIEW"/>
  • trunk/ibisph-view/src/main/webapp/xslt/html/indicator/index/alphabetical/Page.xslt

    r9075 r12319  
    5757                                <th scope="col" width="100" title="This is the date these data were certified current and valid.">Published Date</th>
    5858                        </tr></thead>
     59<!-- using the grid's row count
    5960                        <tfoot><tr><td colspan="2">
    6061                                <div class="RecordCount">Record Count: <xsl:value-of select="count(/INDICATORS/INDICATOR)"/></div>
    6162                        </td></tr></tfoot>
    62 
     63-->
    6364                        <!-- loop for all published indicators -->
    6465                        <tbody>
     
    8081                <br/>
    8182                <xsl:call-template name="alphaJumpToLine"/>
     83
     84                <script>
     85$("table.Info").kendoGrid({
     86    sortable: true
     87    ,filterable: true
     88        ,reorderable: true
     89        ,resizable: true
     90        ,selectable: "multiple, row"
     91        ,sortable: {mode: "multiple"}
     92        ,scrollable: false
     93//      ,pageable: false
     94        ,pageable:
     95        {
     96        numeric: false
     97        ,previousNext: false
     98        ,messages: { display: "Total Records: {2}"}
     99        }
     100});
     101                </script>
    82102        </xsl:template>
    83103
  • trunk/ibisph-view/src/main/webapp/xslt/html/query/definition/detail/Page.xslt

    r10451 r12319  
    374374                                        title="Share this page on Facebook"
    375375                                        rel="nofollow" target="_blank">
    376                                         <img src="{$ibis.urlPrefix}/image/icon/32/facebook-blue.png" alt="Facebook logo"/>
     376                                        <img src="{$ibis.urlPrefix}image/icon/32/facebook-blue.png" alt="Facebook logo"/>
    377377                                </a>
    378378                                <a href="javascript:window.open('http://twitter.com/share?url={$url}')"
    379379                                        title="Share this page on Twitter"
    380380                                        rel="nofollow" target="_blank">
    381                                         <img src="{$ibis.urlPrefix}/image/icon/32/twitter-blue.png" alt="Twitter logo"/>
     381                                        <img src="{$ibis.urlPrefix}image/icon/32/twitter-blue.png" alt="Twitter logo"/>
    382382                                </a>
    383383                                <a href="javascript:window.open('https://plus.google.com/share?url={$url}')"
    384384                                        title="Share this page on Google+"
    385385                                        rel="nofollow" target="_blank">
    386                                         <img src="{$ibis.urlPrefix}/image/icon/32/google_plus-red.png" alt="Google+ logo"/>
     386                                        <img src="{$ibis.urlPrefix}image/icon/32/google_plus-red.png" alt="Google+ logo"/>
    387387                                </a>
    388388                                <a href="javascript:window.open('http://www.linkedin.com/shareArticle?url={$url}'')"
    389389                                        title="Share this page on LinkedIn"
    390390                                        rel="nofollow" target="_blank">
    391                                         <img src="{$ibis.urlPrefix}/image/icon/32/linkedin-blue.png" alt="LinkedIn logo"/>
     391                                        <img src="{$ibis.urlPrefix}image/icon/32/linkedin-blue.png" alt="LinkedIn logo"/>
    392392                                </a>
    393393                        </td>
  • trunk/ibisph-view/src/main/webapp/xslt/html/user/access/Page.xslt

    r9126 r12319  
    158158                                        <td>
    159159                                                <xsl:call-template name="Help.popup">
     160                                                        <xsl:with-param name="additionalClasses" select="'Right'"/>
    160161                                                        <xsl:with-param name="title" select="'Captcha'"/>
    161162                                                        <xsl:with-param name="content">
  • trunk/ibisph-view/src/main/webapp/xslt/html/user/login/Page.xslt

    r8637 r12319  
    175175                                                <td>
    176176                                                        <xsl:call-template name="Help.popup">
     177                                                                <xsl:with-param name="additionalClasses" select="'Right'"/>
    177178                                                                <xsl:with-param name="title" select="'User ID/Email Address'"/>
    178179                                                                <xsl:with-param name="content">
     
    202203                                                <td>
    203204                                                        <xsl:call-template name="Help.popup">
     205                                                                <xsl:with-param name="additionalClasses" select="'Right'"/>
    204206                                                                <xsl:with-param name="title" select="'Password Security Note'"/>
    205207                                                                <xsl:with-param name="content">
     
    216218                                                        <button type="submit" accesskey="L">Login</button>
    217219                                                        <xsl:call-template name="Help.popup">
     220                                                                <xsl:with-param name="additionalClasses" select="'Right'"/>
    218221                                                                <xsl:with-param name="title" select="'Already Logged In'"/>
    219222                                                                <xsl:with-param name="content">
  • trunk/ibisph-view/src/main/webapp/xslt/html/user/registration/Page.xslt

    r11122 r12319  
    220220                                        <td>
    221221                                                <xsl:call-template name="Help.popup">
     222                                                        <xsl:with-param name="additionalClasses" select="'Right'"/>
    222223                                                        <xsl:with-param name="title" select="'Captcha'"/>
    223224                                                        <xsl:with-param name="content">
  • trunk/ibisph-view/src/main/webapp/xslt/ibis.xslt

    r8818 r12319  
    3636                contains the definition.
    3737        -->
     38        <xsl:param name="ibis.adopterTitle" select="'State'"
     39                ibis:doc="Value to be used when the XSLT code needs a title usage example
     40                        is CP reports that compare community, state, and US.  This should be
     41                        overridden in the main ss.xslt with values like 'Utah', 'New Mexico' etc.
     42                "
     43        />
    3844
    3945        <!-- RESOURCE ADDRESSING: The "WebAppURLContextPrefix" parameter is used to
     
    8591                <xsl:variable name="webappURLContextPrefix" select="org.ibisph:SystemProperties.getProperty('WebAppURLContextPrefix')" xmlns:org.ibisph="org.ibisph"/>
    8692        -->
    87         <xsl:param name="ibis.adopterTitle" select="'State'"
    88                 ibis:doc="Value to be used when the XSLT code needs a title usage example
    89                         is CP reports that compare community, state, and US.  This should be
    90                         overridden in the main ss.xslt with values like 'Utah', 'New Mexico' etc.
    91                 "
    92         />
    93 
    9493        <xsl:param name="WebAppContextURLPrefix"
    9594                ibis:doc="Prefix used/needed for referencing resources within the site."
  • trunk/ibisph/src/main/java/org/ibisph/indicatorprofile/databean/DatasetRecord.java

    r11972 r12319  
    2828    addField("LABEL",                  Field.TYPE_STRING);
    2929    addField("NOTE",                   Field.TYPE_STRING);
     30
     31    addField("LONGITUDE",              Field.TYPE_BIGDECIMAL);
     32    addField("LATITUDE",               Field.TYPE_BIGDECIMAL);
     33
     34// this is not used/needed as the dataset is defined by active dimension values...
    3035    addField("ACTIVE_FLAG",            Field.TYPE_STRING);
    3136
     
    6671  }
    6772
     73  public String getDimension1Title() {
     74    return( getStringFieldValue("DIMENSION_1_TITLE") );
     75  }
    6876  public String getDimension1ValueTitle() {
    6977    return( getStringFieldValue("DIMENSION_1_VALUE_TITLE") );
     78  }
     79  public String getDimension2Title() {
     80    return( getStringFieldValue("DIMENSION_2_TITLE") );
    7081  }
    7182  public String getDimension2ValueTitle() {
    7283    return( getStringFieldValue("DIMENSION_2_VALUE_TITLE") );
    7384  }
     85  public String getPeriodDimensionTitle() {
     86    return( getStringFieldValue("PERIOD_DIMENSION_TITLE") );
     87  }
    7488  public String getPeriodDimensionValueTitle() {
    7589    return( getStringFieldValue("PERIOD_DIMENSION_VALUE_TITLE") );
    76   }
    77   public String getDimension1Title() {
    78     return( getStringFieldValue("DIMENSION_1_TITLE") );
    79   }
    80   public String getDimension2Title() {
    81     return( getStringFieldValue("DIMENSION_2_TITLE") );
    82   }
    83   public String getPeriodDimensionTitle() {
    84     return( getStringFieldValue("PERIOD_DIMENSION_TITLE") );
    8590  }
    8691
     
    100105    return( getStringFieldValue("DENOMINATOR") );
    101106  }
     107
     108  public String getLongitude() {
     109    return( getStringFieldValue("LONGITUDE") );
     110  }
     111  public String getLatitude() {
     112    return( getStringFieldValue("LATITUDE") );
     113  }
     114
    102115  public String getLabel() {
    103116    return( getStringFieldValue("LABEL") );
  • trunk/ibisph/src/main/java/org/ibisph/indicatorprofile/springmvc/databean/EditDatasetDimensionsController.java

    r11972 r12319  
    7575    dimensionToDataset.setFieldValue("DATASET_NAME", dataset.getName());
    7676    this.dataBeanDAOService.load(dimensionToDatasetCollection, dimensionToDataset);
    77     HashMap<String,DimensionToDataset> dimensionMap = new HashMap<String,DimensionToDataset>();
     77    HashMap<String,DimensionToDataset> dimensionToDatasetMap = new HashMap<String,DimensionToDataset>();
    7878    for(DataBean db : dimensionToDatasetCollection) {
    7979      dimensionToDataset = (DimensionToDataset)db;
    8080      if(dimensionToDataset.isPeriod()) periodDimensionName = dimensionToDataset.getDimensionName();
    81       dimensionMap.put(dimensionToDataset.getDimensionName(), dimensionToDataset);
     81      dimensionToDatasetMap.put(dimensionToDataset.getDimensionName(), dimensionToDataset);
    8282    }
    83     modelMap.put(this.datasetDimensionMapModelName, dimensionMap);   
     83    modelMap.put(this.datasetDimensionMapModelName, dimensionToDatasetMap);   
    8484    modelMap.put(this.periodDimensionNameModelName, periodDimensionName);
    8585
  • trunk/ibisph/src/main/java/org/ibisph/indicatorprofile/springmvc/databean/EditDatasetRecordsController.java

    r11972 r12319  
    3333  protected String nameValueDelimiter = "|";
    3434
    35   protected String periodDimensionValueParameterName = "periodDimensionValue";
    36   protected String dimension1NameValueParameterName  = "dimension1NameValue";
    37   protected String dimension2NameValueParameterName  = "dimension2NameValue";
    38 
     35  protected String selectedDimension1NameParameterName = "selctedDimension1Name";
     36  protected String selectedDimension2NameParameterName = "selctedDimension2Name";
     37  protected String selectedPeriodDimensionValueParameterName = "selectedPeriodDimensionValue";
     38
     39  protected String dimension1ModeName = "dimension1";
     40  protected String dimension2ModeName = "dimension2";
     41  protected String periodDimensionModelName      = "periodDimension";
    3942  protected String periodDimensionValueModelName = "periodDimensionValue";
    40   protected String dimension1NameValueModelName  = "dimension1NameValue";
    41   protected String dimension2NameValueMode2Name  = "dimension2NameValue";
    42 
     43
     44  protected String dimension1CollectionModelName = "dimension1s";
     45  protected String dimension2CollectionModelName = "dimension2s";
    4346  protected String periodDimensionValueCollectionModelName = "periodDimensionValues";
    44   protected String dimension1ValueCollectionModelName      = "dimension1Values";
    45   protected String dimension2ValueCollectionModelName      = "dimension2Values";
    46   protected String datasetRecordCollectionModelName        = "datasetRecords";
    47  
    48   protected String showPeriodSelectionsModelName      = "showPeriodSelections";
     47
     48
     49 
     50  protected String datasetRecordCollectionModelName = "datasetRecords";
     51 
     52  protected String showPeriodSelectionsModelName    = "showPeriodSelections";
    4953
    5054  /**
     
    8387  /**
    8488   * Sets the requested/selected http request period dimension value.
    85    * @param periodDimensionValueParameterName
    86    */
    87   public void setPeriodDimensionValueParameterName(String periodDimensionValueParameterName) {
    88     this.periodDimensionValueParameterName = periodDimensionValueParameterName;
    89   } //-------------------------- End of Method ------------------------------
    90 
    91 
    92   /**
    93     - get/set the selected dim2 set name|value http request param value
    94     - get/set the selected period dim value http request param value
    95 
    96     1. build the list of dim 1 set name|value and title.
    97     2. build the list of dim 2 set name|value and title.
    98     3. build the list of period dim values & titles
    99     4. get the assoc records based on selected period and dim2
    100     5. Loop through the records and build the approp dim 1 titles.
     89   * @param selectedPeriodDimensionValueParameterName
     90   */
     91  public void setSelectedPeriodDimensionValueParameterName(String selectedPeriodDimensionValueParameterName) {
     92    this.selectedPeriodDimensionValueParameterName = selectedPeriodDimensionValueParameterName;
     93  } //-------------------------- End of Method ------------------------------
     94
     95
     96  /**
     97   * Handler that:
     98   * - get the dataset from super.
     99   * - get the dataset's dimensions from super.
     100   *
     101   * - get the selected dim1 name load and set the selected dim1
     102   * - get the selected dim2 name load and set the selected dim2
     103   * - get the selected period dim value, set the value / all values
     104   *
     105   * - build the list of group 1 dims.
     106   * - build the list of group 2 dims.
     107   * - load the period dim.
     108   * - build the list of period dim values
     109   * - get the assoc records based on selected period value(s), dim1 and dim2
     110   * - Loop through the records and build the assoc period, dim 1 & 2 titles.
    101111   *
    102112   * @param request HTTP Servlet Request passed from the requestHandler.
     
    112122    if((null == dataset) || !StrLib.isSomething(dataset.getName())) return(modelMap);
    113123
    114     // Get all the current dataset records and put into the model map.
    115     Collection<DataBean> datasetRecordCollection = getDatasetRecordCollection(request, dataset);
    116     modelMap.put(this.datasetRecordCollectionModelName, datasetRecordCollection);
    117 
    118124    // Get super's dataset dimensions (DimensionToDataset by dimension name)
    119125    // and the collection of all associated dataset dimensions.  The all
    120126    // dimensions collection is used to get the dimension object via loop so
    121127    // that the dimension does not have to be requeried. 
    122     Map<String,DimensionToDataset> dimensionMap = (Map<String,DimensionToDataset>)modelMap.get(this.datasetDimensionMapModelName);   
    123     ArrayList<DataBean> dimensionCollection     = (ArrayList<DataBean>)modelMap.get(this.dimensionCollectionModelName);
     128    Map<String,DimensionToDataset> dimensionToDatasetMap = (Map<String,DimensionToDataset>)modelMap.get(this.datasetDimensionMapModelName);   
     129    ArrayList<DataBean> dimensionCollection = (ArrayList<DataBean>)modelMap.get(this.dimensionCollectionModelName);
     130
     131    // gets the selected dim name request param, grabs the selected dim and
     132    // puts into the model, loops the dataset dims and creates a dim collection
     133    // and puts into the model for the drop down selections.
     134    String dimension1Name = processDimension(
     135      request,
     136      dimensionToDatasetMap,
     137      dimensionCollection,
     138      DimensionToDataset.DIMENSION_1_USAGE,
     139      this.selectedDimension1NameParameterName,
     140      this.dimension1ModeName,
     141      this.dimension1CollectionModelName,
     142      modelMap
     143    );
     144    String dimension2Name = processDimension(
     145        request,
     146        dimensionToDatasetMap,
     147        dimensionCollection,
     148        DimensionToDataset.DIMENSION_2_USAGE,
     149        this.selectedDimension2NameParameterName,
     150        this.dimension2ModeName,
     151        this.dimension2CollectionModelName,
     152        modelMap
     153      );
     154
     155    // next get the period dimension values
     156    String periodDimensionName = (String)modelMap.get(this.periodDimensionNameModelName);
     157    Dimension periodDimension  = getDimension(dimensionCollection, periodDimensionName);
     158    Collection<DataBean> periodDimensionValueCollection = new ArrayList<DataBean>();
     159    DimensionValue periodDimensionValue = new DimensionValue();
     160    periodDimensionValue.setFieldValue("DIMENSION_NAME", periodDimensionName);
     161    periodDimensionValue.setFieldValue("ACTIVE_FLAG", this.dataBeanFlagValue);
     162    ArrayList<DataBean> dimensionValueCollection = new ArrayList<DataBean>();
     163    this.dataBeanDAOService.load(periodDimensionValueCollection, periodDimensionValue);
     164    modelMap.put(this.periodDimensionValueCollectionModelName, periodDimensionValueCollection);
     165
     166    // Get all the current dataset records and put into the model map. 
     167    // NOTE: because the UI needs the dim titles and all dim values need to
     168    // loop and dynically build the collection.
     169    Collection<DataBean> datasetRecordCollection = getDatasetRecordCollection(request, dataset);
    124170
    125171    // create a map of dimension name: dimension value collection.  Loop through
    126172    // the selected dimensions and build the dim value collection and add.
    127     Collection<DimensionValue> periodDimensionValueCollection = new ArrayList<DimensionValue>();
    128173    Collection<DimensionValue> dimension1ValueCollection = new ArrayList<DimensionValue>();
    129174    Collection<DimensionValue> dimension2ValueCollection = new ArrayList<DimensionValue>();
    130     for(Map.Entry<String, DimensionToDataset> entry : dimensionMap.entrySet()) {
     175    for(Map.Entry<String, DimensionToDataset> entry : dimensionToDatasetMap.entrySet()) {
    131176      DimensionToDataset dimensionToDataset = (DimensionToDataset)entry.getValue();
    132177      Dimension dimension = getDimension(dimensionCollection, dimensionToDataset.getDimensionName());
     
    136181      dimensionValue.setFieldValue("DIMENSION_NAME", dimensionToDataset.getDimensionName());
    137182      dimensionValue.setFieldValue("ACTIVE_FLAG", this.dataBeanFlagValue);
    138       ArrayList<DataBean> dimensionValueCollection = new ArrayList<DataBean>();
     183 //     ArrayList<DataBean> dimensionValueCollection = new ArrayList<DataBean>();
    139184      this.dataBeanDAOService.load(dimensionValueCollection, dimensionValue);
    140185
     
    156201      }
    157202    }
    158     modelMap.put(this.periodDimensionValueCollectionModelName, periodDimensionValueCollection);
    159     modelMap.put(this.dimension1ValueCollectionModelName, dimension1ValueCollection);
    160     modelMap.put(this.dimension2ValueCollectionModelName, dimension2ValueCollection);
     203//    modelMap.put(this.dimension1ValueCollectionModelName, dimension1ValueCollection);
     204//    modelMap.put(this.dimension2ValueCollectionModelName, dimension2ValueCollection);
     205
     206    modelMap.put(this.datasetRecordCollectionModelName, datasetRecordCollection);
    161207
    162208    // get the assoc measure (ui uses the title) and put into the model.
     
    170216
    171217
     218  /**
     219   * Localizes getting the selected dim name request param, grabs the selected
     220   * dim and puts into the model, loops the dataset dims and creates a dim
     221   * collection and puts into the model for the drop down selections.
     222   *
     223   * @param request
     224   * @param dimensionMap
     225   * @param dimensionCollection
     226   * @param selectedDimensionNameParameterName
     227   * @param dimensionModeName
     228   * @param dimensionCollectionModelName
     229   * @param modelMap
     230   */
     231  protected String processDimension(
     232    HttpServletRequest request,
     233    Map<String,DimensionToDataset> dimensionToDatasetMap,
     234    ArrayList<DataBean> completeDimensionCollection,
     235    String selectedDimensionNameParameterName,
     236    String dimensionUsage,
     237    String dimensionModeName,
     238    String dimensionCollectionModelName,
     239    Map<String, Object> modelMap
     240  ) {
     241    String selectedDimensionName = request.getParameter(selectedDimensionNameParameterName);
     242
     243    // Build the associated dimension collection and add to the modelmap.
     244    Dimension selectedDimension = null;
     245    Collection<DimensionToDataset> dimensionToDatasetCollection = (Collection<DimensionToDataset>)dimensionToDatasetMap.values();
     246    ArrayList<Dimension> dimensionCollection = new ArrayList<Dimension>();
     247    for(DimensionToDataset dimensionToDataset : dimensionToDatasetCollection) {
     248      if(dimensionToDataset.getDimensionUsage().equals(dimensionUsage)) {
     249        Dimension dimension = getDimension(completeDimensionCollection, dimensionToDataset.getDimensionName());
     250        dimensionCollection.add(dimension);
     251        if(dimension.getName().equals(selectedDimensionName)) selectedDimension = dimension;
     252      }
     253    }
     254    if(null == selectedDimension) selectedDimension = dimensionCollection.get(0);
     255    modelMap.put(dimensionModeName, selectedDimension);
     256    modelMap.put(dimensionCollectionModelName, dimensionCollection);
     257
     258    return(selectedDimensionName);
     259  } //-------------------------- End of Method ------------------------------
     260 
     261 
     262 
     263 
     264 
     265 
     266 
     267 
     268 
     269 
     270 
     271 
    172272  /**
    173273   * Helper to delete from the collection/list any dim value not selected.
     
    242342  ) throws Exception {
    243343    Collection<DataBean> datasetRecordCollection = new ArrayList<DataBean>();
     344/*
    244345    DatasetRecord datasetRecord = new DatasetRecord();
    245346    datasetRecord.setFieldValue("DATASET_NAME", dataset.getName());
    246347    this.dataBeanDAOService.load(datasetRecordCollection, datasetRecord);
    247348
    248 /*
     349
    249350
    250351    String periodDimensionName  = (String)modelMap.get(this.periodDimensionNameModelName);
     
    325426      allPossibleDatasetRecordCollection.add(datasetRecord);
    326427    }
    327 */   
     428  */ 
    328429    return((Collection<DataBean>)datasetRecordCollection);
    329430  } //-------------------------- End of Method ------------------------------
  • trunk/ibisph/src/main/java/org/ibisph/web/springmvc/SimpleClientRedirectionView.java

    r9600 r12319  
    22
    33import java.util.Map;
     4import java.net.URL;
    45
    56import javax.servlet.http.HttpServletRequest;
     
    78
    89import org.ibisph.util.IOPath;
     10import org.ibisph.util.StrLib;
    911
    1012/**
     
    6769    HttpServletResponse response
    6870  ) throws Exception {
    69     java.net.URL url = (java.net.URL)modelMap.get(this.urlModelMapKey);
    70     if(url != null)
    71       response.sendRedirect(url.toExternalForm());
    72     else {
    73       if(this.prependWebappContextToRedirectionAddress)
    74         response.sendRedirect( IOPath.concat(request.getContextPath(), this.redirectionAddress, "/") );
    75       else
    76         response.sendRedirect(this.redirectionAddress);
     71    String redirectionRequestAddress = this.redirectionAddress;
     72
     73    if((null != modelMap) && StrLib.isSomething(this.urlModelMapKey)) {
     74      Object url = modelMap.get(this.urlModelMapKey);
     75      if(null != url) {
     76        if(url instanceof URL) {
     77          response.sendRedirect( ((URL)url).toExternalForm() );
     78          return;
     79        }
     80        else if(url instanceof String)
     81          redirectionRequestAddress = (String)url;
     82      }
    7783    }
     84       
     85    if(this.prependWebappContextToRedirectionAddress)
     86      response.sendRedirect( IOPath.concat(request.getContextPath(), redirectionRequestAddress, "/") );
     87    else
     88      response.sendRedirect(redirectionRequestAddress);
    7889  } //-------------------------- End of Method ------------------------------
    7990
Note: See TracChangeset for help on using the changeset viewer.