Changeset 2828


Ignore:
Timestamp:
04/23/13 13:56:54 (11 years ago)
Author:
keeloo
Message:

Added support for search page type of resources.

Location:
vlo/trunk/vlo_importer/src/main/java/eu/clarin/cmdi/vlo
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • vlo/trunk/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/FacetConstants.java

    r2824 r2828  
    44
    55/**
    6  * A bunch of important constants.
    7  * Constants for each facet, resource types and some urls.
     6 * Definition of facet, resource type and URL constants.
    87 */
    98public class FacetConstants {
     
    3332    public static final String FIELD_CLARIN_PROFILE = "_componentProfile";
    3433    public static final String FIELD_SEARCH_SERVICE = "_contentSearchRef";
     34   
     35    /** Facet constant associated with the landing page type. */
    3536    public static final String FIELD_LANDINGPAGE = "_landingPageRef";
     37    /** Facet constant associated with the search page type. */
     38    public static final String FIELD_SEARCHPAGE = "_searchPageRef";
    3639   
    3740    // PREFIX URL for the language-link   
     
    5053    public static final String FIELD_RESOURCE_SPLIT_CHAR = "|";
    5154    public static final String URN_NBN_PREFIX = "urn:nbn";
    52 
    5355}
  • vlo/trunk/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/Resources.java

    r2787 r2828  
     1
    12package eu.clarin.cmdi.vlo;
    23
    34/**
    4  * Definition of keys to message texts.<br><br>
     5 * Definition of keys to message texts.
    56 *
    67 * Please note that value of a key defined in this class is defined in the
     
    89 * pages that are subject to Wicket, for example:<br><br>
    910 *
    10  * {@literal <div class="resourceList"><span>}
    11  * {@literal    <wicket:message key="resources">[Resources]</wicket:message>:</span>}
    12  * .
    13  * .
    14  * .
     11 * {@literal <div class="resourceList"><span>}<br>
     12 * .<br>
     13 * .<br>
     14 * {@literal <wicket:message key="resources">}<br>
     15 * {@literal [Resources]}<br>
     16 * {@literal </wicket:message>:</span>}<br>
     17 * .<br>
     18 * .<br>
    1519 * {@literal </div>}
    1620 */
     
    2529    public static final String OPEN_IN_ORIGINAL_CONTEXT = "openInOriginalContext";
    2630    public static final String ORIGINAL_CONTEXT_NOT_AVAILABLE = "originalContextNotAvailable"; 
    27 
    28     // keys to text used in labels in the page showing search result
     31   
     32    /** Key to a text on the result page labeling a single landing page. */
    2933    public static final String LANDING_PAGE = "landingPage";   
     34    /** Key to a text on the result page labeling s list of landing pages. */
    3035    public static final String LANDING_PAGES = "landingPages";   
     36    /** Key to a text on the result page labeling a single search page. */
     37    public static final String SEARCH_PAGE = "searchPage";   
     38    /** Key to a text on the result page labeling a list of search pages.*/
     39    public static final String SEARCH_PAGES = "searchPages";   
    3140}
  • vlo/trunk/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIData.java

    r2774 r2828  
    1010
    1111/**
    12  * Represents a document of cmdi data.
    13  * Quite a central class to the metadata importer process.
     12 * Represents a document of CMDI data.
    1413 */
    15 
    1614public class CMDIData {
    1715    private final static Logger LOG = LoggerFactory.getLogger(CMDIData.class);
     
    1917    private static final String DATA_RESOURCE_TYPE = "Resource";
    2018    private static final String SEARCH_SERVICE_TYPE = "SearchService";
     19    //* Definition of the string denoting the landing page type. */
    2120    private static final String LANDING_PAGE_TYPE = "LandingPage";
     21    //* Definition of the string denoting the search page type. */
     22    private static final String SEARCH_PAGE_TYPE = "SearchPage";
    2223
    2324    /**
     
    3637    private final List<Resource> searchResources = new ArrayList<Resource>();
    3738    private final List<Resource> landingPageResources = new ArrayList<Resource>();
     39    private final List<Resource> searchPageResources = new ArrayList<Resource>();
    3840
    3941    public SolrInputDocument getSolrDocument() {
     
    9496
    9597    /**
    96      * Return a list of landing page resources
     98     * Return the list of landing page resources.
     99     *
     100     * @return the list
    97101     */
    98102    public List<Resource> getLandingPageResources() {
    99103        return landingPageResources;
    100104    }
     105   
     106    /**
     107     * Return the  list of search page resources.
     108     *
     109     * @return the list
     110     */
     111    public List<Resource> getSearchPageResources() {
     112        return searchPageResources;
     113    }
    101114
    102115    /**
    103      * Processes a resource by adding it to the internal lists. Supports meta
    104      * data, data, search service and landing page type of resources. Emits a
    105      * warning if another type of resource is encountered (not allowed according
    106      * to the cmdi spec, but we try to be a tad robust).
     116     * Add a meta data resource to the list of resources of that type.
     117     *
     118     * Whenever the type is not one of a type supported by the CMDI
     119     * specification, a warning is logged.
    107120     *
    108      * @param resource
    109      * @param type
    110      * @param mimeType
     121     * @param resource meta data resource
     122     * @param type type of the resource
     123     * @param mimeType mime type associated with the resource
    111124     */
    112125    public void addResource(String resource, String type, String mimeType) {
     
    119132        } else if (LANDING_PAGE_TYPE.equals(type)){
    120133            landingPageResources.add(new Resource(resource,type, mimeType));
     134        } else if (SEARCH_PAGE_TYPE.equals(type)){
     135            searchPageResources.add(new Resource(resource,type, mimeType));
    121136        } else {
    122             LOG.warn("Found unsupported resource it will be ignored: type=" +
     137            LOG.warn("Ignoring unsupported resource type " +
    123138                    type + ", name=" + resource);
    124139        }
  • vlo/trunk/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java

    r2826 r2828  
    310310        }
    311311       
     312        // add search page resource
     313        for (Resource resource : cmdiData.getSearchPageResources()) {
     314            solrDocument.addField(FacetConstants.FIELD_SEARCHPAGE, resource.getResourceName());
     315        }
     316       
    312317        addResourceData(solrDocument, cmdiData);
    313318        docs.add(solrDocument);
Note: See TracChangeset for help on using the changeset viewer.