Changeset 1007


Ignore:
Timestamp:
12/22/10 13:27:06 (13 years ago)
Author:
patdui
Message:
  • added resourceType facet and added a list of resources on the show result page.
  • added i18n properties
  • fixed some olac facets supporting multiple patterns to match a facet
Location:
vlo/trunk/vlo_webapp
Files:
15 added
25 edited
1 moved

Legend:

Unmodified
Added
Removed
  • vlo/trunk/vlo_webapp/pom.xml

    r996 r1007  
    3838      <version>1.2.14</version>
    3939    </dependency>
    40     <!-- TESTS -->
    4140    <dependency>
    4241      <groupId>junit</groupId>
     
    7473      <version>2.5.6</version>
    7574    </dependency>
    76 
    7775    <dependency>
    7876         <groupId>com.ximpleware</groupId>
     
    9896        <includes>
    9997          <include>**/*.html</include>
     98          <include>**/*.properties</include>
    10099        </includes>
    101100      </resource>
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/Configuration.java

    r770 r1007  
    1212    private final static Configuration INSTANCE = new Configuration();
    1313
     14    public static final String CONFIG_FILE = "applicationContext.xml";
     15
    1416    private String solrUrl;
    1517
     
    1719
    1820    private String[] facetFields;// = new String[] { "origin", "organisation", "continent", "genre", "country", "subject", "language" };
     21
     22    private String handleServerUrl; //"http://hdl.handle.net/"
    1923
    2024    private Configuration() {
     
    5458        this.facetFields = facetFields;
    5559    }
     60
     61    public String getHandleServerUrl() {
     62        return handleServerUrl;
     63    }
     64
     65    public void setHandleServerUrl(String handleServerUrl) {
     66        this.handleServerUrl = handleServerUrl;
     67    }
     68   
     69   
    5670}
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/FacetConstants.java

    r988 r1007  
    1 package eu.clarin.cmdi.vlo.dao;
     1package eu.clarin.cmdi.vlo;
    22
    33public class FacetConstants {
     
    66    public static final String FIELD_ID = "id";
    77    public static final String FIELD_ORIGIN = "origin";
    8     public static final String FIELD_FILENAME = "fileName";
     8    public static final String FIELD_RESOURCE_TYPE = "resourceType";
     9    //The _ facets are not meant to be shown to users.
     10    public static final String FIELD_FILENAME = "_fileName";
     11    public static final String FIELD_RESOURCE = "_resourceRef";
     12    public static final String FIELD_DATA_ROOT = "_dataRoot";
     13   
     14    //Normalized mimeTypes
     15    public static final String RESOURCE_TYPE_AUDIO = "audio";
     16    public static final String RESOURCE_TYPE_VIDEO = "video";
     17    public static final String RESOURCE_TYPE_TEXT = "text";
     18    public static final String RESOURCE_TYPE_IMAGE = "image";
     19    public static final String RESOURCE_TYPE_ANNOTATION = "annotation";
    920
    1021}
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/VloApplication.java

    r759 r1007  
    1717
    1818    public VloApplication() {
    19         BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { "applicationContext.xml" });
     19        BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { Configuration.CONFIG_FILE });
    2020        factory.getBean("configuration"); //Use Configuration.getInstance to get the Configuration just loading the instance here.
    2121        searchResults = new SearchResultsDao();
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/dao/SearchResultsDao.java

    r967 r1007  
    77import org.apache.solr.client.solrj.response.QueryResponse;
    88import org.apache.solr.common.SolrDocumentList;
     9
     10import eu.clarin.cmdi.vlo.FacetConstants;
    911
    1012public class SearchResultsDao extends SolrDao {
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIData.java

    r992 r1007  
    55
    66import org.apache.solr.common.SolrInputDocument;
     7import org.slf4j.Logger;
     8import org.slf4j.LoggerFactory;
    79
    810public class CMDIData {
    9 
     11    private final static Logger LOG = LoggerFactory.getLogger(CMDIData.class);
    1012    private static final String METADATA_TYPE = "Metadata";
     13    private static final String DATA_RESOURCE_TYPE = "Resource";
    1114    private String id;
    12     private List<String> resources = new ArrayList<String>();
     15    private List<Resource> metaDataResources = new ArrayList<Resource>();
    1316    private SolrInputDocument doc;
     17    private List<Resource> dataResources = new ArrayList<Resource>();
    1418
    1519    public SolrInputDocument getSolrDocument() {
     
    3034    }
    3135
    32     public List<String> getResources() {
    33         return resources;
     36    public List<Resource> getDataResources() {
     37        return dataResources;
    3438    }
    3539
    36     public void addResource(String resource, String type) {
     40    public List<Resource> getMetadataResources() {
     41        return metaDataResources;
     42    }
     43
     44    public void addResource(String resource, String type, String mimeType) {
    3745        if (METADATA_TYPE.equals(type)) {
    38             resources.add(resource);
     46            metaDataResources.add(new Resource(resource, mimeType));
     47        } else if (DATA_RESOURCE_TYPE.equals(type)) {
     48            dataResources.add(new Resource(resource, mimeType));
     49        } else {
     50            LOG.warn("Found unsupported resource it will be ignored: type=" + type + ", name=" + resource);
    3951        }
    4052    }
    41 
     53   
    4254    public void setId(String id) {
    4355        this.id = id;
     
    4759        return id;
    4860    }
     61
    4962}
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIDigester.java

    r996 r1007  
    1515
    1616import org.w3c.dom.Document;
     17import org.w3c.dom.NamedNodeMap;
    1718import org.w3c.dom.Node;
    1819import org.w3c.dom.NodeList;
     
    2021import org.xml.sax.SAXException;
    2122
    22 
    2323/**
    24  * @deprecated
    25  * Dom parsing implementation, use the @see CMDIParserVTDXML it is much faster.
    26  * Keeping this for now just in case we run into issues with the vlt parsing.
    27  * patdui 15 December 2010
     24 * @deprecated Dom parsing implementation, use the @see CMDIParserVTDXML it is much faster. Keeping this for now just in case we run into
     25 *             issues with the vlt parsing. patdui 15 December 2010
    2826 */
    2927public class CMDIDigester implements CMDIDataProcessor {
     
    6260            Node resourceNode = nodes.item(i);
    6361            Node ref = (Node) xpath.evaluate("ResourceRef/text()", resourceNode, XPathConstants.NODE);
    64             Node type = (Node) xpath.evaluate("ResourceType/text()", resourceNode, XPathConstants.NODE);
    65             if (ref != null && type != null) {
    66                 result.addResource(ref.getNodeValue(), type.getNodeValue());
     62            Node nodeType = (Node) xpath.evaluate("ResourceType", resourceNode, XPathConstants.NODE);
     63            if (ref != null && nodeType != null) {
     64                String mimeType = null;
     65                NamedNodeMap attributes = nodeType.getAttributes();
     66                if (attributes != null) {
     67                    Node n = attributes.getNamedItem("mimetype");
     68                    if (n != null) {
     69                        mimeType = n.getNodeValue();
     70                    }
     71                }
     72                String type = nodeType.getTextContent();
     73                result.addResource(ref.getNodeValue(), type, mimeType);
    6774            }
    6875        }
     
    7683    private void matchDocumentField(CMDIData result, FacetConfiguration facetConfig, Document doc, XPath xpath)
    7784            throws XPathExpressionException {
    78         NodeList nodes = (NodeList) xpath.evaluate(facetConfig.getPattern(), doc, XPathConstants.NODESET);
     85        List<String> patterns = facetConfig.getPatterns();
     86        for (String pattern : patterns) {
     87            boolean matchedPattern = matchPattern(result, facetConfig, doc, xpath, pattern);
     88            if (matchedPattern) {
     89                break;
     90            }
     91        }
     92    }
     93
     94    private boolean matchPattern(CMDIData result, FacetConfiguration facetConfig, Document doc, XPath xpath, String pattern)
     95            throws XPathExpressionException {
     96        boolean matchedPattern = false;
     97        NodeList nodes = (NodeList) xpath.evaluate(pattern, doc, XPathConstants.NODESET);
    7998        if (nodes != null) {
     99            matchedPattern = true;
    80100            for (int i = 0; i < nodes.getLength(); i++) {
    81101                result.addDocField(facetConfig.getName(), nodes.item(i).getNodeValue(), facetConfig.isCaseInsensitive());
    82102            }
    83103        } // else do nothing it is perfectly acceptable that not all data is in a cmdi file so not everything will be matched. E.G xpath expression evaluation CMDI session files will never match on CMD corpus files.
     104        return matchedPattern;
    84105    }
    85106}
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIParserVTDXML.java

    r996 r1007  
    22
    33import java.io.File;
     4import java.io.FileInputStream;
     5import java.io.IOException;
    46import java.util.List;
    57
     8import org.apache.commons.io.IOUtils;
     9
    610import com.ximpleware.AutoPilot;
    7 import com.ximpleware.NavException;
     11import com.ximpleware.VTDException;
    812import com.ximpleware.VTDGen;
    913import com.ximpleware.VTDNav;
    10 import com.ximpleware.XPathEvalException;
    11 import com.ximpleware.XPathParseException;
    1214
    1315public class CMDIParserVTDXML implements CMDIDataProcessor {
     
    1820    }
    1921
    20     public CMDIData process(File file) throws XPathParseException, XPathEvalException, NavException {
     22    public CMDIData process(File file) throws VTDException, IOException {
    2123        CMDIData result = null;
    2224        VTDGen vg = new VTDGen();
    23             if (vg.parseFile(file.getAbsolutePath(), true)) {
    24                 VTDNav nav = vg.getNav();
    25                 result = new CMDIData();
    26                 AutoPilot id = new AutoPilot(nav);
    27                 id.selectXPath(facetMapping.getIdMapping());
    28                 result.setId(id.evalXPathToString());
    29                 processResources(result, nav);
    30                 processFacets(result, nav);
    31                 return result;
    32             }
     25        vg.setDoc(IOUtils.toByteArray(new FileInputStream(file)));
     26        vg.parse(true);
     27        VTDNav nav = vg.getNav();
     28        result = new CMDIData();
     29        AutoPilot id = new AutoPilot(nav);
     30        id.selectXPath(facetMapping.getIdMapping());
     31        result.setId(id.evalXPathToString());
     32        processResources(result, nav);
     33        processFacets(result, nav);
    3334        return result;
    3435    }
    3536
    36     private void processResources(CMDIData result, VTDNav nav) throws XPathParseException, XPathEvalException, NavException {
     37    private void processResources(CMDIData result, VTDNav nav) throws VTDException {
    3738        AutoPilot resourceProxy = new AutoPilot(nav);
    3839        resourceProxy.selectXPath("/CMD/Resources/ResourceProxyList/ResourceProxy");
     
    4142        AutoPilot resourceType = new AutoPilot(nav);
    4243        resourceType.selectXPath("ResourceType");
     44        AutoPilot resourceMimeType = new AutoPilot(nav);
     45        resourceMimeType.selectXPath("ResourceType/@mimetype");
    4346        while (resourceProxy.evalXPath() != -1) {
    4447            String ref = resourceRef.evalXPathToString();
    4548            String type = resourceType.evalXPathToString();
     49            String mimeType = resourceMimeType.evalXPathToString();
    4650            if (ref != "" && type != "") {
    47                 result.addResource(ref, type);
     51                result.addResource(ref, type, mimeType);
    4852            }
    4953        }
    5054    }
    5155
    52     private void processFacets(CMDIData result, VTDNav nav) throws XPathParseException, XPathEvalException, NavException {
     56    private void processFacets(CMDIData result, VTDNav nav) throws VTDException {
    5357        List<FacetConfiguration> facetList = facetMapping.getFacets();
    5458        for (FacetConfiguration config : facetList) {
    55             AutoPilot ap = new AutoPilot(nav);
    56             ap.selectXPath(config.getPattern());
    57             int index = ap.evalXPath();
    58             while (index != -1) {
    59                 if (nav.getTokenType(index) == VTDNav.TOKEN_ATTR_NAME) {
    60                     //if it is an attribute you need to add 1 to the index to get the right value
    61                     index++;
     59            List<String> patterns = config.getPatterns();
     60            for (String pattern : patterns) {
     61                boolean matchedPattern = matchPattern(result, nav, config, pattern);
     62                if (matchedPattern) {
     63                    break;
    6264                }
    63                 String value = nav.toString(index);
    64                 result.addDocField(config.getName(), value, config.isCaseInsensitive());
    65                 index = ap.evalXPath();
    6665            }
    6766        }
    6867    }
     68
     69    private boolean matchPattern(CMDIData result, VTDNav nav, FacetConfiguration config, String pattern) throws VTDException {
     70        boolean matchedPattern = false;
     71        AutoPilot ap = new AutoPilot(nav);
     72        ap.selectXPath(pattern);
     73        int index = ap.evalXPath();
     74        while (index != -1) {
     75            matchedPattern = true;
     76            if (nav.getTokenType(index) == VTDNav.TOKEN_ATTR_NAME) {
     77                //if it is an attribute you need to add 1 to the index to get the right value
     78                index++;
     79            }
     80            String value = nav.toString(index);
     81            result.addDocField(config.getName(), value, config.isCaseInsensitive());
     82            index = ap.evalXPath();
     83        }
     84        return matchedPattern;
     85    }
    6986}
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/FacetConfiguration.java

    r995 r1007  
    11package eu.clarin.cmdi.vlo.importer;
     2
     3import java.util.ArrayList;
     4import java.util.Collections;
     5import java.util.List;
    26
    37public class FacetConfiguration {
    48
    59    private String name;
    6     private String pattern;
    710    private boolean caseInsensitive= false;
     11    private List<String> patterns = new ArrayList<String>();
    812
    913    public void setCaseInsensitive(boolean caseValue) {
     
    1519    }
    1620
    17     public void setPattern(String pattern) {
    18         this.pattern = pattern;
     21    public void setPatterns(List<String> patterns) {
     22        this.patterns = patterns;
    1923    }
    2024
    21     public String getPattern() {
    22         return pattern;
     25    public void setPattern(String pattern) {
     26        this.patterns = Collections.singletonList(pattern);
     27    }
     28
     29    public List<String> getPatterns() {
     30        return patterns;
    2331    }
    2432
     
    3341    @Override
    3442    public String toString() {
    35         return "name="+name+", pattern="+pattern;
     43        return "name="+name+", pattern="+patterns;
    3644    }
    3745}
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/ImporterConfig.java

    r996 r1007  
    44
    55public class ImporterConfig {
     6
     7    public static final String CONFIG_FILE = "importerConfig.xml";
    68
    79    private boolean deleteAllFirst = false;
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java

    r996 r1007  
    1717import org.springframework.context.support.ClassPathXmlApplicationContext;
    1818
     19import eu.clarin.cmdi.vlo.CommonUtils;
    1920import eu.clarin.cmdi.vlo.Configuration;
    20 import eu.clarin.cmdi.vlo.dao.FacetConstants;
     21import eu.clarin.cmdi.vlo.FacetConstants;
    2122
    2223@SuppressWarnings("serial")
    23 public final class MetadataImporter {
     24public class MetadataImporter {
    2425
    2526    private final static Logger LOG = LoggerFactory.getLogger(MetadataImporter.class);
    2627    private static Throwable serverError;
    27     private final StreamingUpdateSolrServer solrServer;
     28    private StreamingUpdateSolrServer solrServer;
    2829
    2930    private Set<String> processedIds = new HashSet<String>();
    30     private List<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
     31    protected List<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
    3132    private final ImporterConfig config;
    3233
     
    3637    private int nrOfFilesWithoutId = 0;
    3738
    38     public MetadataImporter(ImporterConfig config) throws MalformedURLException {
     39    public MetadataImporter(ImporterConfig config) {
    3940        this.config = config;
    40         String solrUrl = Configuration.getInstance().getSolrUrl();
    41         LOG.info("Initializing Solr Server on " + solrUrl);
    42         solrServer = new StreamingUpdateSolrServer(solrUrl, 1000, 2) {
    43             @Override
    44             public void handleError(Throwable ex) {
    45                 super.handleError(ex);
    46                 serverError = ex;
    47             }
    48         };
    4941    }
    5042
    51     private void startImport() {
     43    void startImport() throws MalformedURLException {
     44        initSolrServer();
    5245        List<DataRoot> dataRoots = config.getDataRoots();
    5346        for (DataRoot dataRoot : dataRoots) {
     
    8679        } finally {
    8780            try {
    88                 solrServer.commit();
     81                if (solrServer != null)
     82                    solrServer.commit();
    8983            } catch (SolrServerException e) {
    9084                LOG.error("cannot commit:\n", e);
     
    9791        LOG.info("Found " + nrOfFilesWithoutId + " file(s) without an id.");
    9892        LOG.info("Update of " + nrOFDocumentsUpdated + " took " + took + " secs. Total nr of files analyzed " + nrOfFilesAnalyzed);
     93    }
     94
     95    protected void initSolrServer() throws MalformedURLException {
     96        String solrUrl = Configuration.getInstance().getSolrUrl();
     97        LOG.info("Initializing Solr Server on " + solrUrl);
     98        solrServer = new StreamingUpdateSolrServer(solrUrl, 1000, 2) {
     99            @Override
     100            public void handleError(Throwable ex) {
     101                super.handleError(ex);
     102                serverError = ex;
     103            }
     104        };
    99105    }
    100106
     
    112118                updateDocument(solrDocument, cmdiData, file, origin);
    113119            }
    114             List<String> resources = cmdiData.getResources();
    115             for (String cmdiResource : resources) {
    116                 File resourceFile = new File(file.getParentFile(), cmdiResource);
     120            List<Resource> resources = cmdiData.getMetadataResources();
     121            for (Resource cmdiResource : resources) {
     122                File resourceFile = new File(file.getParentFile(), cmdiResource.getResourceName());
    117123                if (resourceFile.exists()) {
    118124                    processCmdi(resourceFile, origin, processor);
     
    121127                    LOG.error("Found nonexistent resource file (" + cmdiResource + ") in cmdi: " + file);
    122128                }
    123 
    124129            }
    125130        }
     
    133138        } else {
    134139            solrDocument.addField(FacetConstants.FIELD_ORIGIN, origin);
     140            solrDocument.addField(FacetConstants.FIELD_DATA_ROOT, origin);
    135141            solrDocument.addField(FacetConstants.FIELD_ID, cmdiData.getId());
    136             solrDocument.addField(FacetConstants.FIELD_FILENAME, file.toString());
     142            solrDocument.addField(FacetConstants.FIELD_FILENAME, file.getAbsolutePath());
     143            List<Resource> resources = cmdiData.getDataResources();
     144            for (Resource resource : resources) {
     145                String mimeType = resource.getMimeType();
     146                if (mimeType == null) {
     147                    mimeType = "unknown";
     148                }
     149                solrDocument.addField(FacetConstants.FIELD_RESOURCE_TYPE, CommonUtils.normalizeMimeType(mimeType));
     150                solrDocument.addField(FacetConstants.FIELD_RESOURCE, mimeType + "," + resource.getResourceName());
     151            }
    137152            docs.add(solrDocument);
    138153            if (docs.size() == 1000) {
     
    142157    }
    143158
    144     private void sendDocs() throws SolrServerException, IOException {
     159    protected void sendDocs() throws SolrServerException, IOException {
    145160        LOG.info("Sending " + docs.size() + " docs to solr server. Total number of docs updated till now: " + nrOFDocumentsUpdated);
    146161        nrOFDocumentsUpdated += docs.size();
     
    157172     */
    158173    public static void main(String[] args) throws MalformedURLException {
    159         BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { "applicationContext.xml", "importerConfig.xml" });
     174        BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { Configuration.CONFIG_FILE, ImporterConfig.CONFIG_FILE });
    160175        factory.getBean("configuration");
    161176        ImporterConfig config = (ImporterConfig) factory.getBean("importerConfig", ImporterConfig.class);
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/AlphabeticalPanel.html

    r948 r1007  
    22    <div class="alphaNavigation">
    33        <ul>
    4             <li>Quick navigation to: </li>
     4            <li><wicket:message key="quickNavTo" >[quick navigation]</wicket:message>: </li>
    55            <li wicket:id="alphabeticalView">
    66                <a wicket:id="refLink"><span wicket:id="character">[character]</span></a>
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/BasePage.java

    r949 r1007  
    99    public BasePage(PageParameters parameters) {
    1010        super(parameters);
    11 
     11       
    1212        add(new BookmarkablePageLink("homeLink", FacetedSearchPage.class));
    1313    }
     14   
    1415}
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/DocumentAttributesDataProvider.java

    r750 r1007  
    1010import org.apache.wicket.model.Model;
    1111
    12 import eu.clarin.cmdi.vlo.dao.DaoLocator;
    13 
    1412public class DocumentAttributesDataProvider extends SortableDataProvider<DocumentAttribute> {
    1513
     
    1816    private transient DocumentAttributeList attributeList;
    1917
    20     public DocumentAttributesDataProvider(String docId) {
    21         SolrDocument solrDocument = DaoLocator.getSearchResultsDao().getSolrDocument(docId);
     18    public DocumentAttributesDataProvider(SolrDocument solrDocument) {
    2219        if (solrDocument != null) {
    2320            attributeList = new DocumentAttributeList(solrDocument.getFieldValuesMap());
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/DocumentLinkPanel.java

    r967 r1007  
    77import org.apache.wicket.model.IModel;
    88
    9 import eu.clarin.cmdi.vlo.dao.FacetConstants;
     9import eu.clarin.cmdi.vlo.FacetConstants;
    1010
    1111public class DocumentLinkPanel extends Panel {
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/FacetBoxPanel.html

    r920 r1007  
    1010                        <td width="50%" class="column">
    1111                            <span wicket:id="facetList"> <span wicket:id="facetLinks"></span></span>
    12                             <a href="#" wicket:id="showMore">more...</a>
     12                            <a href="#" wicket:id="showMore"><wicket:message key="more">[more]</wicket:message>...</a>
    1313                        </td>
    1414                    </tr>
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/FacetBoxPanel.java

    r770 r1007  
    55import org.apache.solr.client.solrj.response.FacetField;
    66import org.apache.solr.client.solrj.response.FacetField.Count;
    7 import org.apache.solr.common.SolrDocument;
    87import org.apache.wicket.PageParameters;
    9 import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;
    108import org.apache.wicket.markup.html.WebMarkupContainer;
    119import org.apache.wicket.markup.html.basic.Label;
     
    1816
    1917public class FacetBoxPanel extends Panel {
    20 
     18   
    2119    private static final int MAX_NR_OF_FACET_VALUES = 5;
    2220    private static final long serialVersionUID = 1L;
     
    3129
    3230    @SuppressWarnings("serial")
    33     public FacetBoxPanel create(final SearchPageQuery query, final AjaxFallbackDefaultDataTable<SolrDocument> searchResultList) {
     31    public FacetBoxPanel create(final SearchPageQuery query) {
    3432        final FacetField facetField = (FacetField) getDefaultModelObject();
    3533        facetModel = new FacetModel(facetField);
     
    6361        PageParameters pageParameters = query.getPageParameters();
    6462        pageParameters.add(ShowAllFacetValuesPage.SELECTED_FACET_PARAM, facetField.getName());
    65         add(new BookmarkablePageLink("showMore", ShowAllFacetValuesPage.class, pageParameters) { //TODO PD when nr of facet values is 6 show all instead of 5+more
     63        add(new BookmarkablePageLink("showMore", ShowAllFacetValuesPage.class, pageParameters) {
    6664
    6765            public boolean isVisible() {
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/FacetedSearchPage.html

    r969 r1007  
    1212                            <div id="searchmodule">
    1313                                <input type="text"  wicket:id="searchQuery" />&nbsp;
    14                                 <button wicket:id="searchSubmit">search</button>
     14                                <button wicket:id="searchSubmit"><wicket:message key="search">[search]</wicket:message></button>
    1515                            </div>
    1616                        </form>
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/FacetedSearchPage.java

    r967 r1007  
    2020import org.apache.wicket.model.CompoundPropertyModel;
    2121import org.apache.wicket.model.IModel;
    22 import org.apache.wicket.model.Model;
     22import org.apache.wicket.model.ResourceModel;
     23
     24import eu.clarin.cmdi.vlo.Resources;
    2325
    2426public class FacetedSearchPage extends BasePage {
     
    2628    private static final long serialVersionUID = 1L;
    2729
    28     private AjaxFallbackDefaultDataTable<SolrDocument> searchResultList;
    2930    private SearchPageQuery query;
    3031
     
    7374            @Override
    7475            protected void populateItem(Item<FacetField> item) {
    75                 item.add(new FacetBoxPanel("facetBox", item.getModel()).create(query, searchResultList));
     76                item.add(new FacetBoxPanel("facetBox", item.getModel()).create(query));
    7677            }
    7778
     
    8889    private void addSearchResults() {
    8990        List<IColumn<SolrDocument>> columns = new ArrayList<IColumn<SolrDocument>>();
    90         columns.add(new AbstractColumn<SolrDocument>(new Model<String>("Results")) {
     91        columns.add(new AbstractColumn<SolrDocument>(new ResourceModel(Resources.RESULTS)) {
    9192
    9293            @Override
     
    9596            }
    9697        });
    97         searchResultList = new AjaxFallbackDefaultDataTable("searchResults", columns, new SolrDocumentDataProvider(query.getSolrQuery()
    98                 .getCopy()), 10);
    99        
     98        AjaxFallbackDefaultDataTable<SolrDocument> searchResultList = new AjaxFallbackDefaultDataTable("searchResults", columns,
     99                new SolrDocumentDataProvider(query.getSolrQuery().getCopy()), 10);
     100
    100101        add(searchResultList);
    101102    }
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/SearchPageQuery.java

    r967 r1007  
    1313
    1414import eu.clarin.cmdi.vlo.Configuration;
    15 import eu.clarin.cmdi.vlo.dao.FacetConstants;
     15import eu.clarin.cmdi.vlo.FacetConstants;
    1616
    1717public class SearchPageQuery implements Serializable {
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/ShowAllFacetValuesPage.html

    r940 r1007  
    1111                </tr>
    1212            </table>
    13             <div class="message">Subcategories in <span class="facet" wicket:id="category"></span>:</div>
     13            <div class="message"><wicket:message key="subcategoriesIn">[Subcategories]</wicket:message> <span class="facet" wicket:id="category"></span>:</div>
    1414            <div wicket:id="alphaPanel"></div>
    1515        </div>
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.html

    r967 r1007  
    11<!doctype html public "-//W3C//DTD HTML 3.2 Final//EN">
    22<html>
    3     <head></head>
    4     <body>
    5     <wicket:extend>
    6         <div class="endgame">
    7             <br>
    8             <div><a wicket:id="backLink" href="#">back to results</a>&nbsp;|&nbsp;<a wicket:id="openBrowserLink" href="#">open in original context</a>
    9                 <p />
    10             </div>
    11             <br><br>
    12             <div class="prevNextLabels">
    13                 <a wicket:id="prev">prev</a>
    14                 <a wicket:id="next">next</a>
    15             </div>
    16             <div class="resultAttributes"><table wicket:id="attributesTable"/></div>
    17         </div>
    18     </wicket:extend>
     3<head></head>
     4<body>
     5<wicket:extend>
     6        <div class="endgame"><br>
     7        <div><a wicket:id="backLink" href="#"><wicket:message key="backToResult">[back]</wicket:message></a>&nbsp;|&nbsp;<a wicket:id="openBrowserLink"
     8                href="#"><wicket:message key="openInOriginalContext" >[open]</wicket:message></a>
     9        <p />
     10        </div>
     11        <br>
     12        <br>
     13        <div class="prevNextLabels"><a wicket:id="prev"><wicket:message key="prev" /></a> <a wicket:id="next"><wicket:message key="next" /></a>
     14        </div>
     15        <div class="resultAttributes">
     16        <table wicket:id="attributesTable" />
     17                </div>
     18                <div class="resourceList"><span><wicket:message key="resources">[Resources]</wicket:message>:</span>
     19                <table>
     20                        <tr class="resourceItem" wicket:id="resourceList"></tr>
     21                </table>
     22                </div>
     23                </div>
     24                </wicket:extend>
    1925</body>
    2026</html>
  • vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.java

    r968 r1007  
    11package eu.clarin.cmdi.vlo.pages;
     2
     3import java.util.Collection;
    24
    35import org.apache.solr.common.SolrDocument;
     
    1214import org.apache.wicket.markup.ComponentTag;
    1315import org.apache.wicket.markup.MarkupStream;
     16import org.apache.wicket.markup.html.WebMarkupContainer;
    1417import org.apache.wicket.markup.html.basic.Label;
    1518import org.apache.wicket.markup.html.basic.MultiLineLabel;
     
    1720import org.apache.wicket.markup.html.link.ExternalLink;
    1821import org.apache.wicket.markup.repeater.Item;
     22import org.apache.wicket.markup.repeater.RepeatingView;
    1923import org.apache.wicket.model.IModel;
    20 import org.apache.wicket.model.Model;
     24import org.apache.wicket.model.ResourceModel;
    2125import org.apache.wicket.protocol.http.WicketURLEncoder;
    2226
    2327import eu.clarin.cmdi.vlo.Configuration;
     28import eu.clarin.cmdi.vlo.FacetConstants;
     29import eu.clarin.cmdi.vlo.Resources;
    2430import eu.clarin.cmdi.vlo.StringUtils;
    2531import eu.clarin.cmdi.vlo.dao.DaoLocator;
    26 import eu.clarin.cmdi.vlo.dao.FacetConstants;
    2732
    2833public class ShowResultPage extends BasePage {
     
    3944        add(new ExternalLink("openBrowserLink", Configuration.getInstance().getIMDIBrowserUrl(handle)));
    4045        addPrevNextLabels(docId, query);
    41         addAttributesTable(docId);
     46        SolrDocument solrDocument = DaoLocator.getSearchResultsDao().getSolrDocument(docId);
     47        addAttributesTable(solrDocument);
     48        addResourceLinks(solrDocument);
    4249    }
    4350
    44     private void addAttributesTable(final String docId) {
    45         DocumentAttributesDataProvider attributeProvider = new DocumentAttributesDataProvider(docId);
     51    private void addAttributesTable(final SolrDocument solrDocument) {
     52        DocumentAttributesDataProvider attributeProvider = new DocumentAttributesDataProvider(solrDocument);
    4653        DataTable table = new DataTable("attributesTable", createAttributesColumns(), attributeProvider, 250);
    4754        table.setTableBodyCss("attributesTbody");
     
    5461        IColumn[] columns = new IColumn[2];
    5562
    56         columns[0] = new PropertyColumn(new Model<String>("Field"), "field") {
     63        columns[0] = new PropertyColumn(new ResourceModel(Resources.FIELD), "field") {
    5764
    5865            @Override
     
    6168            }
    6269        };
    63         columns[1] = new AbstractColumn<DocumentAttribute>(new Model<String>("Value")) {
     70        columns[1] = new AbstractColumn<DocumentAttribute>(new ResourceModel(Resources.VALUE)) {
    6471
    6572            @Override
     
    95102            add(prev);
    96103        } else {
    97             add(new Label("prev", "prev"));
     104            add(new WebMarkupContainer("prev"));
    98105        }
    99106        if (index < (docIdList.size() - 1) && index >= 0) {
     
    102109            add(next);
    103110        } else {
    104             add(new Label("next", "next"));
     111            add(new WebMarkupContainer("next"));
     112        }
     113    }
     114
     115    private void addResourceLinks(SolrDocument solrDocument) {
     116        RepeatingView repeatingView = new RepeatingView("resourceList");
     117        add(repeatingView);
     118        if (solrDocument.containsKey(FacetConstants.FIELD_RESOURCE)) {
     119            Collection<Object> resources = solrDocument.getFieldValues(FacetConstants.FIELD_RESOURCE);
     120            for (Object resource : resources) {
     121                String[] split = resource.toString().split(",", 2);
     122                String mimeType = split[0];
     123                String resourceLink = split[1];
     124                repeatingView.add(new ResourceLinkPanel(repeatingView.newChildId(), mimeType, resourceLink));
     125            }
     126        } else {
     127            repeatingView.add(new Label(repeatingView.newChildId(), new ResourceModel(Resources.NO_RESOURCE_FOUND)));
    105128        }
    106129    }
  • vlo/trunk/vlo_webapp/src/main/resources/applicationContext.xml

    r957 r1007  
    88<!--    <property name="solrUrl" value="http://catalog.clarin.eu:8080/vlo_solr" />-->
    99    <property name="IMDIBrowserUrl" value="http://corpus1.mpi.nl/ds/imdi_browser?openpath=" />
     10    <property name="handleServerUrl" value="http://hdl.handle.net/" />   
    1011    <property name="facetFields">
    1112    <!-- The possible values of facets are defined in the schema.xml of the solr_server installation.
     
    2021        <value>subject</value>
    2122        <value>language</value>
     23        <value>resourceType</value>
    2224<!--        <value>year</value>-->
    2325      </list>
  • vlo/trunk/vlo_webapp/src/main/resources/importerConfig.xml

    r996 r1007  
    1111          <property name="originName" value="OLAC Metadata Providers" />
    1212          <property name="rootFile"
    13             value="/Users/patdui/data/snapshots2/olac-cmdi-20101105/_corpusstructure/collection_root.cmdi" />
     13            value="/Users/patdui/data/snapshots2/olac-cmdi-20101214/_corpusstructure/collection_root.cmdi" />
    1414          <property name="facetMapping" ref="olacMapping"></property>
    1515        </bean>
     
    121121        </bean>
    122122        <bean class="eu.clarin.cmdi.vlo.importer.DataRoot">
    123           <property name="originName" value="CLARIN LRT" />
     123          <property name="originName" value="CLARIN LRT inventory" />
    124124          <property name="rootFile"
    125125            value="/Users/patdui/data/snapshots2/lrt-20101117/_corpusstructure/collection_lrt_inventory.cmdi" />
     
    130130  </bean>
    131131
    132   <!--
    133     Mapping of facets to XPATH expressions. The facets should correspond to the facets described in the
    134     solr/conf/schema.xml file of the SOLR Server installation
    135   -->
    136 
    137   <bean id="imdiMapping" class="eu.clarin.cmdi.vlo.importer.FacetMapping"> <!-- add year? -->
     132<!--    Mapping of facets to XPATH expressions. The facets should correspond to the facets described in the-->
     133<!--    solr/conf/schema.xml file of the SOLR Server installation-->
     134
     135  <bean id="imdiMapping" class="eu.clarin.cmdi.vlo.importer.FacetMapping">  <!-- add year? -->
    138136    <property name="idMapping" value="/CMD/Header/MdSelfLink/text()" />
    139137    <property name="facets">
     
    196194        <bean class="eu.clarin.cmdi.vlo.importer.FacetConfiguration">
    197195          <property name="name" value="country" />
    198           <property name="pattern" value="/CMD/Components/OLAC-DcmiTerms/spatial/text()" />
    199           <!--
    200             /CMD/Components/OLAC-DcmiTerms/spatial[@dcterms-type="ISO3166"] -> country
    201             /CMD/Components/OLAC-DcmiTerms/coverage[@dcterms-type="ISO3166"] -> country
    202           -->
     196          <property name="patterns">
     197            <list>
     198                <value>/CMD/Components/OLAC-DcmiTerms/spatial[@dcterms-type="ISO3166"]/text()</value>
     199                <value>/CMD/Components/OLAC-DcmiTerms/coverage[@dcterms-type="ISO3166"]/text()</value>
     200            </list>
     201          </property>
    203202        </bean>
    204203        <bean class="eu.clarin.cmdi.vlo.importer.FacetConfiguration">
    205204          <property name="name" value="language" />
    206           <property name="pattern" value="/CMD/Components/OLAC-DcmiTerms/language/@olac-language" />
     205          <property name="patterns">
     206            <list>
     207                <value>/CMD/Components/OLAC-DcmiTerms/language/@olac-language</value>
     208                <value>/CMD/Components/OLAC-DcmiTerms/subject/@olac-language</value>
     209            </list>
     210          </property>
    207211        </bean>
    208212        <bean class="eu.clarin.cmdi.vlo.importer.FacetConfiguration">
     
    219223          <property name="pattern" value="/CMD/Components/OLAC-DcmiTerms/description/text()" />
    220224        </bean>
    221         <!--
    222           <entry key="continent"> <value>CMD/Components/olac</value> </entry>-->
    223         <!--        <entry key="subject">-->
    224         <!--          <value>CMD/Components/OLAC-DcmiTerms/subject</value> -->
    225         <!-- [@dcterms-type="LCSH"]  -->
    226         <!--        </entry>-->
     225        <bean class="eu.clarin.cmdi.vlo.importer.FacetConfiguration">
     226          <property name="name" value="subject" />
     227          <property name="patterns">
     228            <list>
     229                <value>/CMD/Components/OLAC-DcmiTerms/subject/@olac-linguistic-field</value>
     230                <value>/CMD/Components/OLAC-DcmiTerms/subject[@dcterms-type="LCSH"]/text()</value>
     231            </list>
     232          </property>
     233          <property name="caseInsensitive" value="true" />
     234        </bean>
    227235      </list>
    228236    </property>
  • vlo/trunk/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/importer/CMDIDataProcessorTest.java

    r996 r1007  
    66
    77import java.io.File;
    8 import java.io.IOException;
    98import java.util.ArrayList;
    109import java.util.Collection;
     
    1211import java.util.List;
    1312
    14 import org.apache.commons.io.FileUtils;
    1513import org.apache.solr.common.SolrInputDocument;
    16 import org.junit.AfterClass;
    17 import org.junit.BeforeClass;
    1814import org.junit.Test;
    19 import org.springframework.beans.factory.BeanFactory;
    20 import org.springframework.context.support.ClassPathXmlApplicationContext;
    21 
    22 public class CMDIDataProcessorTest {
    23 
    24     private static File testDir;
     15
     16public class CMDIDataProcessorTest extends ImporterTestcase {
    2517
    2618    private CMDIDataProcessor getDataParser(FacetMapping map) {
     
    7769        CMDIData data = processor.process(cmdiFile);
    7870        assertEquals("test-hdl:1839/00-0000-0000-0000-0001-D", data.getId());
    79         List<String> resources = data.getResources();
     71        List<Resource> resources = data.getMetadataResources();
    8072        assertEquals(3, resources.size());
     73        Resource res = resources.get(0);
     74        assertEquals("../acqui_data/Corpusstructure/acqui.imdi.cmdi", res.getResourceName());
     75        assertEquals(null, res.getMimeType());
     76        assertEquals(0, data.getDataResources().size());
    8177        SolrInputDocument doc = data.getSolrDocument();
    8278        assertNull(doc);
     
    9793        content += "      <ResourceProxyList>\n";
    9894        content += "         <ResourceProxy id=\"d314e408\">\n";
    99         content += "            <ResourceType>Resource</ResourceType>\n";
     95        content += "            <ResourceType mimetype=\"video/x-mpeg1\" >Resource</ResourceType>\n";
    10096        content += "            <ResourceRef>../Media/elan-example1.mpg</ResourceRef>\n";
    10197        content += "         </ResourceProxy>\n";
    10298        content += "         <ResourceProxy id=\"d314e471\">\n";
    103         content += "            <ResourceType>Resource</ResourceType>\n";
    104         content += "            <ResourceRef>../Media/elan-example1.mp4</ResourceRef>\n";
     99        content += "            <ResourceType mimetype=\"audio/mpeg\" >Resource</ResourceType>\n";
     100        content += "            <ResourceRef>../Media/elan-example1.mp3</ResourceRef>\n";
    105101        content += "         </ResourceProxy>\n";
    106102        content += "      </ResourceProxyList>\n";
     
    373369        CMDIData data = processor.process(cmdiFile);
    374370        assertEquals("test-hdl:1839/00-0000-0000-0009-294C-9", data.getId());
    375         List<String> resources = data.getResources();
     371        List<Resource> resources = data.getMetadataResources();
    376372        assertEquals(0, resources.size());
     373        List<Resource> dataResources = data.getDataResources();
     374        assertEquals(2, dataResources.size());
     375        Resource res = dataResources.get(0);
     376        assertEquals("../Media/elan-example1.mpg", res.getResourceName());
     377        assertEquals("video/x-mpeg1", res.getMimeType());
     378        res = dataResources.get(1);
     379        assertEquals("../Media/elan-example1.mp3", res.getResourceName());
     380        assertEquals("audio/mpeg", res.getMimeType());
    377381        SolrInputDocument doc = data.getSolrDocument();
    378382        assertNotNull(doc);
     
    463467        CMDIData data = processor.process(cmdiFile);
    464468        assertEquals("test-hdl:1839/00-0000-0000-0009-294C-9", data.getId());
    465         List<String> resources = data.getResources();
     469        List<Resource> resources = data.getMetadataResources();
    466470        assertEquals(0, resources.size());
    467471        SolrInputDocument doc = data.getSolrDocument();
     
    518522        content += "         <language olac-language=\"x-sil-CHN\"/>\n";
    519523        content += "         <language>Chinese</language>\n";
    520         content += "         <subject>Kuna</subject>\n";
     524        content += "         <subject olac-linguistic-field=\"testSubject\">Kuna</subject>\n";
    521525        content += "         <type olac-linguistic-type=\"Transcription\"/>\n";
    522526        content += "      </OLAC-DcmiTerms>\n";
     
    528532        CMDIData data = processor.process(cmdiFile);
    529533        assertEquals("oai:ailla.utexas.edu:1", data.getId());
    530         List<String> resources = data.getResources();
     534        List<Resource> resources = data.getMetadataResources();
    531535        assertEquals(0, resources.size());
     536        List<Resource> dataResources = data.getDataResources();
     537        assertEquals(0, dataResources.size());
    532538        SolrInputDocument doc = data.getSolrDocument();
    533539        assertNotNull(doc);
    534         assertEquals(3, doc.getFieldNames().size());
     540        assertEquals(4, doc.getFieldNames().size());
    535541        assertEquals(null, doc.getFieldValue("name"));
    536542        assertEquals(null, doc.getFieldValue("continent"));
     
    540546        assertEquals(null, doc.getFieldValue("organisation"));
    541547        assertEquals("transcription", doc.getFieldValue("genre"));
    542         //  assertEquals("Kuna", doc.getFieldValue("subject"));
     548        assertEquals("testsubject", doc.getFieldValue("subject"));
    543549        Collection<Object> fieldValues = doc.getFieldValues("description");
    544550        assertEquals(3, fieldValues.size());
     
    555561                + "Kuna in origin. All are woven together and a moral is provided. Pedro Arias performed "
    556562                + "this story before a gathered audience in the morning..\n      ", descriptions.get(2).toString());
     563    }
     564
     565    @Test
     566    public void testOlacMultiFacets() throws Exception {
     567        String content = "";
     568        content += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     569        content += "<CMD>\n";
     570        content += "   <Components>\n";
     571        content += "      <OLAC-DcmiTerms>\n";
     572        content += "         <subject olac-linguistic-field=\"testSubject\">Kuna</subject>\n";
     573        content += "         <subject dcterms-type=\"LCSH\">testSubjectFallback</subject>\n";
     574        content += "         <spatial dcterms-type=\"ISO3166\">testCountry1</spatial>\n";
     575        content += "         <coverage dcterms-type=\"ISO3166\">testCountry2</coverage>\n";
     576        content += "         <language olac-language=\"language1\">test1</language>\n";
     577        content += "         <subject olac-language=\"language2\">test2</subject>\n";
     578        content += "      </OLAC-DcmiTerms>\n";
     579        content += "   </Components>\n";
     580        content += "</CMD>\n";
     581
     582        File cmdiFile = createCmdiFile("testOlac", content);
     583        CMDIDataProcessor processor = getDataParser(getOlacFacetMap());
     584        CMDIData data = processor.process(cmdiFile);
     585        SolrInputDocument doc = data.getSolrDocument();
     586        assertEquals(1, doc.getFieldValues("subject").size());
     587        assertEquals("testsubject", doc.getFieldValue("subject"));
     588        assertEquals(1, doc.getFieldValues("country").size());
     589        assertEquals("testCountry1", doc.getFieldValue("country"));
     590        assertEquals(1, doc.getFieldValues("language").size());
     591        assertEquals("language1", doc.getFieldValue("language"));
     592
     593        content = "";
     594        content += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     595        content += "<CMD>\n";
     596        content += "   <Components>\n";
     597        content += "      <OLAC-DcmiTerms>\n";
     598        content += "         <subject dcterms-type=\"LCSH\">testSubjectFallback</subject>\n";
     599        content += "         <coverage dcterms-type=\"ISO3166\">testCountry2</coverage>\n";
     600        content += "         <subject olac-language=\"language2\">test2</subject>\n";
     601        content += "      </OLAC-DcmiTerms>\n";
     602        content += "   </Components>\n";
     603        content += "</CMD>\n";
     604
     605        cmdiFile = createCmdiFile("testOlac", content);
     606        processor = getDataParser(getOlacFacetMap());
     607        data = processor.process(cmdiFile);
     608        doc = data.getSolrDocument();
     609        assertEquals(1, doc.getFieldValues("subject").size());
     610        assertEquals("testsubjectfallback", doc.getFieldValue("subject"));
     611        assertEquals(1, doc.getFieldValues("country").size());
     612        assertEquals("testCountry2", doc.getFieldValue("country"));
     613        assertEquals(1, doc.getFieldValues("language").size());
     614        assertEquals("language2", doc.getFieldValue("language"));
     615
     616        content = "";
     617        content += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     618        content += "<CMD>\n";
     619        content += "   <Components>\n";
     620        content += "      <OLAC-DcmiTerms>\n";
     621        content += "         <subject dcterms-type=\"LCSH\">testSubjectFallback</subject>\n";
     622        content += "         <subject olac-linguistic-field=\"testSubject\">Kuna</subject>\n";
     623        content += "         <coverage dcterms-type=\"ISO3166\">testCountry2</coverage>\n";
     624        content += "         <spatial dcterms-type=\"ISO3166\">testCountry1</spatial>\n";
     625        content += "         <subject olac-language=\"language2\">test2</subject>\n";
     626        content += "         <language olac-language=\"language1\">test1</language>\n";
     627        content += "      </OLAC-DcmiTerms>\n";
     628        content += "   </Components>\n";
     629        content += "</CMD>\n";
     630
     631        cmdiFile = createCmdiFile("testOlac", content);
     632        processor = getDataParser(getOlacFacetMap());
     633        data = processor.process(cmdiFile);
     634        doc = data.getSolrDocument();
     635        assertEquals(1, doc.getFieldValues("subject").size());
     636        assertEquals("testsubject", doc.getFieldValue("subject"));
     637        assertEquals(1, doc.getFieldValues("country").size());
     638        assertEquals("testCountry1", doc.getFieldValue("country"));
     639        assertEquals(1, doc.getFieldValues("language").size());
     640        assertEquals("language1", doc.getFieldValue("language"));
    557641    }
    558642
     
    593677        CMDIData data = processor.process(cmdiFile);
    594678        assertEquals("collection_ATILF_Resources.cmdi", data.getId());
    595         List<String> resources = data.getResources();
     679        List<Resource> resources = data.getMetadataResources();
    596680        assertEquals(9, resources.size());
     681        Resource res = resources.get(0);
     682        assertEquals("ATILF_Resources/0/oai_atilf_inalf_fr_0001.xml.cmdi", res.getResourceName());
     683        assertEquals(null, res.getMimeType());
     684        assertEquals(0, data.getDataResources().size());
    597685        SolrInputDocument doc = data.getSolrDocument();
    598686        assertNull(doc);
    599 
     687        List<Resource> dataResources = data.getDataResources();
     688        assertEquals(0, dataResources.size());
    600689    }
    601690
     
    641730        CMDIData data = processor.process(cmdiFile);
    642731        assertEquals("clarin.eu:lrt:433", data.getId());
    643         List<String> resources = data.getResources();
     732        List<Resource> resources = data.getMetadataResources();
    644733        assertEquals(0, resources.size());
     734        List<Resource> dataResources = data.getDataResources();
     735        assertEquals(0, dataResources.size());
    645736        SolrInputDocument doc = data.getSolrDocument();
    646737        assertNotNull(doc);
     
    657748    }
    658749
    659     private FacetMapping getOlacFacetMap() {
    660         BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { "importerConfig.xml" });
    661         FacetMapping facetMapping = (FacetMapping) factory.getBean("olacMapping");
    662         return facetMapping;
    663     }
    664 
    665     private FacetMapping getIMDIFacetMap() {
    666         BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { "importerConfig.xml" });
    667         FacetMapping facetMapping = (FacetMapping) factory.getBean("imdiMapping");
    668         return facetMapping;
    669     }
    670 
    671     private FacetMapping getLrtFacetMap() {
    672         BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { "importerConfig.xml" });
    673         FacetMapping facetMapping = (FacetMapping) factory.getBean("lrtMapping");
    674         return facetMapping;
    675     }
    676 
    677     private File createCmdiFile(String name, String content) throws IOException {
    678         File file = File.createTempFile(name, "cmdi", testDir);
    679         FileUtils.writeStringToFile(file, content, "UTF-8");
    680         return file;
    681     }
    682 
    683     @AfterClass
    684     public static void cleanup() {
    685         FileUtils.deleteQuietly(testDir);
    686     }
    687 
    688     @BeforeClass
    689     public static void setup() {
    690         final String baseTempPath = System.getProperty("java.io.tmpdir");
    691         testDir = new File(baseTempPath + File.separator + "testRegistry_" + System.currentTimeMillis());
    692         testDir.mkdir();
    693         testDir.deleteOnExit();
    694     }
    695 
    696750}
Note: See TracChangeset for help on using the changeset viewer.