Changeset 6657


Ignore:
Timestamp:
10/09/15 13:53:06 (9 years ago)
Author:
Twan Goosen
Message:

Merged changes from 3.3 branch (option to skip hierarchy processing) to trunk

Location:
vlo/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • vlo/trunk

  • vlo/trunk/UPGRADE.txt

    r6410 r6657  
    3535prepared for deployment environments at build time, so it is no longer necessary
    3636to copy over old configuration values in all cases.
     37
     38* Decide whether hierarchies should be indexed and displayed, and set the new
     39'processHierarchies' configuration element accordingly (true/false). This
     40governs the behaviour of both the importer (will simply skip the 'update
     41hierarchies' step if set to false) and the front end (will not display hierarchy
     42related UI components).
    3743
    3844* In the context fragment for the VLO web application, ADD the following
  • vlo/trunk/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/LanguageCodeUtils.java

    r6288 r6657  
    151151        } catch (Exception e) {
    152152            if (CommonUtils.SWALLOW_LOOKUP_ERRORS) {
     153                LOG.warn("Ignoring exception", e);
    153154                return new HashMap<String, String>();
    154155            } else {
    155                 throw new RuntimeException("Cannot instantiate postProcessor:", e);
     156                throw new RuntimeException("Cannot instantiate postProcessor. URL: " + url, e);
    156157            }
    157158        }
     
    165166        } catch (Exception e) {
    166167            if (CommonUtils.SWALLOW_LOOKUP_ERRORS) {
     168                LOG.warn("Ignoring exception", e);
    167169                return new HashMap<String, String>();
    168170            } else {
    169                 throw new RuntimeException("Cannot instantiate postProcessor:", e);
     171                throw new RuntimeException("Cannot instantiate postProcessor. URL: " + url, e);
    170172            }
    171173        }
     
    174176    private Map<String, String> createSilToIsoCodeMap() {
    175177        LOG.debug("Creating silToIso code map.");
     178        final String urlString = config.getSilToISO639CodesUrl();
    176179        try {
    177180            Map<String, String> result = new ConcurrentHashMap<String, String>();
    178181            DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
    179182            domFactory.setNamespaceAware(true);
    180             URL url = new URL(config.getSilToISO639CodesUrl());
     183            URL url = new URL(urlString);
    181184            DocumentBuilder builder = domFactory.newDocumentBuilder();
    182185            Document doc = builder.parse(url.openStream());
     
    192195        } catch (Exception e) {
    193196            if (CommonUtils.SWALLOW_LOOKUP_ERRORS) {
     197                LOG.warn("Ignoring exception", e);
    194198                return new HashMap<String, String>();
    195199            } else {
    196                 throw new RuntimeException("Cannot instantiate postProcessor:", e);
     200                throw new RuntimeException("Cannot instantiate postProcessor. URL: " + urlString, e);
    197201            }
    198202        }
  • vlo/trunk/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/config/VloConfig.java

    r6232 r6657  
    109109    private boolean showResultScores = false;
    110110
     111    private boolean processHierarchies = false;
     112
    111113    /**
    112114     * A set of fields to be excluded from display<br><br>
     
    10971099        return showResultScores;
    10981100    }
     1101
     1102    /**
     1103     * Get the value of processHierarchies
     1104     *
     1105     * @return the value of processHierarchies
     1106     */
     1107    public boolean isProcessHierarchies() {
     1108        return processHierarchies;
     1109    }
     1110
     1111    /**
     1112     * Set the value of processHierarchies
     1113     *
     1114     * @param processHierarchies new value of processHierarchies
     1115     */
     1116    public void setProcessHierarchies(boolean processHierarchies) {
     1117        this.processHierarchies = processHierarchies;
     1118    }
    10991119}
  • vlo/trunk/vlo-commons/src/main/resources/VloConfig.xml

    r6483 r6657  
    146146    <!-- makes the score for the result ranking visible in the search results -->
    147147    <showResultScores>false</showResultScores>
     148   
     149    <processHierarchies>false</processHierarchies>
    148150</VloConfig>
  • vlo/trunk/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java

    r6356 r6657  
    166166                    }
    167167                    solrServer.commit();
    168                     updateDocumentHierarchy();
     168                    if(config.isProcessHierarchies()){
     169                        updateDocumentHierarchy();
     170                    }
    169171                }
    170172                LOG.info("End of processing: " + dataRoot.getOriginName());
  • vlo/trunk/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/RecordPage.java

    r6437 r6657  
    2020import eu.clarin.cmdi.vlo.FacetConstants;
    2121import eu.clarin.cmdi.vlo.VloWebAppParameters;
     22import eu.clarin.cmdi.vlo.config.VloConfig;
    2223import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection;
    2324import eu.clarin.cmdi.vlo.pojo.SearchContext;
     
    8687    @SpringBean(name = "documentFieldOrder")
    8788    private List<String> fieldOrder;
     89    @SpringBean
     90    private VloConfig config;
    8891
    8992    private final IModel<SearchContext> navigationModel;
     
    153156        add(createTechnicalDetailsPanel("technicalProperties"));
    154157
    155         add(createHierarchyPanel("recordtree"));
     158        if (config.isProcessHierarchies()) {
     159            // show hierarchy if applicable
     160            add(createHierarchyPanel("recordtree"));
     161        } else {
     162            // invisible stub
     163            add(new WebMarkupContainer("recordtree") {
     164
     165                @Override
     166                public boolean isVisible() {
     167                    return false;
     168                }
     169
     170            });
     171        }
    156172
    157173        createSearchLinks("searchlinks");
  • vlo/trunk/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/AdvancedSearchOptionsPanel.html

    r6315 r6657  
    3131                            <label for="onlyfcs">Only include resources that support content search</label>
    3232                        </li>
    33                         <li>
     33                        <li wicket:id="collectionsSection">
    3434                            <input wicket:id="collection" type="checkbox" id="onlycollections"/>
    3535                            <label for="onlycollections">Only include collection resources</label>
  • vlo/trunk/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/AdvancedSearchOptionsPanel.java

    r6315 r6657  
    1919import com.google.common.collect.ImmutableSet;
    2020import eu.clarin.cmdi.vlo.FacetConstants;
     21import eu.clarin.cmdi.vlo.config.VloConfig;
    2122import eu.clarin.cmdi.vlo.pojo.ExpansionState;
    2223import eu.clarin.cmdi.vlo.pojo.FacetSelection;
     
    2728import eu.clarin.cmdi.vlo.wicket.panels.ExpandablePanel;
    2829import java.util.Collection;
     30import org.apache.wicket.MarkupContainer;
    2931import org.apache.wicket.ajax.AjaxRequestTarget;
    3032import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
     33import org.apache.wicket.markup.html.WebMarkupContainer;
    3134import org.apache.wicket.markup.html.basic.Label;
    3235import org.apache.wicket.markup.html.form.CheckBox;
    3336import org.apache.wicket.markup.html.form.Form;
    3437import org.apache.wicket.model.IModel;
     38import org.apache.wicket.spring.injection.annot.SpringBean;
    3539
    3640/**
     
    4549public abstract class AdvancedSearchOptionsPanel extends ExpandablePanel<QueryFacetsSelection> {
    4650
     51    @SpringBean
     52    private VloConfig config;
     53   
    4754    /**
    4855     * The fields that this panel provides options for
     
    5865        final CheckBox fcsCheck = createFieldNotEmptyOption("fcs", FacetConstants.FIELD_SEARCH_SERVICE);
    5966        options.add(fcsCheck);
     67       
     68        final MarkupContainer collectionsSection = new WebMarkupContainer("collectionsSection");
    6069        final CheckBox collectionCheck = createFieldNotEmptyOption("collection", FacetConstants.FIELD_HAS_PART_COUNT);
    61         options.add(collectionCheck);
     70        collectionsSection.add(collectionCheck);
     71        collectionsSection.setVisible(config.isProcessHierarchies());
     72        options.add(collectionsSection);
     73       
    6274        add(options);
    6375    }
Note: See TracChangeset for help on using the changeset viewer.