Changeset 30678 for main/trunk/gli/src


Ignore:
Timestamp:
2016-08-04T20:56:07+12:00 (8 years ago)
Author:
ak19
Message:

Committing a working version of CollectionConfigXMLReadWrite that preserves Kathy's new key and dictionary elements in displayitems. Will tidy up in a subsequent commit as the code has become repetitive.

Location:
main/trunk/gli/src/org/greenstone/gatherer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfigXMLReadWrite.java

    r29352 r30678  
    9494        {
    9595            Element item = (Element) item_list.get(i);
    96             String text = XMLTools.getNodeText(item);
    97             text = text.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
     96            String text = XMLTools.getNodeText(item);           
    9897
    9998            //If there is nothing to display, don't bother creating the element
    100             if (text == "")
     99            // Either lang or key should be set. If key set, no textnode.
     100            // if lang set, should have textnode. Check if it's meaningful
     101            if (item.hasAttribute(StaticStrings.LANG_STR) && text.equals(""))
    101102            {
    102103                continue;
    103             }
    104             //get the value in 'lang=value'
     104            }       
     105
     106            // get the value in 'lang=langcode' or 'key=keyname'
     107            // We can have either a key attribute (with optional dictionary attribute, else dictionary is implicit)
     108            // OR we can have a lang attr, with the nodetext containing the actual display string.
    105109            String lang = item.getAttribute(StaticStrings.LANG_STR);
     110            String key = item.getAttribute(StaticStrings.KEY_ATTRIBUTE);
    106111
    107112            Element e = to.createElement(StaticStrings.COLLECTIONMETADATA_ELEMENT);
    108113            e.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR);
    109114            e.setAttribute(StaticStrings.NAME_ATTRIBUTE, name_value);
    110             e.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, lang);
    111             XMLTools.setNodeText(e, text);
     115
     116            if(!lang.equals("")) {
     117                e.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, lang);
     118                text = text.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
     119                XMLTools.setNodeText(e, text);
     120               
     121            }
     122
     123            if(!key.equals("")) {
     124                e.setAttribute(StaticStrings.KEY_ATTRIBUTE, key);
     125                String dictionary = item.getAttribute(StaticStrings.DICTIONARY_ATTRIBUTE);
     126                if(!dictionary.equals("")) {
     127                e.setAttribute(StaticStrings.DICTIONARY_ATTRIBUTE, dictionary);
     128                }
     129            }
     130
    112131            display_item_list.add(e);
    113132        }
     
    132151
    133152            //If there is nothing to display, don't bother creating the element
    134             if (text == "")
     153            if (text.equals(""))
    135154            {
    136155                continue;
     
    407426
    408427            if(displayItem != null) {
    409                 String lang_str = displayItem.getAttribute(StaticStrings.LANG_ATTRIBUTE);
    410                
     428
    411429                String name_str = displayItem.getAttribute(StaticStrings.NAME_ATTRIBUTE);
    412                
     430
     431                String lang_str = displayItem.getAttribute(StaticStrings.LANG_ATTRIBUTE);       
    413432                String value_str = XMLTools.getNodeText(displayItem);
    414                
     433
     434                String key_str = displayItem.getAttribute(StaticStrings.KEY_ATTRIBUTE);
     435                String dictionary_str = displayItem.getAttribute(StaticStrings.DICTIONARY_ATTRIBUTE);
     436
    415437                Element displayItem_element = to.createElement(StaticStrings.DISPLAYITEM_ELEMENT); // <DisplayItem> not <displayItem>!
    416438                displayItem_element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR);
     439                if (name_str != null && !name_str.equals(""))
     440                {
     441                    displayItem_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name_str);
     442                }
    417443
    418444                    if (lang_str != null && !lang_str.equals(""))
    419445                {
    420446                    displayItem_element.setAttribute(StaticStrings.LANG_ATTRIBUTE, lang_str);
    421                 }
    422                 if (name_str != null && !name_str.equals(""))
    423                 {
    424                     displayItem_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name_str);
    425447                }
    426448                if (value_str != null && !value_str.equals(""))
     
    429451                    displayItem_element.setAttribute(StaticStrings.VALUE_ATTRIBUTE, value_str);
    430452                }
     453
     454                if (!key_str.equals(""))
     455                {
     456                    displayItem_element.setAttribute(StaticStrings.KEY_ATTRIBUTE, key_str);
     457                }
     458                if (!dictionary_str.equals(""))
     459                {
     460                    displayItem_element.setAttribute(StaticStrings.DICTIONARY_ATTRIBUTE, dictionary_str);
     461                }
     462
    431463                sort_element.appendChild(displayItem_element);
    432464
     
    462494
    463495            if(displayItem != null) {
     496                String name_str = displayItem.getAttribute(StaticStrings.NAME_ATTRIBUTE);
     497
    464498                String lang_str = displayItem.getAttribute(StaticStrings.LANG_ATTRIBUTE);
    465                
    466                 String name_str = displayItem.getAttribute(StaticStrings.NAME_ATTRIBUTE);
    467                
    468499                String value_str = XMLTools.getNodeText(displayItem);
    469500               
     501                String key_str = displayItem.getAttribute(StaticStrings.KEY_ATTRIBUTE);
     502                String dictionary_str = displayItem.getAttribute(StaticStrings.DICTIONARY_ATTRIBUTE);
     503
    470504                Element displayItem_element = to.createElement(StaticStrings.DISPLAYITEM_ELEMENT); // <DisplayItem> not <displayItem>!
    471505                displayItem_element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR);
     506               
     507                if (name_str != null && !name_str.equals(""))
     508                {
     509                    displayItem_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name_str);
     510                }
    472511
    473512                    if (lang_str != null && !lang_str.equals(""))
    474513                {
    475514                    displayItem_element.setAttribute(StaticStrings.LANG_ATTRIBUTE, lang_str);
    476                 }
    477                 if (name_str != null && !name_str.equals(""))
    478                 {
    479                     displayItem_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name_str);
    480515                }
    481516                if (value_str != null && !value_str.equals(""))
     
    483518                    //XMLTools.setNodeText(displayItem_element, value_str);
    484519                    displayItem_element.setAttribute(StaticStrings.VALUE_ATTRIBUTE, value_str);
     520                }
     521
     522                if (!key_str.equals(""))
     523                {
     524                    displayItem_element.setAttribute(StaticStrings.KEY_ATTRIBUTE, key_str);
     525                }
     526                if (!dictionary_str.equals(""))
     527                {
     528                    displayItem_element.setAttribute(StaticStrings.DICTIONARY_ATTRIBUTE, dictionary_str);
    485529                }
    486530                facet_element.appendChild(displayItem_element);
     
    941985                Element item = (Element) displayItem_list.get(j);
    942986                String text = XMLTools.getNodeText(item);
     987
     988                //If there is nothing to display, don't bother creating the element
     989                // Either lang or key should be set. If lang set, then should have textnode.
     990                if (item.hasAttribute(StaticStrings.LANG_STR) && text.equals("")) {
     991                    continue;
     992                }
     993               
    943994                String lang = item.getAttribute(StaticStrings.LANG_ATTRIBUTE);
    944 
    945                 //If there is nothing to display, don't bother creating the element
    946                 if (text == "")
    947                 {
    948                     continue;
    949                 }
     995                String key = item.getAttribute(StaticStrings.KEY_ATTRIBUTE);
     996           
    950997                Element collectionmetadata = to.createElement(StaticStrings.COLLECTIONMETADATA_ELEMENT);
    951998                collectionmetadata.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR);
    952999                collectionmetadata.setAttribute(StaticStrings.NAME_ATTRIBUTE, level_str);
    953                 collectionmetadata.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, lang);
    954                 XMLTools.setNodeText(collectionmetadata, text);
     1000
     1001                if(!lang.equals("")) {
     1002                    collectionmetadata.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, lang);
     1003                    XMLTools.setNodeText(collectionmetadata, text);
     1004                }
     1005               
     1006                if(!key.equals("")) {
     1007                    collectionmetadata.setAttribute(StaticStrings.KEY_ATTRIBUTE, key);
     1008                    String dictionary = item.getAttribute(StaticStrings.DICTIONARY_ATTRIBUTE);
     1009                    if(!dictionary.equals("")) {
     1010                    collectionmetadata.setAttribute(StaticStrings.DICTIONARY_ATTRIBUTE, dictionary);
     1011                    }
     1012                }
    9551013
    9561014                appendProperly(toElement, collectionmetadata);
     
    10031061                Element item = (Element) displayItem_list.get(j);
    10041062                String text = XMLTools.getNodeText(item);
     1063               
     1064
     1065                //If there is nothing to display, don't bother creating the element
     1066                // Either lang or key should be set. If key set, no textnode.
     1067                // if lang set, should have textnode. Check if it's meaningful
     1068                if (item.hasAttribute(StaticStrings.LANG_STR) && text.equals(""))
     1069                {
     1070                    continue;
     1071                }
     1072
    10051073                String lang = item.getAttribute(StaticStrings.LANG_ATTRIBUTE);
    1006 
    1007                 //If there is nothing to display, don't bother creating the element
    1008                 if (text == "")
    1009                 {
    1010                     continue;
    1011                 }
     1074                String key = item.getAttribute(StaticStrings.KEY_ATTRIBUTE);
     1075
    10121076                Element collectionmetadata = to.createElement(StaticStrings.COLLECTIONMETADATA_ELEMENT);
    10131077                collectionmetadata.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR);
    10141078                collectionmetadata.setAttribute(StaticStrings.NAME_ATTRIBUTE, name_str);
    1015                 collectionmetadata.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, lang);
    1016                 XMLTools.setNodeText(collectionmetadata, text);
    1017 
     1079                if(!lang.equals("")) {
     1080                    collectionmetadata.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, lang);
     1081                    XMLTools.setNodeText(collectionmetadata, text);
     1082                }
     1083                if(!key.equals("")) {
     1084                    collectionmetadata.setAttribute(StaticStrings.KEY_ATTRIBUTE, key);
     1085                    String dictionary = item.getAttribute(StaticStrings.DICTIONARY_ATTRIBUTE);
     1086                    if(!dictionary.equals("")) {
     1087                    collectionmetadata.setAttribute(StaticStrings.DICTIONARY_ATTRIBUTE, dictionary);
     1088                    }
     1089                }
     1090               
    10181091                appendProperly(toElement, collectionmetadata);
    10191092            }
     
    10561129                Element item = (Element) displayItem_list.get(j);
    10571130                String text = XMLTools.getNodeText(item);
     1131                //If there is nothing to display, don't bother creating the element
     1132                // Either lang or key should be set. If key set, no textnode.
     1133                // if lang set, should have textnode. Check if it's meaningful
     1134                if (item.hasAttribute(StaticStrings.LANG_STR) && text.equals(""))
     1135                {
     1136                    continue;
     1137                }
     1138
     1139                // get the value in 'lang=langcode' or 'key=keyname'
     1140                // We can have either a key attribute (with optional dictionary attribute, else dictionary is implicit)
     1141                // OR we can have a lang attr, with the nodetext containing the actual display strin.g
    10581142                String lang = item.getAttribute(StaticStrings.LANG_ATTRIBUTE);
    1059 
    1060                 //If there is nothing to display, don't bother creating the element
    1061                 if (text == "")
    1062                 {
    1063                     continue;
    1064                 }
     1143                String key = item.getAttribute(StaticStrings.KEY_ATTRIBUTE);
     1144
     1145
    10651146                Element collectionmetadata = to.createElement(StaticStrings.COLLECTIONMETADATA_ELEMENT);
    10661147                collectionmetadata.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR);
    10671148                collectionmetadata.setAttribute(StaticStrings.NAME_ATTRIBUTE, name_str);
    1068                 collectionmetadata.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, lang);
    1069                 XMLTools.setNodeText(collectionmetadata, text);
     1149
     1150                if(!lang.equals("")) {
     1151                    collectionmetadata.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, lang);
     1152                    XMLTools.setNodeText(collectionmetadata, text);
     1153                }
     1154                if(!key.equals("")) {
     1155                    collectionmetadata.setAttribute(StaticStrings.KEY_ATTRIBUTE, key);
     1156                    String dictionary = item.getAttribute(StaticStrings.DICTIONARY_ATTRIBUTE);
     1157                    if(!dictionary.equals("")) {
     1158                    collectionmetadata.setAttribute(StaticStrings.DICTIONARY_ATTRIBUTE, dictionary);
     1159                    }
     1160                }
    10701161
    10711162                appendProperly(toElement, collectionmetadata);
     
    13881479                String text = XMLTools.getNodeText(e);
    13891480                String lang = e.getAttribute(StaticStrings.LANGUAGE_ATTRIBUTE);
     1481                String key = e.getAttribute(StaticStrings.KEY_ATTRIBUTE);
     1482                String dictionary = e.getAttribute(StaticStrings.DICTIONARY_ATTRIBUTE);
     1483
    13901484                String name_value = e.getAttribute(StaticStrings.NAME_ATTRIBUTE);
    1391 
    13921485                String name_mapping = (String) attributeMap.get(name_value);
    13931486                if (name_mapping != null)
     
    13961489                }
    13971490
    1398                 Element displayItem = constructElement(StaticStrings.DISPLAYITEM_STR, name_value, StaticStrings.LANG_STR, lang, text, to);
     1491                Element displayItem = constructElement(StaticStrings.DISPLAYITEM_STR, name_value, StaticStrings.LANG_STR, lang, text, StaticStrings.KEY_ATTRIBUTE, key, StaticStrings.DICTIONARY_ATTRIBUTE, dictionary, to);
     1492                //Element displayItem = constructDisplayItem(e, to, name_value);
    13991493                displayItemList.appendChild(displayItem);
    14001494            }
     
    14051499
    14061500    // This method creates a DisplayItem element of the type of 'to' by using the ingredients from the element 'e'
    1407     static private Element constructDisplayItem(Element e, Document to)
     1501    static private Element constructDisplayItem(Element e, Document to, String name)
    14081502    {
    14091503        String lang_string = e.getAttribute(StaticStrings.LANGUAGE_ATTRIBUTE);
     1504        String key_string = e.getAttribute(StaticStrings.KEY_ATTRIBUTE);
     1505        String dictionary_string = e.getAttribute(StaticStrings.DICTIONARY_ATTRIBUTE);
    14101506        String text = XMLTools.getNodeText(e);
     1507
    14111508        Element displayItem = to.createElement(StaticStrings.DISPLAYITEM_STR);
    1412         displayItem.setAttribute(StaticStrings.NAME_ATTRIBUTE, StaticStrings.NAME_ATTRIBUTE);
    1413         displayItem.setAttribute(StaticStrings.LANG_STR, lang_string);
    1414         XMLTools.setNodeText(displayItem, text);
     1509        displayItem.setAttribute(StaticStrings.NAME_ATTRIBUTE, name);
     1510
     1511        if(!lang_string.equals("")) {
     1512            displayItem.setAttribute(StaticStrings.LANG_STR, lang_string);
     1513            XMLTools.setNodeText(displayItem, text);
     1514        }
     1515        if(!key_string.equals("")) {
     1516            displayItem.setAttribute(StaticStrings.KEY_ATTRIBUTE, key_string);
     1517            if(!dictionary_string.equals("")) {
     1518            displayItem.setAttribute(StaticStrings.DICTIONARY_ATTRIBUTE, dictionary_string);
     1519            }
     1520        }
    14151521        return displayItem;
     1522    }
     1523
     1524    static private Element constructDisplayItem(Element e, Document to)
     1525    {   
     1526        return constructDisplayItem(e, to, StaticStrings.NAME_ATTRIBUTE);
    14161527    }
    14171528
     
    14521563
    14531564    // This method creates an element with the name 'element_name' of the type of 'to' by using the other three strings
    1454     static private Element constructElement(String element_name, String name_value, String lang_att, String lang_value, String text, Document to)
     1565    static private Element constructElement(String element_name, String name_value, String lang_att, String lang_value, String text, String key_att, String key, String dict_att, String dictionary, Document to)
    14551566    {
    14561567        Element e = to.createElement(element_name);
    14571568        e.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR);
    14581569        e.setAttribute(StaticStrings.NAME_ATTRIBUTE, name_value);
    1459         e.setAttribute(lang_att, lang_value);
    1460         XMLTools.setNodeText(e, text);
     1570
     1571        if(!lang_att.equals("")) {
     1572            e.setAttribute(lang_att, lang_value);
     1573            XMLTools.setNodeText(e, text);
     1574        }       
     1575        if(!key.equals("")) {
     1576            e.setAttribute(key_att, key);
     1577            if(!dictionary.equals("")) {
     1578            e.setAttribute(dict_att, dictionary);
     1579            }
     1580        }
    14611581
    14621582        return e;
     
    22652385                Element displayItem_element = to.createElement(StaticStrings.DISPLAYITEM_STR);//<displayItem>
    22662386               
     2387                String name_str = displayItem.getAttribute(StaticStrings.NAME_ATTRIBUTE);
     2388
     2389                String lang_str = displayItem.getAttribute(StaticStrings.LANG_ATTRIBUTE);   
     2390                String value_str = displayItem.getAttribute(StaticStrings.VALUE_ATTRIBUTE);
     2391
     2392                String key_str = displayItem.getAttribute(StaticStrings.KEY_ATTRIBUTE);
     2393                String dictionary_str = displayItem.getAttribute(StaticStrings.DICTIONARY_ATTRIBUTE);
     2394
     2395                if (name_str != null && !name_str.equals(""))
     2396                    {
     2397                    displayItem_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name_str);
     2398                    }
     2399               
     2400                if (lang_str != null && !lang_str.equals(""))
     2401                    {
     2402                    displayItem_element.setAttribute(StaticStrings.LANG_ATTRIBUTE, lang_str);
     2403                    }
     2404                if (value_str != null && !value_str.equals(""))
     2405                    {
     2406                    XMLTools.setNodeText(displayItem_element, value_str);
     2407                    }
     2408
     2409                if(!key_str.equals("")) {
     2410                    displayItem_element.setAttribute(StaticStrings.KEY_ATTRIBUTE, key_str);
     2411                }
     2412                if(!dictionary_str.equals("")) {
     2413                    displayItem_element.setAttribute(StaticStrings.DICTIONARY_ATTRIBUTE, key_str);
     2414                }
     2415
     2416                sort_ele.appendChild(displayItem_element);
     2417                }
     2418            }
     2419
     2420            search.appendChild(sort_ele);
     2421
     2422        } //for loop on sort_elements ends
     2423
     2424        for (int j = 0; j < facet_elements_length; j++)
     2425        {
     2426            Element facet_element = (Element) facet_elements.item(j);
     2427            if (facet_element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR))
     2428            {
     2429                continue;
     2430            }
     2431
     2432            Element facet_ele = to.createElement(StaticStrings.FACET_LOW_STR);//<facet>
     2433            String name_attr = facet_element.getAttribute(StaticStrings.NAME_ATTRIBUTE);
     2434
     2435            facet_ele.setAttribute(StaticStrings.NAME_ATTRIBUTE, name_attr);
     2436
     2437            // Now constructing 'displayItem' element for this 'facet_ele' element
     2438            Element displayItem = (Element) XMLTools.getChildByTagName(facet_element, StaticStrings.DISPLAYITEM_ELEMENT); // gets the first <DisplayItem> (not <displayItem>!) child of <Facet>
     2439           
     2440            if(displayItem != null) {
     2441                if (displayItem.hasAttribute(StaticStrings.ASSIGNED_ATTRIBUTE) && displayItem.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.TRUE_STR)) {
     2442                Element displayItem_element = to.createElement(StaticStrings.DISPLAYITEM_STR);//<displayItem>
     2443
     2444                String name_str = displayItem.getAttribute(StaticStrings.NAME_ATTRIBUTE);
     2445               
    22672446                String lang_str = displayItem.getAttribute(StaticStrings.LANG_ATTRIBUTE);
    2268                 String name_str = displayItem.getAttribute(StaticStrings.NAME_ATTRIBUTE);
    22692447                String value_str = displayItem.getAttribute(StaticStrings.VALUE_ATTRIBUTE);
    2270                
     2448
     2449                String key_str = displayItem.getAttribute(StaticStrings.KEY_ATTRIBUTE);
     2450                String dictionary_str = displayItem.getAttribute(StaticStrings.DICTIONARY_ATTRIBUTE);
     2451
    22712452                if (lang_str != null && !lang_str.equals(""))
    22722453                    {
     
    22782459                    }
    22792460                if (value_str != null && !value_str.equals(""))
    2280                     {
    2281                     XMLTools.setNodeText(displayItem_element, value_str);
    2282                     }
    2283                 sort_ele.appendChild(displayItem_element);
    2284                 }
    2285             }
    2286 
    2287             search.appendChild(sort_ele);
    2288 
    2289         } //for loop on sort_elements ends
    2290 
    2291         for (int j = 0; j < facet_elements_length; j++)
    2292         {
    2293             Element facet_element = (Element) facet_elements.item(j);
    2294             if (facet_element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR))
    2295             {
    2296                 continue;
    2297             }
    2298 
    2299             Element facet_ele = to.createElement(StaticStrings.FACET_LOW_STR);//<facet>
    2300             String name_attr = facet_element.getAttribute(StaticStrings.NAME_ATTRIBUTE);
    2301 
    2302             facet_ele.setAttribute(StaticStrings.NAME_ATTRIBUTE, name_attr);
    2303 
    2304             // Now constructing 'displayItem' element for this 'facet_ele' element
    2305             Element displayItem = (Element) XMLTools.getChildByTagName(facet_element, StaticStrings.DISPLAYITEM_ELEMENT); // gets the first <DisplayItem> (not <displayItem>!) child of <Facet>
    2306            
    2307             if(displayItem != null) {
    2308                 if (displayItem.hasAttribute(StaticStrings.ASSIGNED_ATTRIBUTE) && displayItem.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.TRUE_STR)) {
    2309                 Element displayItem_element = to.createElement(StaticStrings.DISPLAYITEM_STR);//<displayItem>
    2310                
    2311                 String lang_str = displayItem.getAttribute(StaticStrings.LANG_ATTRIBUTE);
    2312                 String name_str = displayItem.getAttribute(StaticStrings.NAME_ATTRIBUTE);
    2313                 String value_str = displayItem.getAttribute(StaticStrings.VALUE_ATTRIBUTE);
    2314 
    2315                 if (lang_str != null && !lang_str.equals(""))
    2316                     {
    2317                     displayItem_element.setAttribute(StaticStrings.LANG_ATTRIBUTE, lang_str);
    2318                     }
    2319                 if (name_str != null && !name_str.equals(""))
    2320                     {
    2321                     displayItem_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name_str);
    2322                     }
    2323                 if (value_str != null && !value_str.equals(""))
    23242461                {
    23252462                    XMLTools.setNodeText(displayItem_element, value_str);                   
     2463                }
     2464
     2465                if(!key_str.equals("")) {
     2466                    displayItem_element.setAttribute(StaticStrings.KEY_ATTRIBUTE, key_str);
     2467                }
     2468                if(!dictionary_str.equals("")) {
     2469                    displayItem_element.setAttribute(StaticStrings.DICTIONARY_ATTRIBUTE, key_str);
    23262470                }
    23272471                facet_ele.appendChild(displayItem_element);
  • main/trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java

    r29283 r30678  
    9090    static final public String DESCRIPTION_ELEMENT = "Description";
    9191    static final public String DESCRIPTION_STR = "description";
     92    static final public String DICTIONARY_ATTRIBUTE = "dictionary";
    9293    static final public String DIRECTORY_MAPPINGS_ELEMENT = "DirectoryMappings";
    9394    static final public String DISPLAYITEMLIST_STR = "displayItemList";
     
    166167 
    167168    static final public String[] KEEP_PLUG = { "GreenstoneXMLPlugin", "GreenstoneMETSPlugin", "EmbeddedMetadataPlugin" };
     169    static final public String KEY_ATTRIBUTE = "key";
    168170    static final public String LANGUAGE_ARGUMENT = "l=";
    169171    static final public String LANGUAGE_ATTRIBUTE = "language";
Note: See TracChangeset for help on using the changeset viewer.