All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dspace.discovery.configuration.DiscoveryConfigurationService Maven / Gradle / Ivy

Go to download

Build Information $Id: pom.xml 5367 2010-09-30 00:30:11Z mdiggory $ $URL: https://scm.dspace.org/svn/repo/modules/dspace-discovery/trunk/provider/pom.xml $

There is a newer version: 1.8.3
Show newest version
/**
 * The contents of this file are subject to the license and copyright
 * detailed in the LICENSE and NOTICE files at the root of the source
 * tree and available online at
 *
 * http://www.dspace.org/license/
 */package org.dspace.discovery.configuration;

import org.dspace.utils.DSpace;

import java.util.List;
import java.util.Map;

/**
 * @author Kevin Van de Velde (kevin at atmire dot com)
 */
public class DiscoveryConfigurationService {

    private Map map;

    public Map getMap() {
        return map;
    }

    public void setMap(Map map) {
        this.map = map;
    }

    public static void main(String[] args) {
        DSpace dspace = new DSpace();
        System.out.println(dspace.getServiceManager().getServicesNames().size());
        DiscoveryConfigurationService mainService = dspace.getServiceManager().getServiceByName(DiscoveryConfigurationService.class.getName(), DiscoveryConfigurationService.class);

        for(String key : mainService.getMap().keySet()){
            System.out.println(key);

            System.out.println("Facets:");
            DiscoveryConfiguration discoveryConfiguration = mainService.getMap().get(key);
            for (int i = 0; i < discoveryConfiguration.getSidebarFacets().size(); i++) {
                SidebarFacetConfiguration sidebarFacet = discoveryConfiguration.getSidebarFacets().get(i);
                System.out.println("\t" + sidebarFacet.getIndexFieldName());
                for (int j = 0; j < sidebarFacet.getMetadataFields().size(); j++) {
                    String metadataField = sidebarFacet.getMetadataFields().get(j);
                    System.out.println("\t\t" + metadataField);
                }
            }

            System.out.println("Search filters");
            List searchFilters = discoveryConfiguration.getSearchFilters();
            for (DiscoverySearchFilter searchFilter : searchFilters) {
                System.out.println("\t" + searchFilter.getIndexFieldName()  + " full: " + searchFilter.isFullAutoComplete());
                for (int i = 0; i < searchFilter.getMetadataFields().size(); i++) {
                    String metadataField = searchFilter.getMetadataFields().get(i);
                    System.out.println("\t\t" + metadataField);
                }

            }

            System.out.println("Recent submissions configuration:");
            DiscoveryRecentSubmissionsConfiguration recentSubmissionConfiguration = discoveryConfiguration.getRecentSubmissionConfiguration();
            System.out.println("\tMetadata sort field: " + recentSubmissionConfiguration.getMetadataSortField());
            System.out.println("\tMax recent submissions: " + recentSubmissionConfiguration.getMax());

            List defaultFilterQueries = discoveryConfiguration.getDefaultFilterQueries();
            if(0 < defaultFilterQueries.size()){
                System.out.println("Default filter queries");
                for (String fq : defaultFilterQueries) {
                    System.out.println("\t" + fq);
                }
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy