Changeset 12462 in main


Ignore:
Timestamp:
12/06/16 15:39:21 (6 years ago)
Author:
Garth Braithwaite
Message:

ibis view & admin - Fixed SHOW flag XSLT for SELECTIONS struct. Updated GetFileController? to use standard pathPrefixToRemove. Temp admin commit before db script restructuring.

Location:
trunk
Files:
3 added
14 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/db/src/main/scripts/mysql/data_i-dataset.sql

    r11972 r12462  
    11use ibisph;
    22
    3 /* insert the rest of the DSC and DSS records and values into DIM. 
    4         NOTE: label to title and title to description.  Lois wants to use the desc
    5         for selecting.
    6 */
     3delete from DATASET
     4/* insert the non state/us datasets based on the views  */
    75insert into DATASET (NAME, INDICATOR_NAME, TITLE, DESCRIPTION, NUMERATOR, DENOMINATOR, DATA_NOTE, DATA_SOURCE_DATE, MEASURE_NAME, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE)
    8 select iv.NAME, iv.INDICATOR_NAME, iv.TITLE, iv.DESCRIPTION,
     6select iv.NAME, iv.INDICATOR_NAME, substr(iv.TITLE, 1, 100), iv.Y_TITLE,
    97        i.NUMERATOR, i.DENOMINATOR,
    108        i.DATA_NOTE, i.DATA_SOURCE_DATE,
    119        iv.MEASURE_NAME, iv.SORT_ORDER, iv.ACTIVE_FLAG, iv.MODIFIED_DATE
    1210from INDICATOR i, INDICATOR_VIEW iv
    13 where i.NAME = iv.INDICATOR_NAME;
     11where i.NAME = iv.INDICATOR_NAME
     12  and iv.NAME not like "%NM_US%"
     13;
     14
     15/* insert the split state datasets based on the state/us view */
     16insert into DATASET (NAME, INDICATOR_NAME, TITLE, DESCRIPTION, NUMERATOR, DENOMINATOR, DATA_NOTE, DATA_SOURCE_DATE, MEASURE_NAME, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE)
     17select replace(iv.NAME, "NM_US", "NM"), iv.INDICATOR_NAME, replace(substr(iv.TITLE,1,100), " and U.S.", ""), iv.DESCRIPTION,
     18        i.NUMERATOR, i.DENOMINATOR,
     19        i.DATA_NOTE, i.DATA_SOURCE_DATE,
     20        iv.MEASURE_NAME, iv.SORT_ORDER, iv.ACTIVE_FLAG, iv.MODIFIED_DATE
     21from INDICATOR i, INDICATOR_VIEW iv
     22where i.NAME = iv.INDICATOR_NAME
     23  and iv.NAME like "%NM_US%"
     24;
     25
     26/* insert the split us datasets based on the state/us view */
     27insert into DATASET (NAME, INDICATOR_NAME, TITLE, DESCRIPTION, NUMERATOR, DENOMINATOR, DATA_NOTE, DATA_SOURCE_DATE, MEASURE_NAME, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE)
     28select replace(iv.NAME, "NM_US", "US"), iv.INDICATOR_NAME, replace(substr(iv.TITLE,1,100), "New Mexico and ", ""), iv.DESCRIPTION,
     29        i.NUMERATOR, i.DENOMINATOR,
     30        i.DATA_NOTE, i.DATA_SOURCE_DATE,
     31        iv.MEASURE_NAME, iv.SORT_ORDER, iv.ACTIVE_FLAG, iv.MODIFIED_DATE
     32from INDICATOR i, INDICATOR_VIEW iv
     33where i.NAME = iv.INDICATOR_NAME
     34  and iv.NAME like "%NM_US%"
     35;
     36
     37
    1438
    1539
     
    5983update INDICATOR_VIEW_VALUE set VALUE = null where VALUE = '';
    6084
     85
     86
     87/* Create the dataset value records - IVV records
     88        Note that each DR MUST have a PERIOD, DIM1 and DIM2.  The view can specify
     89        which dims to use for cat and series but the record must have all 3.
     90        Steps:
     91        1.
     92*/
    6193
    6294insert into DATASET_RECORD (NAME, DATASET_NAME,
     
    176208
    177209
    178 /* create the dataset DIMENSION records
     210/* create the dataset DIMENSION records based on the dataset's records.  Prior
     211        to 10/5/16 these records were based on the view.
    179212        delete from DIMENSION_TO_DATASET;
    180213*/
    181214insert into DIMENSION_TO_DATASET(DATASET_NAME, DIMENSION_NAME, DIMENSION_USAGE)
    182 select NAME, PERIOD_DIMENSION_NAME, 'period' from INDICATOR_VIEW where ACTIVE_FLAG='x' group by NAME;
     215select DATASET_NAME, PERIOD_DIMENSION_NAME, 'period' from DATASET_RECORD group by DATASET_NAME, PERIOD_DIMENSION_NAME;
    183216
    184217insert into DIMENSION_TO_DATASET(DATASET_NAME, DIMENSION_NAME, DIMENSION_USAGE)
    185 select NAME, SERIES_DIMENSION_NAME, 'dimension_1' from INDICATOR_VIEW where ACTIVE_FLAG='x' group by NAME;
     218select DATASET_NAME, DIMENSION_1_NAME, 'dimension1' from DATASET_RECORD group by DATASET_NAME, DIMENSION_1_NAME;
    186219
    187220insert into DIMENSION_TO_DATASET(DATASET_NAME, DIMENSION_NAME, DIMENSION_USAGE)
    188 select NAME, CATEGORY_DIMENSION_NAME, 'dimension_2' from INDICATOR_VIEW where ACTIVE_FLAG='x' group by NAME;
     221select DATASET_NAME, DIMENSION_2_NAME, 'dimension2' from DATASET_RECORD group by DATASET_NAME, DIMENSION_2_NAME;
    189222
    190223
  • trunk/db/src/main/scripts/mysql/data_i-dimension.sql

    r12461 r12462  
    11use ibisph;
    2 
    32
    43/* insert the rest of the DSC and DSS records and values into DIM. 
     
    2221
    2322
    24 /* update the period related sort orders based on what the adopter had set */
     23/* update the sort orders based on what the adopter had set */
    2524update DIMENSION d set SORT_ORDER =
    2625  (select dss.SORT_ORDER
     
    7675delete from DIMENSION where NAME = 'None';
    7776
     77
     78
     79/* Need to split out State VS US ???????? */
     80
    7881/*------------------------------ END OF FILE ------------------------------*/
    7982
  • trunk/db/src/main/scripts/mysql/data_i-dimension_period.sql

    r12461 r12462  
    1414delete from DIMENSION_VALUE;
    1515delete from DIMENSION;
    16 
    17 
    18 insert into DIMENSION (NAME, PROXY_DIMENSION_NAME, TITLE, DESCRIPTION, PERIOD_FLAG, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE) values('YearNone',       null, 'No Period','No period','x', 50, 'x', now());
    1916
    2017insert into DIMENSION (NAME, PROXY_DIMENSION_NAME, TITLE, DESCRIPTION, PERIOD_FLAG, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE) values('YearAll',         'YearProxy','Years','All years','x', 51, 'x', now());
     
    4037insert into DIMENSION (NAME, PROXY_DIMENSION_NAME, TITLE, DESCRIPTION, PERIOD_FLAG, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE) values('YearGroupProxy', null, 'Composite Years','Proxy label for all composite type year period dimensions', 'x', 71, null, now());
    4138
    42 insert into DIMENSION_VALUE (DIMENSION_NAME, VALUE, TITLE, DESCRIPTION, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE) values ('YearNone', '', '', 'No specific year.', 0, 'x', now());
    43 
     39insert into DIMENSION_VALUE (DIMENSION_NAME, VALUE, TITLE, DESCRIPTION, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE)values('YearAll','all', 'All', 'No specific year.', 0, 'x', now());
    4440insert into DIMENSION_VALUE (DIMENSION_NAME, VALUE, TITLE, DESCRIPTION, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE)values('YearAll','1980','1980', 'Year: 1980', 1980, 'x', now());
    4541insert into DIMENSION_VALUE (DIMENSION_NAME, VALUE, TITLE, DESCRIPTION, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE)values('YearAll','1981','1981', 'Year: 1981', 1981, 'x', now());
  • trunk/db/src/main/scripts/mysql/data_i-measure.sql

    r11716 r12462  
    4747insert into MEASURE (NAME,TITLE,DESCRIPTION,VALUE_TYPE_NAME,DESIRABLE_VALUE,SORT_ORDER,ACTIVE_FLAG,MODIFIED_DATE) values ( 'RatePer10K', 'Rate Per 10,000 Population', 'Rate Per 10,000 Population', 'RatePer10K', null, 40, 'x', now());
    4848insert into MEASURE (NAME,TITLE,DESCRIPTION,VALUE_TYPE_NAME,DESIRABLE_VALUE,SORT_ORDER,ACTIVE_FLAG,MODIFIED_DATE) values ( 'RatePer1K', 'Rate Per 1,000 Population', 'Rate Per 1,000 Population', 'RatePer1K',     null, 41, 'x', now());
    49 insert into MEASURE (NAME,TITLE,DESCRIPTION,VALUE_TYPE_NAME,DESIRABLE_VALUE,SORT_ORDER,ACTIVE_FLAG,MODIFIED_DATE) values ( 'Ratio', 'Ratio  ', 'Ratio  ', 'Ratio',     null, 42, 'x', now());
    50 insert into MEASURE (NAME,TITLE,DESCRIPTION,VALUE_TYPE_NAME,DESIRABLE_VALUE,SORT_ORDER,ACTIVE_FLAG,MODIFIED_DATE) values ( 'Minutes', 'Minutes', 'Minutes', 'Minutes', null, 43, 'x', now());
    51 insert into MEASURE (NAME,TITLE,DESCRIPTION,VALUE_TYPE_NAME,DESIRABLE_VALUE,SORT_ORDER,ACTIVE_FLAG,MODIFIED_DATE) values ( 'WaterSystemCount', 'Number of Community Water Systems', 'Number of Community Water Systems', 'Count', 1, 44, 'x', now());
     49insert into MEASURE (NAME,TITLE,DESCRIPTION,VALUE_TYPE_NAME,DESIRABLE_VALUE,SORT_ORDER,ACTIVE_FLAG,MODIFIED_DATE) values ( 'Rank', 'Rank  ', 'Segmented value that represents a grouping.', 'Rank', 0, 42, 'x', now());
     50insert into MEASURE (NAME,TITLE,DESCRIPTION,VALUE_TYPE_NAME,DESIRABLE_VALUE,SORT_ORDER,ACTIVE_FLAG,MODIFIED_DATE) values ( 'Ratio', 'Ratio  ', 'Ratio  ', 'Ratio',     null, 43, 'x', now());
     51insert into MEASURE (NAME,TITLE,DESCRIPTION,VALUE_TYPE_NAME,DESIRABLE_VALUE,SORT_ORDER,ACTIVE_FLAG,MODIFIED_DATE) values ( 'Minutes', 'Minutes', 'Minutes', 'Minutes', null, 44, 'x', now());
     52insert into MEASURE (NAME,TITLE,DESCRIPTION,VALUE_TYPE_NAME,DESIRABLE_VALUE,SORT_ORDER,ACTIVE_FLAG,MODIFIED_DATE) values ( 'WaterSystemCount', 'Number of Community Water Systems', 'Number of Community Water Systems', 'Count', 1, 45, 'x', now());
    5253
    5354
  • trunk/db/src/main/scripts/mysql/data_i-value_type.sql

    r11662 r12462  
    3333insert into VALUE_TYPE (NAME, TITLE, DESCRIPTION, XSLT_FORMAT_PATTERN, JAVA_FORMAT_PATTERN, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE) values('milligramsPerLiter', 'Milligrams Per Liter (mg/L)', 'Micro grams per liter', '#,##0', '#,##0', 63, 'x', now() );
    3434
     35
     36
     37insert into ANCILLARY_VALUE (NAME, TITLE, DEFINITION, DESCRIPTION, MEASURE_NAME, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE)
     38values('StdMortRatio', 'Standarized Mortality Ratio', 'standarized mortality ratio', 'standarized mortality ratio', 'Ratio', 1, 'x', now() );
     39
     40insert into ANCILLARY_VALUE (NAME, TITLE, DEFINITION, DESCRIPTION, MEASURE_NAME, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE)
     41values('StateRank', 'State Rank', 'State Rank', 'State Rank', 'Rank', 2, 'x', now() );
     42
     43insert into ANCILLARY_VALUE (NAME, TITLE, DEFINITION, DESCRIPTION, MEASURE_NAME, SORT_ORDER, ACTIVE_FLAG, MODIFIED_DATE)
     44values('USRank', 'US Rank', 'US Rank', 'US Rank', 'Rank', 3, 'x', now() );
     45
    3546/*------------------------------ END OF FILE ------------------------------*/
    3647
  • trunk/db/src/main/scripts/mysql/data_u-iv_dss_dsc.sql

    r11972 r12462  
    11use ibisph;
     2
     3
     4/* clean up orphanded records */
     5select * from INDICATOR_VIEW where not exists (select i.NAME from INDICATOR i where i.NAME = INDICATOR_NAME);
     6delete from INDICATOR_VIEW where not exists (select i.NAME from INDICATOR i where i.NAME = INDICATOR_NAME);
     7
     8/* should never see these entries but check and cleanup before going on */
     9select NAME, DATASET_SERIES_NAME, DATASET_CATEGORY_NAME
     10from INDICATOR_VIEW
     11where DATASET_SERIES_NAME is null
     12   or DATASET_CATEGORY_NAME is null
     13;
     14
    215
    316/* populate the new DIMENSION fields with cleaned up/standardize values based
     
    4962
    5063
    51 
    5264/* years - cat then series dims */
    53 update INDICATOR_VIEW set CATEGORY_DIMENSION_NAME = 'YearAll'    where DATASET_CATEGORY_NAME in ('YearRecent', 'YearDeath', 'YearBirthCert', 'Year2005_2015', 'Year1990_2010');
     65update INDICATOR_VIEW set CATEGORY_DIMENSION_NAME = 'YearAll'    where DATASET_CATEGORY_NAME in ('YearAll', 'YearRecent', 'YearDeath', 'YearBirthCert', 'Year2005_2015', 'Year1990_2010');
    5466update INDICATOR_VIEW set CATEGORY_DIMENSION_NAME = 'YearFiscal' where DATASET_CATEGORY_NAME like 'YearAllFis%';
    5567update INDICATOR_VIEW set CATEGORY_DIMENSION_NAME = 'YearEven'   where DATASET_CATEGORY_NAME = 'YearAllEven';
     
    6678
    6779
    68 update INDICATOR_VIEW set SERIES_DIMENSION_NAME = 'YearAll'    where DATASET_SERIES_NAME in ('YearRecent', 'YearDeath', 'YearBirthCert', 'Year2005_2015', 'Year1990_2010');
     80update INDICATOR_VIEW set SERIES_DIMENSION_NAME = 'YearAll'    where DATASET_SERIES_NAME in ('YearAll', 'YearRecent', 'YearDeath', 'YearBirthCert', 'Year2005_2015', 'Year1990_2010');
    6981update INDICATOR_VIEW set SERIES_DIMENSION_NAME = 'YearFiscal' where DATASET_SERIES_NAME like 'YearAllFis%';
    7082update INDICATOR_VIEW set SERIES_DIMENSION_NAME = 'YearEven'   where DATASET_SERIES_NAME = 'YearAllEven';
     
    8193
    8294
     95
     96/* Test of which series and cats are not handled */
     97select NAME, DATASET_SERIES_NAME, DATASET_CATEGORY_NAME
     98from INDICATOR_VIEW
     99where NAME not like 'Demo%'
     100  and (CATEGORY_DIMENSION_NAME is null
     101       or SERIES_DIMENSION_NAME is null
     102          )
     103;
     104
     105
    83106/* set the rest of the IV dim names to the DSC and DSS values */
    84107update INDICATOR_VIEW set CATEGORY_DIMENSION_NAME = DATASET_CATEGORY_NAME where CATEGORY_DIMENSION_NAME is null;
    85108update INDICATOR_VIEW set SERIES_DIMENSION_NAME   = DATASET_SERIES_NAME   where SERIES_DIMENSION_NAME   is null;
    86109
    87 /* should never see these entries but... */
    88 update INDICATOR_VIEW set CATEGORY_DIMENSION_NAME = 'XXXXXX' where CATEGORY_DIMENSION_NAME is null;
    89 update INDICATOR_VIEW set SERIES_DIMENSION_NAME   = 'XXXXXX' where SERIES_DIMENSION_NAME   is null;
    90 
    91 
    92 /* set the IV period dim name and value */
    93 update INDICATOR_VIEW iv set PERIOD_DIMENSION_NAME = (select NAME from DIMENSION where NAME = iv.CATEGORY_DIMENSION_NAME and PERIOD_FLAG = 'x');
    94 update INDICATOR_VIEW iv set PERIOD_DIMENSION_NAME = (select NAME from DIMENSION where NAME = iv.SERIES_DIMENSION_NAME   and PERIOD_FLAG = 'x') where PERIOD_DIMENSION_NAME is null;
    95 update INDICATOR_VIEW set PERIOD_DIMENSION_NAME  = 'YearNone'   where PERIOD_DIMENSION_NAME is null;
    96 
    97 /*
    98 update INDICATOR_VIEW set PERIOD_DIMENSION_VALUE = PERIOD_TITLE where PERIOD_DIMENSION_VALUE is null;
    99 update INDICATOR_VIEW set PERIOD_DIMENSION_VALUE = max(DATASET_CATEGORY_VALUE)
    100 where PERIOD_DIMENSION_VALUE is null
    101   and DATASET_CATEGORY_NAME like '%Year%';
    102 */
    103 
    104 
    105 
    106 
    107 
    108 /* update the IVV dim names - update's sub select is overkill but safer - mixed data. */
    109 /* simpiler and should work...
    110 update INDICATOR_VIEW_VALUE ivv set ivv.SERIES_DIMENSION_NAME   = (select distinct iv.SERIES_DIMENSION_NAME   from INDICATOR_VIEW iv where iv.DATASET_SERIES_NAME   = ivv.DATASET_SERIES_NAME);
    111 update INDICATOR_VIEW_VALUE ivv set ivv.CATEGORY_DIMENSION_NAME = (select distinct iv.CATEGORY_DIMENSION_NAME from INDICATOR_VIEW iv where iv.DATASET_CATEGORY_NAME = ivv.DATASET_CATEGORY_NAME);
    112 */
    113 create index temp_ivv_ivn on INDICATOR_VIEW_VALUE (INDICATOR_VIEW_NAME);
    114 create index temp_ivv_ivpdn on INDICATOR_VIEW (PERIOD_DIMENSION_NAME);
    115 create index temp_ivv_ivcdn on INDICATOR_VIEW (CATEGORY_DIMENSION_NAME);
    116 create index temp_ivv_ivsdn on INDICATOR_VIEW (SERIES_DIMENSION_NAME);
    117 
    118 
    119 delete from INDICATOR_VIEW_VALUE where DATASET_CATEGORY_NAME is null  and  DATASET_SERIES_NAME is null;
    120 delete from INDICATOR_VIEW_VALUE where INDICATOR_VIEW_NAME not in (select NAME from INDICATOR_VIEW);
    121 
    122 update INDICATOR_VIEW_VALUE ivv
    123         set ivv.SERIES_DIMENSION_NAME   = (select iv.SERIES_DIMENSION_NAME   from INDICATOR_VIEW iv where iv.NAME = ivv.INDICATOR_VIEW_NAME)
    124         where ivv.SERIES_DIMENSION_NAME is null
    125 ;
    126 update INDICATOR_VIEW_VALUE ivv
    127         set ivv.CATEGORY_DIMENSION_NAME = (select distinct iv.CATEGORY_DIMENSION_NAME from INDICATOR_VIEW iv where iv.NAME = ivv.INDICATOR_VIEW_NAME)
    128         where ivv.CATEGORY_DIMENSION_NAME is null
    129 ;
    130 update INDICATOR_VIEW_VALUE ivv
    131         set ivv.PERIOD_DIMENSION_NAME   = (select iv.PERIOD_DIMENSION_NAME   from INDICATOR_VIEW iv where iv.NAME = ivv.INDICATOR_VIEW_NAME)
    132         where ivv.PERIOD_DIMENSION_NAME is null
    133 ;
    134 
    135 /* the above take forever to run but seem to actually run.  below is a test to show that all records were updated. */
    136 select count(*)
    137 from INDICATOR_VIEW_VALUE
    138 where CATEGORY_DIMENSION_NAME is null
    139    or SERIES_DIMENSION_NAME is null
    140    or PERIOD_DIMENSION_NAME is null;
    141 
    142 
    143 /* period dims are new concept so populate the name if the series or cat is a period dim.
    144 update INDICATOR_VIEW_VALUE ivv set ivv.PERIOD_DIMENSION_NAME =
    145         (select NAME
    146          from DIMENSION d
    147          where PERIOD_FLAG = 'x'
    148            and (d.NAME = ivv.CATEGORY_DIMENSION_NAME or d.NAME = ivv.SERIES_DIMENSION_NAME)
    149         )
    150         where PERIOD_DIMENSION_NAME is null;
    151 */
    152 
    153 /* for all other IVV period dims set to the default "none" - should never have this... */
    154 update INDICATOR_VIEW_VALUE ivv set ivv.PERIOD_DIMENSION_NAME = 'YearNone'
    155         where PERIOD_DIMENSION_NAME is null;
    156 update INDICATOR_VIEW_VALUE ivv set ivv.PERIOD_DIMENSION_VALUE = ''
    157         where ivv.PERIOD_DIMENSION_NAME = 'YearNone'
    158           and ivv.PERIOD_DIMENSION_VALUE is null;
    159 
    160 update INDICATOR_VIEW_VALUE ivv set ivv.PERIOD_DIMENSION_VALUE = ivv.CATEGORY_DIMENSION_VALUE
    161 where ivv.PERIOD_DIMENSION_NAME = ivv.CATEGORY_DIMENSION_NAME
    162   and PERIOD_DIMENSION_VALUE is null;
    163 update INDICATOR_VIEW_VALUE ivv set ivv.PERIOD_DIMENSION_VALUE = ivv.SERIES_DIMENSION_VALUE
    164 where ivv.PERIOD_DIMENSION_NAME = ivv.SERIES_DIMENSION_NAME
    165   and PERIOD_DIMENSION_VALUE is null;
    166 
    167 
    168 /* this should never be the case but do it just to check */
    169 select INDICATOR_VIEW_NAME, DATASET_SERIES_NAME, SERIES_DIMENSION_NAME, DATASET_CATEGORY_NAME, CATEGORY_DIMENSION_NAME
    170 from INDICATOR_VIEW_VALUE
    171 where ACTIVE_FLAG = 'x'
    172   and (CATEGORY_DIMENSION_NAME is null or SERIES_DIMENSION_NAME is null)
    173 group by INDICATOR_VIEW_NAME;
    174 
    175 select NAME, DATASET_SERIES_NAME, SERIES_DIMENSION_NAME, DATASET_CATEGORY_NAME, CATEGORY_DIMENSION_NAME from INDICATOR_VIEW where NAME in
    176         (select INDICATOR_VIEW_NAME
    177          from INDICATOR_VIEW_VALUE
    178          where ACTIVE_FLAG = 'x'
    179            and (CATEGORY_DIMENSION_NAME is null or SERIES_DIMENSION_NAME is null)
    180         )
    181 order by NAME;
    182 
    183  
    184  
    185 
    186 
    187 /* create the indicator view dimensions based on current IVV dimensions */
    188 insert into DIMENSION_TO_INDICATOR_VIEW (INDICATOR_VIEW_NAME, DIMENSION_NAME, DIMENSION_USAGE)
    189         select IVV.INDICATOR_VIEW_NAME, IVV.SERIES_DIMENSION_NAME, 'series'
    190         from INDICATOR_VIEW_VALUE IVV
    191         group by IVV.INDICATOR_VIEW_NAME, IVV.SERIES_DIMENSION_NAME;
    192 insert into DIMENSION_TO_INDICATOR_VIEW (INDICATOR_VIEW_NAME, DIMENSION_NAME, DIMENSION_USAGE)
    193         select IVV.INDICATOR_VIEW_NAME, IVV.CATEGORY_DIMENSION_NAME, 'category'
    194         from INDICATOR_VIEW_VALUE IVV
    195         group by IVV.INDICATOR_VIEW_NAME, IVV.CATEGORY_DIMENSION_NAME;
    196 
    197 insert into DIMENSION_TO_INDICATOR_VIEW (INDICATOR_VIEW_NAME, DIMENSION_NAME, DIMENSION_USAGE)
    198         select IVV.INDICATOR_VIEW_NAME, IVV.CATEGORY_DIMENSION_NAME, 'period'
    199         from INDICATOR_VIEW_VALUE IVV
    200         where not exists
    201                 (select IVD2.INDICATOR_VIEW_NAME
    202         from DIMENSION_TO_INDICATOR_VIEW IVD2
    203         where IVD2.DIMENSION_USAGE = 'period'
    204           and IVD2.DIMENSION_NAME  = IVV.CATEGORY_DIMENSION_NAME
    205           and IVD2.INDICATOR_VIEW_NAME = IVV.INDICATOR_VIEW_NAME
    206         )
    207           and IVV.CATEGORY_DIMENSION_NAME in (select NAME from DIMENSION where PERIOD_FLAG='x')
    208         union
    209         select IVV.INDICATOR_VIEW_NAME, IVV.SERIES_DIMENSION_NAME, 'period'
    210         from INDICATOR_VIEW_VALUE IVV
    211         where not exists
    212                 (select IVD2.INDICATOR_VIEW_NAME
    213         from DIMENSION_TO_INDICATOR_VIEW IVD2
    214         where IVD2.DIMENSION_USAGE = 'period'
    215           and IVD2.DIMENSION_NAME  = IVV.SERIES_DIMENSION_NAME
    216           and IVD2.INDICATOR_VIEW_NAME = IVV.INDICATOR_VIEW_NAME
    217         )
    218           and IVV.SERIES_DIMENSION_NAME in (select NAME from DIMENSION where PERIOD_FLAG='x')
    219         group by 1, 2, 3
    220 ;
    221 
    222 /* add the none period dimension for those views that don't have a period */
    223 insert into DIMENSION_TO_INDICATOR_VIEW (INDICATOR_VIEW_NAME, DIMENSION_NAME, DIMENSION_USAGE)
    224         (select IVV.INDICATOR_VIEW_NAME, 'YearNone', 'period'
    225          from INDICATOR_VIEW_VALUE IVV
    226          where IVV.PERIOD_DIMENSION_NAME = 'YearNone'
    227            and not exists
    228                 (select 1
    229                  from DIMENSION_TO_INDICATOR_VIEW IVD2
    230                  where IVD2.INDICATOR_VIEW_NAME = IVV.PERIOD_DIMENSION_NAME
    231                    and IVD2.DIMENSION_USAGE = 'period'
    232                 )
    233          group by IVV.INDICATOR_VIEW_NAME
    234         )
    235 ;
    236 
    237 /* check */
    238 select NAME, SERIES_DIMENSION_NAME, CATEGORY_DIMENSION_NAME, PERIOD_DIMENSION_NAME from INDICATOR_VIEW
    239 where ACTIVE_FLAG = 'x'
    240   and NAME not in (select distinct INDICATOR_VIEW_NAME from DIMENSION_TO_INDICATOR_VIEW)
    241 ;
    242 
    243 
    244 
    245 
    246 /* Populate the indicator view dimension values based on the IVV records */
    247 insert into DIMENSION_VALUE_TO_IND_VIEW(INDICATOR_VIEW_NAME, DIMENSION_NAME, DIMENSION_VALUE)
    248 select ivv.INDICATOR_VIEW_NAME, ivv.CATEGORY_DIMENSION_NAME, ivv.CATEGORY_DIMENSION_VALUE
    249 from INDICATOR_VIEW_VALUE ivv
    250 where not exists
    251         (select 1
    252          from DIMENSION_VALUE_TO_IND_VIEW ivdv
    253          where ivv.INDICATOR_VIEW_NAME = ivdv.INDICATOR_VIEW_NAME
    254            and ivv.CATEGORY_DIMENSION_NAME  = ivdv.DIMENSION_NAME
    255            and ivv.CATEGORY_DIMENSION_VALUE = ivdv.DIMENSION_VALUE
    256         )
    257 group by ivv.INDICATOR_VIEW_NAME, ivv.CATEGORY_DIMENSION_NAME, ivv.CATEGORY_DIMENSION_VALUE
    258 ;
    259 
    260 insert into DIMENSION_VALUE_TO_IND_VIEW(INDICATOR_VIEW_NAME, DIMENSION_NAME, DIMENSION_VALUE)
    261 select ivv.INDICATOR_VIEW_NAME, ivv.SERIES_DIMENSION_NAME, ivv.SERIES_DIMENSION_VALUE
    262 from INDICATOR_VIEW_VALUE ivv
    263 where not exists
    264         (select ivdv.INDICATOR_VIEW_NAME
    265          from DIMENSION_VALUE_TO_IND_VIEW ivdv
    266          where ivv.INDICATOR_VIEW_NAME    = ivdv.INDICATOR_VIEW_NAME
    267            and ivv.SERIES_DIMENSION_NAME  = ivdv.DIMENSION_NAME
    268            and ivv.SERIES_DIMENSION_VALUE = ivdv.DIMENSION_VALUE
    269         )
    270 group by ivv.INDICATOR_VIEW_NAME, ivv.SERIES_DIMENSION_NAME, ivv.SERIES_DIMENSION_VALUE
    271 ;
    272 
    273 /* insert a  blank period dim value record for those IPV's that didn't have a period */
    274 insert into DIMENSION_VALUE_TO_IND_VIEW(INDICATOR_VIEW_NAME, DIMENSION_NAME, DIMENSION_VALUE)
    275 select distinct(ivd.INDICATOR_VIEW_NAME), 'YearNone', ''
    276 from DIMENSION_TO_INDICATOR_VIEW ivd
    277 where not exists
    278         (select ivdv.INDICATOR_VIEW_NAME
    279          from DIMENSION_VALUE_TO_IND_VIEW ivdv
    280          where ivdv.INDICATOR_VIEW_NAME = ivd.INDICATOR_VIEW_NAME
    281            and ivdv.DIMENSION_NAME      = 'YearNone'
    282         )
    283 ;
    284 
    285 
    286 
    287 /* set the default sort order based on the dimension value sort order
    288    - ???????????????? not sure needed ????????????? */
    289 update DIMENSION_VALUE_TO_IND_VIEW IVV
    290         set IVV.SORT_ORDER =
    291     (select DV.SORT_ORDER
    292          from DIMENSION_VALUE DV
    293          where DV.DIMENSION_NAME = IVV.DIMENSION_NAME
    294            and DV.VALUE = IVV.DIMENSION_VALUE
    295         )
    296 where IVV.SORT_ORDER is null
    297 ;
    298 
    299 
    300 /* do a quick test to make sure that every view has dim values
    301 NOTE: NM has 114 views that do NOT have any dim values!!!!
    302 */
    303 select NAME, SERIES_DIMENSION_NAME, CATEGORY_DIMENSION_NAME, PERIOD_DIMENSION_NAME from INDICATOR_VIEW
    304 where ACTIVE_FLAG = 'x'
    305   and NAME not in (select distinct INDICATOR_VIEW_NAME from DIMENSION_VALUE_TO_IND_VIEW)
    306 ;
    307 select NAME, SERIES_DIMENSION_NAME, CATEGORY_DIMENSION_NAME, PERIOD_DIMENSION_NAME from INDICATOR_VIEW
    308 where ACTIVE_FLAG = 'x'
    309   and NAME not in (select distinct INDICATOR_VIEW_NAME from DIMENSION_TO_INDICATOR_VIEW)
    310 ;
     110/*------------------------------ END OF FILE ------------------------------*/
  • trunk/db/src/main/scripts/mysql/data_u-iv_measure_name.sql

    r11972 r12462  
    1 /*
    2 */
     1/* Sets the IV Measure Name */
    32
    43use ibisph;
  • trunk/db/src/main/scripts/mysql/tab_c-dataset.sql

    r11972 r12462  
    7373  PERIOD_DIMENSION_NAME           varchar  (100)  not null,
    7474  PERIOD_DIMENSION_VALUE          varchar  (100)  not null,
    75   DIMENSION_1_NAME                varchar  (100)  not null,
    76   DIMENSION_1_VALUE               varchar  (100)  not null,
    77   DIMENSION_2_NAME                varchar  (100)  not null,
    78   DIMENSION_2_VALUE               varchar  (100)  not null,
     75  GROUP_1_DIMENSION_NAME          varchar  (100)  not null,
     76  GROUP_1_DIMENSION_VALUE         varchar  (100)  not null,
     77  GROUP_2_DIMENSION_NAME          varchar  (100)  not null,
     78  GROUP_2_DIMENSION_VALUE         varchar  (100)  not null,
    7979  /* */
    8080  LONGITUDE                       double,
     
    9696);
    9797
     98
     99
     100
     101
     102
     103********** When looking at some data it appears to repeat the same dimension
     104structure and data sources. 
     105==> should have multiple measures per record????????
     106????????? What about the numerator, denom, LCL etc in those cases???????
     107
     108For example:
     109http://localhost/ibisph-admin/edit/indicator/dataset/records/AirQualPM25.Concentration.Cnty.html
     110all have the same measure %, all years, by county.
     111THey have different DSs
     112They'd have different limits, numer etc.
     113
     114******************** The above BREAKS THE MODEL!!!!!!!!!!!!
     115they're all air quality but all are different - % person days, % pop, count person days, concentration!!!!!!!!!!!
     116
     117LOIS SAID THAT SOME EPHT IPs WILL FAIL THIS and THAT THE MEASURE REALLY IS THE RIGHT DEFINITION.
     118
     119
    98120create table DATASET_RECORD_ANCILLARY_VALUE(
    99121  DATASET_RECORD_NAME             varchar (400)  not null,
  • trunk/db/src/main/scripts/mysql/tab_c-indicator.sql

    r11762 r12462  
    9898
    9999
    100 /* subset of datasets for an IPV based on the assoc IP name and IPV Measure */
     100/* subset of datasets for an IP VIEW based on the assoc IP name and IP VIEW Measure */
    101101create table DATASET_TO_INDICATOR_VIEW(
    102102  DATASET_NAME                    varchar  (100)  not null,
     
    107107);
    108108
     109/* Views are 2-d with only a series and a category.  The period at some point
     110        will be allowed to be cycled through if not part of the 2-d dims.
     111*/
    109112create table DIMENSION_TO_INDICATOR_VIEW(
    110113  INDICATOR_VIEW_NAME             varchar  (200)  not null,
  • trunk/db/src/main/scripts/mysql/update.sql

    r11972 r12462  
    11/* script needed to convert db from 2.3 to 3.0
    22
    3         1) add the new tables.
     3        1) add the new v3 tables.
    44        2) add/rename the new columns
    5         3) run data update scripts
     5        3) insert new validation lists:
     6             - topics,
     7                 - initiatives,
     8                 - measures,
     9                 - value attr & type,
     10                 - period dimensions and assoc values.
     11
     12        4) Cleanup
     13                - delete ophaned IP and IPV and IPVV
     14                - Do any IP/IPV/IPVV name cleanup.
     15
     16        5) IP and IPV Updates
     17                - Set/update the IP MEASURE_NAME
     18                - Update the new IPV feilds
     19                        - Insert the new, assoc period, series, cat dim names
     20
     21        6) create the view dimension(s) records
     22        7) create the view dimension values records
     23
     24        setup view's period, series, category, dimensions. 
     25                NOTE: period can be used for series or category.
     26                        SERIES AND CATEGORY ARE REQUIRED - can be N/A but MUST BE SET.
     27                *** need to handle 2 datasets for NM and US
     28        setup view's dimension values based on current usage.
     29                *** need to handle 2 datasets for NM and US
     30       
     31        - create dataset records - based on the assoc IPV
     32
     33        setup dataset's period, dim1 and dim2 dimensions.
     34                NOTE: period is unique from dim1 and dim2 - which ARE BOTH REQUIRED.
     35                *** need to split out NM and US datasets
     36       
     37        - create dataset records records - based on the assoc IPVVs
     38
    639        4) drop old unused columns
    740        5) drop old unused tables
     
    1346        tab_c-dataset.sql
    1447        tab_c-initiative.sql
    15 
    16 
    17 create table MEASURE(
    18   NAME                            varchar  (100)  not null,
    19   TITLE                           varchar  (250)  not null,
    20   DESCRIPTION                     varchar (4000)  not null,
    21   VALUE_TYPE_NAME                 varchar  (100)  not null,
    22 /* currently is with the data_i measure but probably belongs with the IP and possibly the view - but the views are all based on the VALUE_TYPE which is the measure... */
    23 DESIRABLE_VALUE                 double,
    24   DATA_NOTE                       varchar (1000),                       /* specific note associated with the measure - mostly age ajusted: "Rates are age-adjusted to the 2000 US standard population." */
    25   /* */
    26   SORT_ORDER                      int             default null,
    27   ACTIVE_FLAG                     varchar    (1),
    28   MODIFIED_DATE                   datetime,
    29   /**/
    30   constraint MEASURE_PK
    31     primary key (NAME)
    32 );
    33 create table VALUE_ATTRIBUTE(
    34   NAME                            varchar  (100)  not null,
    35   TITLE                           varchar  (100)  not null,
    36   FOOTNOTE_CODE                   varchar   (10)  not null,
    37   DEFINITION                      varchar (1000),
    38   DESCRIPTION                     varchar  (500),
    39   /* */
    40   SORT_ORDER                      int             default null,
    41   ACTIVE_FLAG                     varchar    (1),
    42   MODIFIED_DATE                   datetime,
    43   /* */
    44   constraint VALUE_ATTRIBUTE_PK
    45     primary key (NAME)
    46 );
    47 create table ANCILLARY_VALUE(
    48   NAME                            varchar  (100)  not null,
    49   TITLE                           varchar  (100)  not null,
    50   DEFINITION                      varchar (1000)  not null,
    51   DESCRIPTION                     varchar  (500),
    52   MEASURE_NAME                    varchar  (100)  not null,
    53   /* */
    54   SORT_ORDER                      int,
    55   ACTIVE_FLAG                     varchar    (1),
    56   MODIFIED_DATE                   datetime,
    57   /* */
    58   constraint ANCILLARY_VALUE_PK
    59     primary key (NAME)
    60 );
    61 
    62 create table DIMENSION(
    63   NAME                            varchar  (100)  not null,
    64   PROXY_DIMENSION_NAME            varchar  (100),
    65   /* */
    66   TITLE                           varchar  (100)  not null,
    67   DESCRIPTION                     varchar  (500),
    68   PERIOD_FLAG                     varchar    (1),
    69   COMMUNITY_FLAG                  varchar    (1),
    70   /* */
    71   SORT_ORDER                      int             default null,
    72   ACTIVE_FLAG                     varchar    (1),
    73   MODIFIED_DATE                   datetime,
    74   /* */
    75   constraint DIMENSION_PK
    76     primary key (NAME)
    77 );
    78 create table DIMENSION_VALUE(
    79   DIMENSION_NAME                  varchar  (100)  not null,
    80   VALUE                           varchar  (100)  not null,
    81   /* */
    82   TITLE                           varchar  (100)  not null,
    83   DESCRIPTION                     varchar  (500),
    84   /* */
    85   AUTHORITY_NAME                  varchar  (100),
    86   SORT_ORDER                      int             default null,
    87   ACTIVE_FLAG                     varchar    (1),
    88   MODIFIED_DATE                   datetime,
    89   /* */
    90   constraint DIMENSION_VALUE_UK
    91     unique (DIMENSION_NAME, VALUE)
    92 );
    93 
    94 create table TOPIC(
    95   NAME                            varchar  (100)  not null,
    96   /**/
    97   TITLE                           varchar  (100)  not null,
    98   URL                             varchar (1024),
    99   DESCRIPTION                     varchar  (500),
    100   /**/
    101   SORT_ORDER                      int             default null,
    102   ACTIVE_FLAG                     varchar    (1),
    103   MODIFIED_DATE                   datetime,
    104   /**/
    105   constraint TOPIC_PK
    106     primary key (NAME)
    107 );
    108 create table INDICATOR_TO_TOPIC(
    109   INDICATOR_NAME                  varchar  (100)  not null,
    110   TOPIC_NAME                      varchar  (100)  not null,
    111   /**/
    112   SORT_ORDER                      int             default null,
    113   /**/
    114   constraint INDICATOR_TO_TOPIC_UK
    115     primary key (INDICATOR_NAME, TOPIC_NAME)
    116 );
    117 
    118 /* subset of datasets for an IPV based on the assoc IP name and IPV Measure */
    119 create table DATASET_TO_INDICATOR_VIEW(
    120   DATASET_NAME                    varchar  (100)  not null,
    121   INDICATOR_VIEW_NAME             varchar  (100)  not null,
    122   /* */ 
    123   constraint DATASET_TO_INDICATOR_VIEW_UK
    124     unique (DATASET_NAME, INDICATOR_VIEW_NAME)
    125 );
    126 create table DIMENSION_TO_INDICATOR_VIEW(
    127   INDICATOR_VIEW_NAME             varchar  (200)  not null,
    128   DIMENSION_NAME                  varchar  (100)  not null,
    129   DIMENSION_USAGE                 varchar   (20)  not null,     /* series, category */
    130 /*
    131   SERIES_DIMENSION_NAME       varchar  (100)  not null,
    132   CATEGORY_DIMENSION_NAME       varchar  (100)  not null,
    133    */
    134   constraint DIMENSION_TO_INDICATOR_VIEW_UK
    135     unique (INDICATOR_VIEW_NAME, DIMENSION_NAME, DIMENSION_USAGE)
    136 );
    137 create table DIMENSION_VALUE_TO_IND_VIEW(               /* allows selection of single LHD, mult CNTY etc. */
    138   INDICATOR_VIEW_NAME             varchar  (200)  not null,
    139   DIMENSION_NAME                  varchar  (100)  not null,
    140   DIMENSION_VALUE                 varchar  (100)  not null,
    141   SORT_ORDER                      int             default null,
    142   /**/
    143   constraint DIMENSION_VALUE_TO_IND_VIEW_UK
    144     unique (INDICATOR_VIEW_NAME, DIMENSION_NAME, DIMENSION_VALUE)
    145 );
    146 
    147 create table INDICATOR_VIEW_SAVED_QUERY(
    148   INDICATOR_VIEW_NAME             varchar  (100)  not null,
    149   TITLE                           varchar  (100)  not null,
    150   SAVED_QUERY_URL                 varchar (1024)  not null,
    151   /**/
    152   SORT_ORDER                      int             default null,
    153   /* URL is too long and mysql complains so used TITLE for UK */
    154   constraint INDICATOR_VIEW_SAVED_QUERY_UK
    155     primary key (INDICATOR_VIEW_NAME, TITLE)
    156 );
     48        tab_c-other_v3.sql
     49
    15750
    15851
    15952rename table INDICATOR_RELATION to INDICATOR_TO_RELATION;
    16053rename table INDICATOR_TO_IND_RELATION to INDICATOR_TO_INDICATOR;
    161 
    16254
    16355rename table ROLE_TO_AUTHORITY to AUTHORITY_TO_ROLE;
    16456rename table USER_TO_AUTHORITY to AUTHORITY_TO_USER;
    16557rename table USER_TO_ROLE      to ROLE_TO_USER;
     58
     59
    16660
    16761alter table AUTHORITY add column MODIFIED_DATE  datetime;
     
    209103alter table VALUE_TYPE  add column MODIFIED_DATE datetime;
    210104
    211 alter table INDICATOR_TO_IND_RELATION add column SORT_ORDER int default null;
     105alter table INDICATOR_TO_INDICATOR add column SORT_ORDER int default null;
    212106
    213107alter table INDICATOR add column SYNOPSIS            varchar(250) not null;
     
    229123*/
    230124
    231 
    232125alter table INDICATOR_VIEW change column VALUE_TYPE_NAME MEASURE_NAME varchar(100);
    233126
     
    249142alter table INDICATOR_VIEW add column SERIES_DIMENSION_NAME   varchar(100);
    250143alter table INDICATOR_VIEW add column CATEGORY_DIMENSION_NAME varchar(100);
    251 alter table INDICATOR_VIEW add column PERIOD_DIMENSION_NAME   varchar(100);
    252144
    253145alter table INDICATOR_VIEW_VALUE add column SERIES_DIMENSION_NAME    varchar(100);
    254146alter table INDICATOR_VIEW_VALUE add column CATEGORY_DIMENSION_NAME  varchar(100);
    255 alter table INDICATOR_VIEW_VALUE change column DATASET_SERIES_VALUE   SERIES_DIMENSION_VALUE   varchar(100);
    256 alter table INDICATOR_VIEW_VALUE change column DATASET_CATEGORY_VALUE CATEGORY_DIMENSION_VALUE varchar(100);
    257 
    258 alter table INDICATOR_VIEW_VALUE add column PERIOD_DIMENSION_NAME  varchar(100);
    259 alter table INDICATOR_VIEW_VALUE add column PERIOD_DIMENSION_VALUE varchar(100);
    260 
    261 
     147alter table INDICATOR_VIEW_VALUE add column PERIOD_DIMENSION_NAME    varchar(100);
     148alter table INDICATOR_VIEW_VALUE add column SERIES_DIMENSION_VALUE   varchar(100);
     149alter table INDICATOR_VIEW_VALUE add column CATEGORY_DIMENSION_VALUE varchar(100);
     150alter table INDICATOR_VIEW_VALUE add column PERIOD_DIMENSION_VALUE   varchar(100);
    262151
    263152RUN:
    264153        data_i-topic.sql
    265         data_iu-initiative.sql
     154        data_i-initiative.sql
    266155        data_i-value_type.sql
    267156        data_i-value_attribute.sql
    268157        data_i-measure.sql
     158        data_i-dimension_period.sql
     159
     160        data_u-name_cleanup.sql
     161
    269162        data_u-iv_measure_name.sql
    270 
    271         -- dimensions will be based off the IV entries - NOT based on the DSC or
    272         -- DSS tables.  This was done to only grab used entries.  Need to insert the
    273         -- valid period dimensions first because the iv_dss_dsc_u.sql relies on these
    274         -- records.
    275         data_i-period_dimension.sql
    276163        data_u-iv_dss_dsc.sql
    277 
    278         data_iu-dimension.sql
     164        data_iu-ivv_dims.sql
     165
     166        data_i-dimension.sql
    279167        data_i-dataset.sql
     168
    280169
    281170
  • trunk/ibisph-admin/src/main/webapp/WEB-INF/jsp/indicator/dataset/list.jsp

    r12078 r12462  
    114114                                                <td>
    115115                                                        <a href="javascript:requestPage('edit/indicator/dataset/detail/${dataset.name}.html');" title="View specs/detail for ${dataset.name}">
    116                                                                 ${fn:length(dataset.name) > 25 ? fn:replace(dataset.name, ".", ". ") : dataset.name}
     116                                                                ${fn:length(dataset.name) > 40 ? fn:replace(dataset.name, ".", ". ") : dataset.name}
    117117                                                        </a>
    118118                                                </td>
  • trunk/ibisph-admin/src/main/webapp/WEB-INF/jsp/indicator/dataset/records.jsp

    r12078 r12462  
    3636                // <!-- begin of java script
    3737                global.pageName = "indicator/dataset/records";
    38 
    39                 // init the Excel merge functionality.
    40                 function initializePage()
    41                 {
    42                         // Setup the merge data cookies.  Set to expire in a year.
    43                         var mergeOverwriteNonBlankDataCookie = new Cookie("MergeOverwriteNonBlankData");
    44                         var mergeColumnDelimiterCookie       = new Cookie("MergeColumnDelimiter");
    45                         mergeOverwriteNonBlankDataCookie.setExpires(1);
    46                         mergeColumnDelimiterCookie.setExpires(1);
    47 
    48                         // create bound cookie input elements and bind so that when the
    49                         // values change that the cookie is updated.
    50                         var mergeOverwriteNonBlankDataCookieBoundInputElement = new CookieBoundInputElement("mergeOverwriteNonBlankData", mergeOverwriteNonBlankDataCookie);
    51                         var mergeColumnDelimiterCookieBoundInputElement       = new CookieBoundInputElement("mergeColumnDelimiter",       mergeColumnDelimiterCookie);
    52                         mergeOverwriteNonBlankDataCookieBoundInputElement.bind();
    53                         mergeColumnDelimiterCookieBoundInputElement.bind();
    54                 } //~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~
    55                 window.onLoadEventManager.add(initializePage);
    56 
    5738
    5839                function validate()
     
    161142                } //~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~
    162143
    163                 function showMergeDataDialog()
    164                 {
    165                         if(!global.mergeDialog) global.mergeDialog = new ModalDialog("mergeDialog", "mergeDialogContentContainer");
    166                         global.mergeDialog.show();
    167                 } //~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~
    168 
    169                 // called from the dialog's onclick.
    170                 function mergeParsedData()
    171                 {
    172                         mergeTextAreaDataToTableInput(
    173                                 "mergeDataToParse", "mergeColumnDelimiter",
    174                                 "valuesTable",
    175                                 "mergeStartingTableRow", "mergeStartingTableColumn",
    176                                 "mergeOverwriteNonBlankData"
    177                         );
    178                         global.mergeDialog.hide();
    179                 } //~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~
    180 
    181144                function changeRecordFilter(filterSelectElementName)
    182145                {
    183                         var filterDimensionNameAndValue = document.form[filterSelectElementName].value.split("|");
    184                         var selectedSeriesName  = filterDimensionNameAndValue[0];
    185                         var selectedSeriesValue = filterDimensionNameAndValue[1];
    186                         url = "edit/indicator/dataset/values/${indicatorDataset.name}.html"
    187                                 + "?seriesDimensionName="+selectedSeriesName
    188                                 + "&seriesDimensionValue="+selectedSeriesValue
     146                        var selectedDimension1Name = document.form.selectedDimension1Name.value;
     147                        var selectedDimension2Name = document.form.selectedDimension2Name.value;
     148                        var selectedPeriodDimensionValue = document.form.selectedPeriodDimensionValue.value;
     149                        url = "edit/indicator/dataset/records/${selectedDatasetName}.html"
     150                                + "?selectedDimension1Name="+selectedDimension1Name
     151                                + "&selectedDimension2Name="+selectedDimension2Name
     152                                + "&selectedPeriodDimensionValue="+selectedPeriodDimensionValue;
    189153                        ;
    190                         if(isDefined(document.form.selectedPeriodDimensionValue))
    191                         {
    192                                 var selectedPeriodValue = document.form.selectedPeriodDimensionValue.value;
    193                                 url = url + "&periodDimensionValue="+selectedPeriodValue;
    194                         }
    195154                        requestPage(url);
    196155                } //~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~
     156
    197157                // end of script -->
    198158        </script>
     
    215175                                                <li class="SubList">
    216176                                                        <ul>
    217 <%@ include file="_sublist_menu_items.jsp"%>
     177<li id="indicator/dataset/list"  ><a href="javascript:requestPage('edit/indicator/dataset/list/${selectedIndicatorName}.html')" title="List of all datasets for the current, selected indicator.">Datasets List</a></li>
     178<li id="indicator/dataset/detail"><a href="javascript:requestPage('edit/indicator/dataset/detail/${selectedDatasetName}.html')" title="Datasets's definition -  textual info.">Dataset Detail</a></li>
     179<li id="indicator/dataset/data_sources"><a href="javascript:requestPage('edit/indicator/dataset/data_sources/${selectedDatasetName}.html')" title="Datasets's data sources.">Dataset Data Sources</a></li>
     180<li id="indicator/dataset/dimensions"  ><a href="javascript:requestPage('edit/indicator/dataset/dimensions/${selectedDatasetName}.html')" title="Datasets's dimensions.">Dataset Dimensions</a></li>
     181<li id="indicator/dataset/records"><a href="javascript:requestPage('edit/indicator/dataset/records/${selectedDatasetName}.html')" title="Datasets's values, confidence limits etc.">Dataset Records</a></li>
     182<li id="indicator/dataset/record"><a href="javascript:requestPage('edit/indicator/dataset/record', '${selectedDatasetRecordKey}')" title="Datasets's record value, confidence limits etc.">Dataset Record Detail</a></li>
     183                                                                <li id="editButton" class="Button" title="Edit the detail of the selected item">
     184                                                                        <a href="javascript:requestPage('edit/indicator/dataset/detail')">Edit Detail</a>
     185                                                                </li>
    218186<c:if test="${(dataset != null) && indicator.statusOpen}">
    219                                                                 <li id="mergeButton" class="Button" title="Show the copy paste merge dialog.">
    220                                                                         <a href="javascript:showMergeDataDialog()">Merge Data</a>
    221                                                                 </li>
    222                                                                 <li id="newButton" class="Button" title="Shows the new indicator creation page.">
    223                                                                         <a href="javascript:requestPage('edit/indicator/dataset/record/-NEW-.html')">Add New</a>
    224                                                                 </li>
    225187                                                                <li id="saveButton" class="Button" title="Commit/save the changes">
    226188                                                                        <a href="javascript:requestPage('edit/indicator/dataset/records/${dataset.name}.html')">Save</a>
     
    239201                                <h2 class="Header">${pageTitle}</h2>
    240202
     203
     204[period dim values] [dimensions - group 1] [dimensions - group 2]
     205if more than 1 period selection then add an all option.  default to highest used value.
     206
     207if more than 1 dim 1 selection then add an all option.  default is first in collection
     208if more than 1 dim 2 selection then add an all option.  default is first in collection
     209
     210can have a huge list each record will have a "modified" and dim names and values so
     211an update is possible if modified.
     212
     213edit detail is a record at a time and allows for the selection special attributes and extra values.
     214
     215------- PROBLEM WITH ALL DIMS OPTION: columns - jsp would need to be dynamic
     216and include PERIOD  DIM1 DIM2 with DIM1 and DIM2 needing both the DIM TITLE:
     217DIM VALUE TITLE - so either wrapping or really wide!!!!!!!!!!
     218
     219*** If only 1 of anything - then do not show in the grid - it only shows in the drop down...
     220
     221
     222Seperate merge page!!!!!!!!!!
     223
     224
     225table only lists DIM values that are active
     226PERIOD defaults to ALL active period values
     227        user can specify/filter if they want
     228DIM 1 defaults to ALL DIM1's IF SELECTED (or all) PERIOD's PERIOD VALUES * DIM1 VALUES < SOME MAX
     229        else, only the first DIM1 with all of it's values are listed.
     230DIM 2 defaults to ALL DIM2's IF PERIOD VALUES * DIM1 VALUES * DIM2 VALUES < SOME MAX
     231        else, only the first DIM2 with all of it's values are listed.
     232
     233UI has a drop down for each with an ALL ACTIVE VALUES option.
     234
     235
     236DISPLAY:
     237For now, use the standard grid
     238
     239Select  Period Title    Dim1.1 Title    Dim2.1 Title    value   lcl             ucl             num             denom   special         active
     240...
     241==============
     242Select  Period Title    Dim1.2 Title    Dim2.1 Title    value   lcl             ucl             num             denom   special         active
     243...                             
     244
     245[VALUE DETAIL BUTTON]
     246
     247
     248
     249VALUE DETAIL PAGE
     250lists things like a standard detail page with 3 tabs
     2511st has the VALUES
     2522nd has the special attributes list
     2533rd has the extra values list where option to add new or delete existing?
     254
     255
     256
     257UPDATE PAGE
     258- able to run a query
     259- able to export to excel
     260- able to import from paste or excel???
     261
     262                                        <c:if test="${fn:length(dimension2Values)} > 1">
     263                                        </c:if>
    241264                                <div class="ConstantDimensions">
    242                                         <label for="periodDimensionValue">Period:</label>
    243                                         <select name="periodDimensionValue" id="periodDimensionValue" size="1" onchange="changeRecordFilter()">
     265                                        <label for="selectedPeriodDimensionValue">Period:</label>
     266                                        <select name="selectedPeriodDimensionValue" id="selectedPeriodDimensionValue" size="1" onchange="changeRecordFilter()">
    244267<c:forEach var="dimensionValue" items="${periodDimensionValues}" varStatus="loopStatus">
    245268                                                <option value="${dimensionValue.value}" ${dimensionValue.value == periodDimensionValue ? "selected=\"selected\"" : ""}>${dimensionValue.title}</option>
    246269</c:forEach>
    247270                                        </select>
    248 <c:if test="${fn:length(dimension2Values)} > 1">
    249 </c:if>
    250                                         <label for="dimension2NameAndValue">Dimension:</label>
    251                                         <select name="dimensionNameAndValue" id="dimensionNameAndValue" size="1" onchange="changeRecordFilter()">
    252         <c:forEach var="dimensionNameAndValue" items="${dimension2Values}" varStatus="loopStatus">
    253                                                 <option value="${dimensionNameAndValue.value}" title="Dimension name: ${dimensionNameAndValue.dimensionName}, value: ${dimensionNameAndValue.value}"
    254                                                 ${((dimensionNameAndValue.dimensionName == selectedDimensionNameAndValue)) ? "selected=\"selected\"" : ""}>${dimensionNameAndValue.title}</option>
    255         </c:forEach>
     271
     272                                        <label for="selectedDimension1Name">Dimension 1:</label>
     273                                        <select name="selectedDimension1Name" id="selectedDimension1Name" size="1" onchange="changeRecordFilter()">
     274<c:forEach var="dimension" items="${dimension1s}" varStatus="loopStatus">
     275                                                <option value="${dimension.name}" title="Dimension name: ${dimension.name}"
     276                                                ${((dimension.name == dimension1.name)) ? "selected=\"selected\"" : ""}>${dimension.title}</option>
     277</c:forEach>
     278                                        </select>
     279
     280                                        <label for="selectedDimension2Name">Dimension 2:</label>
     281                                        <select name="selectedDimension2Name" id="selectedDimension2Name" size="1" onchange="changeRecordFilter()">
     282<c:forEach var="dimension" items="${dimension2s}" varStatus="loopStatus">
     283                                                <option value="${dimension.name}" title="Dimension name: ${dimension.name}"
     284                                                ${((dimension.name == dimension1.name)) ? "selected=\"selected\"" : ""}>${dimension.title}</option>
     285</c:forEach>
    256286                                        </select>
    257287                                </div>
     
    259289                                <table id="valuesTable" class="List">
    260290                                        <thead><tr>
    261                                                 <th scope="col" title="Dimension Name: {dimension1.name}">Dimension</th>
    262                                                 <th scope="col" class="ActiveFlag" title="Only active data values are published.">Active</th>
     291                                                <th scope="col" class="Selection" title="Controls which record is selected when editing associated detail.">Selection</th>
     292                                                <th scope="col" title="Dimension Name: {period.name}">Period</th>
     293                                                <th scope="col" title="Dimension Name: {dimension1.name}">Dimension Group 1</th>
     294                                                <th scope="col" title="Dimension Name: {dimension1.name}">Dimension Group 2</th>
    263295                                                <th scope="col" title="Measure name: ${dataset.measureName}">${measure.title}</th>
    264296                                                <th scope="col">Lower<br/> Confidence<br/> Value</th>
    265297                                                <th scope="col">Upper<br/> Confidence<br/> Value</th>
     298                                                <th scope="col">Numerator<br/>(no formatting)</th>
     299                                                <th scope="col">Denominator<br/>(no formatting)</th>
     300
     301                                                <th scope="col">Special Attributes</th>
     302                                                <th scope="col">Ancilary Values</th>
     303
    266304                                                <th scope="col" title="Internal, non-published note(s) about this data point.">Admin Note</th>
    267305                                                <th scope="col" title="Text to display when chart/map data point moused over.">Display Label</th>
    268                                                 <th scope="col">Numerator<br/>(no formatting)</th>
    269                                                 <th scope="col">Denominator<br/>(no formatting)</th>
    270                                                 <th scope="col">Special Attributes</th>
    271                                                 <th scope="col">Ancilary Values</th>
     306                                                <th scope="col" class="ActiveFlag" title="Only active data values are published.">Active</th>
    272307                                        </thead></tr>
    273308
     
    281316
    282317                                                <tr>
    283                                                         <td class="Title" title="Name: ${datasetRecord.dimension1Name}" style="min-width:100px;">
    284 <%--
    285                                                                 ${datasetRecord.dimension1Title}: ${datasetRecord.dimension1ValueTitle}<br/>
    286                                                                 ${datasetRecord.dimension2Title}: ${datasetRecord.dimension2ValueTitle}<br/>
     318                                                <td class="Selection">
     319                                                                <input type="radio"  name="selectedName" value="${loopStatus.index}" ${loopStatus.index == 0 ? "checked=\"checked\"" : ""}/>
     320                                                                <input type="hidden" name="modified"/>
     321                                                        </td>
     322                                                        <td class="Title" title="Period: ${datasetRecord.periodDimensionName}: ${datasetRecord.periodDimensionValue}">
    287323                                                                ${datasetRecord.periodDimensionTitle}: ${datasetRecord.periodDimensionValueTitle}
    288 --%>
    289                                                                 ${datasetRecord.dimension1Name}: ${datasetRecord.dimension1Value}<br/>
    290                                                                 ${datasetRecord.dimension2Name}: ${datasetRecord.dimension2Value}<br/>
    291                                                                 ${datasetRecord.periodDimensionName}: ${datasetRecord.periodDimensionValue}
    292 
     324                                                                <input type="hidden" name="periodDimensionName"  value="${datasetRecord.periodDimensionName}"/>
     325                                                                <input type="hidden" name="periodDimensionValue" value="${datasetRecord.periodDimensionValue}"/>
     326                                                        </td>
     327                                                        <td class="Title" title="Dimension Group 1: ${datasetRecord.dimension1Name}: ${datasetRecord.dimension1Value}">
     328                                                                ${datasetRecord.dimension1Title}: ${datasetRecord.dimension1ValueTitle}
    293329                                                                <input type="hidden" name="dimension1Name"       value="${datasetRecord.dimension1Name}"/>
    294330                                                                <input type="hidden" name="dimension1Value"      value="${datasetRecord.dimension1Value}"/>
     331                                                        </td>
     332                                                        <td class="Title" title="Dimension Group 2: ${datasetRecord.dimension2Name}: ${datasetRecord.dimension2Value}">
     333                                                                ${datasetRecord.dimension2Title}: ${datasetRecord.dimension2ValueTitle}
    295334                                                                <input type="hidden" name="dimension2Name"       value="${datasetRecord.dimension2Name}"/>
    296335                                                                <input type="hidden" name="dimension2Value"      value="${datasetRecord.dimension2Value}"/>
    297                                                                 <input type="hidden" name="periodDimensionName"  value="${datasetRecord.periodDimensionName}"/>
    298                                                                 <input type="hidden" name="periodDimensionValue" value="${datasetRecord.periodDimensionValue}"/>
    299                                                         </td>
    300                                                         <td class="ActiveFlag">
    301                                                                 <input type="checkbox" name="active" value="${datasetRecord.value}" ${datasetRecord.active ? "checked=\"checked\"" : ""} ${checkboxControl} ${activeOnClick}/>
    302                                                                 <input type="hidden"   name="activeFlag" value="${datasetRecord.active ? 'x':''}"/>
    303                                                                 <input type="hidden"   name="modified"/>
    304                                                         </td>
     336                                                        </td>
     337
    305338                                                        <td class="Number">
    306339                                                                <input size=8 type="text" name="value" maxlength="20"
     
    308341                                                                />
    309342                                                        </td>
     343
    310344                                                        <td class="Number">
    311345                                                                <input size=8 type="text" name="lowerConfidenceValue" value="${datasetRecord.lowerConfidenceValue}" ${inputControl} ${onChange}/>
     
    314348                                                                <input size=8 type="text" name="upperConfidenceValue" value="${datasetRecord.upperConfidenceValue}" ${inputControl} ${onChange}/>
    315349                                                        </td>
     350
     351                                                        <td class="Number">
     352                                                                <input size=8 type="text" name="numerator" maxlength="20" value="${datasetRecord.numerator}" ${inputControl} ${onChange}/>
     353                                                        </td>
     354                                                        <td class="Number">
     355                                                                <input size=10 type="text" name="denominator" maxlength="20" value="${datasetRecord.denominator}" ${inputControl} ${onChange}/>
     356                                                        </td>
     357
     358
     359<td/><td/>
     360
     361
    316362                                                        <td>
    317363                                                                <input size=15 type="text" name="note" maxlength="1000" value="${datasetRecord.note}" ${inputControl} ${onChange}/>
     
    321367                                                        </td>
    322368
    323                                                         <td class="Number">
    324                                                                 <input size=8 type="text" name="numerator" maxlength="20" value="${datasetRecord.numerator}" ${inputControl} ${onChange}/>
    325                                                         </td>
    326                                                         <td class="Number">
    327                                                                 <input size=10 type="text" name="denominator" maxlength="20" value="${datasetRecord.denominator}" ${inputControl} ${onChange}/>
     369                                                        <td class="ActiveFlag">
     370                                                                <input type="checkbox" name="active" value="${datasetRecord.value}" ${datasetRecord.active ? "checked=\"checked\"" : ""} ${checkboxControl} ${activeOnClick}/>
     371                                                                <input type="hidden"   name="activeFlag" value="${datasetRecord.active ? 'x':''}"/>
    328372                                                        </td>
    329373                                                </tr>
  • trunk/ibisph-view/src/main/webapp/xslt/html/SelectionsList.xslt

    r10985 r12462  
    347347                <xsl:param name="href"/>
    348348                <xsl:param name="id"        select="concat('ExpandableListInputControl.', generate-id(.))"/>
    349                 <xsl:param name="show"      select="exists($selection/SELECTIONS/SHOW)"/>
     349                <xsl:param name="show"/>
    350350
    351351                <input id="{$id}" type="{$inputType}" title="Show/hide selection list control for {$title}">
     
    353353                                <xsl:attribute name="name" select="$inputName"/>
    354354                        </xsl:if>
    355                         <xsl:if test="$show">
     355                        <xsl:if test="$show or exists($selection/SELECTIONS/SHOW)">
    356356                                <xsl:attribute name="checked" select="'checked'"/>
    357357                        </xsl:if>
  • trunk/ibisph/src/main/java/org/ibisph/indicatorprofile/springmvc/databean/EditDatasetRecordsController.java

    r12319 r12462  
    33import java.util.ArrayList;
    44import java.util.Collection;
    5 import java.util.HashMap;
    65import java.util.Map;
    76
     
    3130  protected String measureModelName = "measure";
    3231 
    33   protected String nameValueDelimiter = "|";
    34 
    35   protected String selectedDimension1NameParameterName = "selctedDimension1Name";
    36   protected String selectedDimension2NameParameterName = "selctedDimension2Name";
     32//  protected String nameValueDelimiter = "|";
     33
     34  protected String selectedDimension1NameParameterName = "selectedDimension1Name";
     35  protected String selectedDimension2NameParameterName = "selectedDimension2Name";
    3736  protected String selectedPeriodDimensionValueParameterName = "selectedPeriodDimensionValue";
    3837
    3938  protected String dimension1ModeName = "dimension1";
    4039  protected String dimension2ModeName = "dimension2";
    41   protected String periodDimensionModelName      = "periodDimension";
     40//  protected String periodDimensionModelName      = "periodDimension";
    4241  protected String periodDimensionValueModelName = "periodDimensionValue";
    4342
     
    4645  protected String periodDimensionValueCollectionModelName = "periodDimensionValues";
    4746
    48 
     47  protected int maxDimensionValuesCombiniations = 100;
     48  protected String maxDimensionValueCombinationsExceededModelName = "maxDimensionValueCombinationsExceeded";
    4949 
    5050  protected String datasetRecordCollectionModelName = "datasetRecords";
    5151 
    52   protected String showPeriodSelectionsModelName    = "showPeriodSelections";
     52//  protected String showPeriodSelectionsModelName    = "showPeriodSelections";
    5353
    5454  /**
     
    6868   */
    6969  public void setShowPeriodSelectionsModelName(String showPeriodSelectionsModelName) {
    70     this.showPeriodSelectionsModelName = showPeriodSelectionsModelName;
     70//    this.showPeriodSelectionsModelName = showPeriodSelectionsModelName;
    7171  } //-------------------------- End of Method ------------------------------
    7272
     
    132132    // puts into the model, loops the dataset dims and creates a dim collection
    133133    // and puts into the model for the drop down selections.
    134     String dimension1Name = processDimension(
     134    String selectedDimension1Name = processDimension(
    135135      request,
    136136      dimensionToDatasetMap,
     
    142142      modelMap
    143143    );
    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
     144    String selectedDimension2Name = 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    // and the dim1 & 2 values to create the dataset record collection via loop.
     156    ArrayList<DataBean> dimension1ValueCollection = getDimensionValueArrayList(selectedDimension1Name);
     157    ArrayList<DataBean> dimension2ValueCollection = getDimensionValueArrayList(selectedDimension2Name);
     158
     159    // next get the period dimension values. 
     160    // NOTE: Can use the super model map to get access to the period dimension.
    156161    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);
     162    ArrayList<DataBean> periodDimensionValueCollection = getDimensionValueArrayList(periodDimensionName);
    164163    modelMap.put(this.periodDimensionValueCollectionModelName, periodDimensionValueCollection);
    165164
    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);
    170 
    171     // create a map of dimension name: dimension value collection.  Loop through
    172     // the selected dimensions and build the dim value collection and add.
    173     Collection<DimensionValue> dimension1ValueCollection = new ArrayList<DimensionValue>();
    174     Collection<DimensionValue> dimension2ValueCollection = new ArrayList<DimensionValue>();
    175     for(Map.Entry<String, DimensionToDataset> entry : dimensionToDatasetMap.entrySet()) {
    176       DimensionToDataset dimensionToDataset = (DimensionToDataset)entry.getValue();
    177       Dimension dimension = getDimension(dimensionCollection, dimensionToDataset.getDimensionName());
    178 
    179       // get all active dim values.
    180       DimensionValue dimensionValue = new DimensionValue();
    181       dimensionValue.setFieldValue("DIMENSION_NAME", dimensionToDataset.getDimensionName());
    182       dimensionValue.setFieldValue("ACTIVE_FLAG", this.dataBeanFlagValue);
    183  //     ArrayList<DataBean> dimensionValueCollection = new ArrayList<DataBean>();
    184       this.dataBeanDAOService.load(dimensionValueCollection, dimensionValue);
    185 
    186       // loop through and set the title and selected flag.
    187       for(DataBean dv : dimensionValueCollection) {
    188         dimensionValue = (DimensionValue)dv;
    189         dimensionValue.setFieldValue("DIMENSION_TITLE", dimension.getTitle());
    190         DimensionValue dsdv = setDatasetRecordDimensionValue(datasetRecordCollection, dimensionValue);
    191         if(null != dsdv) {
    192           dimensionValue.setFieldValue("SELECTED_FLAG", this.dataBeanFlagValue);
     165    // Set the selected period value in the model.  Need to be careful to not
     166    // overload the UI if dim1 x dim2 x period values > some max value.  If
     167    // that's the case then need to limit to 1 period value and set a flag so
     168    // the UI knows it can't show the all value.
     169    String selectedPeriodDimensionValue = (String)request.getParameter(this.selectedPeriodDimensionValueParameterName);
     170    int allDimensionValuesCombiniations = 1;
     171    if(!StrLib.isSomething(selectedPeriodDimensionValue)) allDimensionValuesCombiniations = periodDimensionValueCollection.size();
     172    allDimensionValuesCombiniations *= (dimension1ValueCollection.size() * dimension2ValueCollection.size());
     173    if((this.maxDimensionValuesCombiniations < allDimensionValuesCombiniations)
     174      && !StrLib.isSomething(selectedPeriodDimensionValue)) {
     175      selectedPeriodDimensionValue = periodDimensionValueCollection.get(0).getStringFieldValue("VALUE");
     176      modelMap.put(this.maxDimensionValueCombinationsExceededModelName, allDimensionValuesCombiniations);
     177    }
     178    modelMap.put(this.periodDimensionValueModelName, selectedPeriodDimensionValue);
     179
     180    // get the existing records
     181    ArrayList<DataBean> datasetRecordCollection = new ArrayList<DataBean>();
     182    DatasetRecord datasetRecord = new DatasetRecord();
     183    datasetRecord.setFieldValue("DATASET_NAME", dataset.getName());
     184    datasetRecord.setFieldValue("DIMENSION_1_NAME", selectedDimension1Name);
     185    datasetRecord.setFieldValue("DIMENSION_2_NAME", selectedDimension2Name);
     186    datasetRecord.setFieldValue("PERIOD_DIMENSION_NAME", periodDimensionName);
     187    if(StrLib.isSomething(selectedPeriodDimensionValue)) datasetRecord.setFieldValue("PERIOD_DIMENSION_VALUE", selectedPeriodDimensionValue);
     188    this.dataBeanDAOService.load(datasetRecordCollection, datasetRecord);
     189
     190    // UI needs a complete matrix of values based on selected dim1, dim2 and
     191    // period.  Manually create the dataset record collection by looping
     192    // through all possible combinations and merging existing records in.
     193    ArrayList<DataBean> allPossibleDatasetRecordCollection = new ArrayList<DataBean>();
     194    for(DataBean databean2 : dimension2ValueCollection) {
     195      for(DataBean databean1 : dimension1ValueCollection) {
     196        for(DataBean periodDatabean : periodDimensionValueCollection) {
     197          DimensionValue periodDimensionValue = (DimensionValue)periodDatabean;
     198          if(!StrLib.isSomething(selectedPeriodDimensionValue) || periodDimensionValue.getValue().equals(selectedPeriodDimensionValue)) {
     199            addDatasetRecord(
     200              dataset,
     201              datasetRecordCollection,
     202              (DimensionValue)databean1,
     203              (DimensionValue)databean2,
     204              periodDimensionValue,
     205              allPossibleDatasetRecordCollection
     206            );
     207          }
    193208        }
    194 
    195         if(dimensionToDataset.isPeriod())
    196           periodDimensionValueCollection.add(dimensionValue);
    197         else if(dimensionToDataset.isDimension1())
    198           dimension1ValueCollection.add(dimensionValue);
    199         else if(dimensionToDataset.isDimension2())
    200           dimension2ValueCollection.add(dimensionValue);
    201209      }
    202210    }
    203 //    modelMap.put(this.dimension1ValueCollectionModelName, dimension1ValueCollection);
    204 //    modelMap.put(this.dimension2ValueCollectionModelName, dimension2ValueCollection);
    205 
    206     modelMap.put(this.datasetRecordCollectionModelName, datasetRecordCollection);
     211    modelMap.put(this.datasetRecordCollectionModelName, allPossibleDatasetRecordCollection);
    207212
    208213    // get the assoc measure (ui uses the title) and put into the model.
     
    218223  /**
    219224   * 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
     225   * dim and puts into the model, loops the dataset's dims and creates a dim
    221226   * collection and puts into the model for the drop down selections.
    222227   *
     
    233238    Map<String,DimensionToDataset> dimensionToDatasetMap,
    234239    ArrayList<DataBean> completeDimensionCollection,
     240    String dimensionUsage,
    235241    String selectedDimensionNameParameterName,
    236     String dimensionUsage,
    237242    String dimensionModeName,
    238243    String dimensionCollectionModelName,
     
    252257      }
    253258    }
    254     if(null == selectedDimension) selectedDimension = dimensionCollection.get(0);
     259    if(null == selectedDimension) {
     260      selectedDimension = dimensionCollection.get(0);
     261      selectedDimensionName = selectedDimension.getName();
     262    }
    255263    modelMap.put(dimensionModeName, selectedDimension);
    256264    modelMap.put(dimensionCollectionModelName, dimensionCollection);
    257265
    258266    return(selectedDimensionName);
    259   } //-------------------------- End of Method ------------------------------
    260  
    261  
    262  
    263  
    264  
    265  
    266  
    267  
    268  
    269  
    270  
    271  
    272   /**
    273    * Helper to delete from the collection/list any dim value not selected.
    274    */
    275   protected void removeAllNonSelectedDimensionValues(ArrayList<DimensionValue> dimensionValueCollection) {
    276     for(int i=dimensionValueCollection.size()-1; i >= 0; i--) {
    277       DimensionValue dimensionValue = dimensionValueCollection.get(i);
    278       if(!dimensionValue.isSelected()) dimensionValueCollection.remove(i);
    279     }
    280267  } //-------------------------- End of Method ------------------------------
    281268
     
    296283 
    297284
    298   /*
    299    * Helper that gets (via looping through the dim value collection) the
    300    * associated dimension value that matches any of the dim record's dim name
    301    * and values.
    302    * @return the assoc dimension value object that matches otherwise null.
    303    */
    304   protected DimensionValue setDatasetRecordDimensionValue(
    305     Collection<DataBean> dimensionRecordCollection,
    306     DimensionValue dimensionValue
     285  /**
     286   * Loads all the active dimension values.
     287   * @param dimensionName
     288   * @return
     289   * @throws Exception
     290   */
     291  protected ArrayList<DataBean> getDimensionValueArrayList(String dimensionName)
     292    throws Exception
     293  {
     294    DimensionValue dimensionValue = new DimensionValue();
     295    dimensionValue.setFieldValue("DIMENSION_NAME", dimensionName);
     296    dimensionValue.setFieldValue("ACTIVE_FLAG", this.dataBeanFlagValue);
     297    ArrayList<DataBean> dimensionValueCollection = new ArrayList<DataBean>();
     298    this.dataBeanDAOService.load(dimensionValueCollection, dimensionValue);
     299    return(dimensionValueCollection);
     300  } //-------------------------- End of Method ------------------------------
     301
     302
     303  protected void addDatasetRecord(
     304    Dataset dataset,
     305    ArrayList<DataBean> datasetRecordCollection,
     306    DimensionValue dimension1Value,
     307    DimensionValue dimension2Value,
     308    DimensionValue periodDimensionValue,
     309    ArrayList<DataBean> allPossibleDatasetRecordCollection
    307310  ) {
    308     boolean found = false;
    309     for(DataBean db: dimensionRecordCollection)
    310     {
    311       DatasetRecord dsr = (DatasetRecord)db;
    312       if(dsr.getDimension1Name().equals(dimensionValue.getDimensionName()) &&
    313         dsr.getDimension1Value().equals(dimensionValue.getValue())
     311    DatasetRecord datasetRecord = new DatasetRecord();
     312    datasetRecord.setFieldValue("DATASET_NAME",      dataset.getName());
     313    datasetRecord.setFieldValue("DIMENSION_1_NAME",  dimension1Value.getDimensionName());
     314    datasetRecord.setFieldValue("DIMENSION_1_VALUE", dimension1Value.getValue());
     315    datasetRecord.setFieldValue("DIMENSION_2_NAME",  dimension2Value.getDimensionName());
     316    datasetRecord.setFieldValue("DIMENSION_2_VALUE", dimension2Value.getValue());
     317    datasetRecord.setFieldValue("PERIOD_DIMENSION_NAME",  periodDimensionValue.getDimensionName());
     318    datasetRecord.setFieldValue("PERIOD_DIMENSION_VALUE", periodDimensionValue.getValue());
     319
     320    // get the existing record...
     321    for(DataBean databean : datasetRecordCollection) {
     322      DatasetRecord dsr = (DatasetRecord)databean;
     323      if(datasetRecord.getDatasetName().equals(dsr.getDatasetName())
     324        && datasetRecord.getDimension1Name().equals(dsr.getDimension1Name())
     325        && datasetRecord.getDimension1Value().equals(dsr.getDimension1Value())
     326        && datasetRecord.getDimension2Name().equals(dsr.getDimension2Name())
     327        && datasetRecord.getDimension2Value().equals(dsr.getDimension2Value())
     328        && datasetRecord.getPeriodDimensionName().equals(dsr.getPeriodDimensionName())
     329        && datasetRecord.getPeriodDimensionValue().equals(dsr.getPeriodDimensionValue())
    314330      ) {
    315         dsr.setFieldValue("DIMENSION_1_TITLE",       dimensionValue.getDimensionTitle());
    316         dsr.setFieldValue("DIMENSION_1_VALUE_TITLE", dimensionValue.getTitle());
    317         found = true;
     331        // if lots of records remove from the collection to help speed up loop.
     332//        if(datasetRecordCollection.size() > 100) datasetRecordCollection.remove(databean);
     333        datasetRecord = dsr;
     334        break;
    318335      }
    319       else if(dsr.getDimension2Name().equals(dimensionValue.getDimensionName()) &&
    320         dsr.getDimension2Value().equals(dimensionValue.getValue())
    321       ) {
    322         dsr.setFieldValue("DIMENSION_2_TITLE",       dimensionValue.getDimensionTitle());
    323         dsr.setFieldValue("DIMENSION_2_VALUE_TITLE", dimensionValue.getTitle());
    324         found = true;
    325       }
    326       else if(dsr.getPeriodDimensionName().equals(dimensionValue.getDimensionName()) &&
    327         dsr.getPeriodDimensionValue().equals(dimensionValue.getValue())
    328       ) {
    329         dsr.setFieldValue("PERIOD_DIMENSION_TITLE",       dimensionValue.getDimensionTitle());
    330         dsr.setFieldValue("PERIOD_DIMENSION_VALUE_TITLE", dimensionValue.getTitle());
    331         found = true;
    332       }
    333       if(found) return(dimensionValue);
    334     }
    335     return(null);
    336   } //-------------------------- End of Method ------------------------------
    337 
    338 
    339   protected Collection<DataBean> getDatasetRecordCollection(
    340     HttpServletRequest request,
    341     Dataset dataset
    342   ) throws Exception {
    343     Collection<DataBean> datasetRecordCollection = new ArrayList<DataBean>();
    344 /*
    345     DatasetRecord datasetRecord = new DatasetRecord();
    346     datasetRecord.setFieldValue("DATASET_NAME", dataset.getName());
    347     this.dataBeanDAOService.load(datasetRecordCollection, datasetRecord);
    348 
    349 
    350 
    351     String periodDimensionName  = (String)modelMap.get(this.periodDimensionNameModelName);
    352     String periodDimensionValue = (String)modelMap.get(this.periodDimensionNameModelName);
    353 
    354     String dimension1NameValue = request.getParameter(this.dimension1NameValueParameterName);
    355     String dimension2NameValue = request.getParameter(this.dimension2NameValueParameterName);
    356     if(groupBy2DimensionValueCollection.size() > 0) {
    357       if(!StrLib.isSomething(groupBy1DimensionName))  groupBy1DimensionName  = groupBy2DimensionValueCollection.get(0).getDimensionName();
    358       if(!StrLib.isSomething(groupBy1DimensionValue)) groupBy1DimensionValue = groupBy2DimensionValueCollection.get(0).getValue();
    359     }
    360     modelMap.put(this.selectedGroupBy1DimensionNameModelName,  groupBy1DimensionName);
    361     modelMap.put(this.selectedGroupBy2DimensionNameModelName, groupBy1DimensionValue);
    362 
    363     // get the selected period dim name from the collection.  This is safe as
    364     // the period dimension collection all have the same dimension name.  Next
    365     // get the selected/requested dim value from the http request param.  If
    366     // not specified then default to the first value in the period collection.
    367     if(!StrLib.isSomething(periodDimensionName)) periodDimensionName = periodDimensionValueCollection.get(0).getDimensionName();
    368     String periodDimensionValue = request.getParameter(this.periodDimensionValueParameterName);
    369     if(!StrLib.isSomething(periodDimensionValue)) periodDimensionValue = periodDimensionValueCollection.get(0).getValue();
    370     modelMap.put(this.selectedPeriodDimensionValueModelName, periodDimensionValue);
    371 
    372     // Determine/set the is period included in the category dim values flag. 
    373     // This is used by the UI to NOT show the period selections if they are
    374     // already included as part of the category values.  Don't need to do this 
    375     // for the series because the category values are the only ones that the
    376     // page lists e.g. if the period is a series it will be held constant and
    377     // stepped through - just like all other series values.
    378     DimensionToDataset dimensionToDataset11111 = new DimensionToDataset();
    379     dimensionToDataset.setFieldValue("DATASET_NAME",    dataset.getName());
    380 dimensionToDataset.setFieldValue("DIMENSION_USAGE", DimensionToDataset.DIMENSION_1_USAGE);
    381     dimensionToDataset.setFieldValue("DIMENSION_NAME",  periodDimensionName);
    382     boolean isPeriodIncludedInCategory = (0 < this.dataBeanDAOService.load(dimensionToDataset));
    383     modelMap.put(this.showPeriodSelectionsModelName, isPeriodIncludedInCategory ? "" : "x");
    384 
    385     // Get the actual category IPVV records (holding series and period constant).
    386     DatasetRecord datasetRecord = new DatasetRecord();
    387     datasetRecord.setFieldValue("DATASET_NAME",           dataset.getName());
    388     datasetRecord.setFieldValue("SERIES_DIMENSION_NAME",  groupBy1DimensionName);
    389     datasetRecord.setFieldValue("SERIES_DIMENSION_VALUE", groupBy1DimensionValue);
    390     if(!isPeriodIncludedInCategory) {
    391       datasetRecord.setFieldValue("PERIOD_DIMENSION_NAME",  periodDimensionName);
    392       datasetRecord.setFieldValue("PERIOD_DIMENSION_VALUE", periodDimensionValue);
    393     }
    394     ArrayList<DataBean> datasetRecordCollection = new ArrayList<DataBean>();
    395     this.dataBeanDAOService.load(datasetRecordCollection, datasetRecord);
    396 
    397     // Loop for all possible category records.  If IVV exists then use otherwise
    398     // create a new black IVV object/row and add to the collection.
    399     ArrayList<DatasetRecord> allPossibleDatasetRecordCollection = new ArrayList<DatasetRecord>();
    400     for(DimensionValue categoryDimensionValue : groupBy1DimensionValueCollection) {
    401 
    402       datasetRecord = null;
    403       for(DatasetRecord dr : (ArrayList<DatasetRecord>)(ArrayList<?>)datasetRecordCollection) {
    404         if(categoryDimensionValue.getDimensionName().equals(dr.getCategoryDimensionName())
    405             && categoryDimensionValue.getValue().equals(dr.getCategoryDimensionValue())
    406         ) {
    407           datasetRecord = dr;
    408           break;
    409         }
    410       }
    411 
    412       // If no existing IVV setup a blank IVV object to be used.
    413       if(null == datasetRecord) {
    414         datasetRecord = new DatasetRecord();
    415         datasetRecord.setFieldValue("DATASET_NAME",             dataset.getName());
    416         datasetRecord.setFieldValue("SERIES_DIMENSION_NAME",    groupBy1DimensionName);
    417         datasetRecord.setFieldValue("SERIES_DIMENSION_VALUE",   groupBy1DimensionValue);
    418         datasetRecord.setFieldValue("CATEGORY_DIMENSION_NAME",  categoryDimensionValue.getDimensionName());
    419         datasetRecord.setFieldValue("CATEGORY_DIMENSION_VALUE", categoryDimensionValue.getValue());
    420         datasetRecord.setFieldValue("PERIOD_DIMENSION_NAME",    periodDimensionName);
    421         datasetRecord.setFieldValue("PERIOD_DIMENSION_VALUE",   periodDimensionValue);
    422       }
    423 
    424       // lastly build the cat dim value title and add the ivv to the collection.
    425       datasetRecord.setFieldValue("CATEGORY_DIMENSION_VALUE_TITLE", categoryDimensionValue.getDimensionTitle() + ": " + categoryDimensionValue.getTitle());
    426       allPossibleDatasetRecordCollection.add(datasetRecord);
    427     }
    428   */ 
    429     return((Collection<DataBean>)datasetRecordCollection);
     336    }
     337
     338    // add the dim and value titles.
     339//    datasetRecord.setFieldValue("DIMENSION_1_TITLE",       dimension1Value.getDimensionTitle());
     340    datasetRecord.setFieldValue("DIMENSION_1_VALUE_TITLE", dimension1Value.getTitle());
     341//    datasetRecord.setFieldValue("DIMENSION_2_TITLE",       dimension2Value.getDimensionTitle());
     342    datasetRecord.setFieldValue("DIMENSION_2_VALUE_TITLE", dimension2Value.getTitle());
     343//    datasetRecord.setFieldValue("PERIOD_DIMENSION_TITLE",  periodDimensionValue.getDimensionTitle());
     344    datasetRecord.setFieldValue("PERIOD_DIMENSION_VALUE_TITLE", periodDimensionValue.getTitle());
     345
     346    allPossibleDatasetRecordCollection.add(datasetRecord);
     347  } //-------------------------- End of Method ------------------------------
     348 
     349 
     350 
     351 
     352  /**
     353   * Helper to delete from the collection/list any dim value not selected.
     354   */
     355  protected void removeAllNonSelectedDimensionValues(ArrayList<DimensionValue> dimensionValueCollection) {
     356    for(int i=dimensionValueCollection.size()-1; i >= 0; i--) {
     357      DimensionValue dimensionValue = dimensionValueCollection.get(i);
     358      if(!dimensionValue.isSelected()) dimensionValueCollection.remove(i);
     359    }
    430360  } //-------------------------- End of Method ------------------------------
    431361
  • trunk/ibisph/src/main/java/org/ibisph/web/springmvc/GetFileController.java

    r11246 r12462  
    2323 */
    2424public class GetFileController extends AbstractController {
    25   protected String requestPathPrefixToRemove = null;
    26   protected Object basePath                  = null;
     25  protected String pathPrefixToRemove = null;
     26  protected Object basePath           = null;
    2727
    2828
     
    3030   * Optional path prefix which specifies the text to remove from the HTTP
    3131   * request's path when determining the path and filename. 
    32    * @param requestPathPrefixToRemove String to be searched for and removed
     32   * @param pathPrefixToRemove String to be searched for and removed
    3333   *   from the request.pathInfo() string.
    3434   */
    35   public void setRequestPathPrefixToRemove(String requestPathPrefixToRemove) {
    36     this.requestPathPrefixToRemove = requestPathPrefixToRemove;
     35  public void setPathPrefixToRemove(String pathPrefixToRemove) {
     36    this.pathPrefixToRemove = pathPrefixToRemove;
    3737  } //-------------------------- End of Method ------------------------------
    3838
     
    7272
    7373    String filePathAndName = request.getRequestURI().substring(request.getContextPath().length());
    74     if(StrLib.isSomething(this.requestPathPrefixToRemove) && filePathAndName.startsWith(requestPathPrefixToRemove)) {
    75       filePathAndName = filePathAndName.substring(requestPathPrefixToRemove.length());
     74    if(StrLib.isSomething(this.pathPrefixToRemove) && filePathAndName.startsWith(this.pathPrefixToRemove)) {
     75      filePathAndName = filePathAndName.substring(this.pathPrefixToRemove.length());
    7676    }
    7777
Note: See TracChangeset for help on using the changeset viewer.