Project

General

Profile

Download (1.12 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2012 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.remote.json.processor.bean;
10

    
11
import java.util.List;
12

    
13
import net.sf.json.JSONObject;
14
import net.sf.json.JsonConfig;
15

    
16
import org.apache.lucene.document.Document;
17
import org.apache.lucene.index.IndexableField;
18

    
19
/**
20
 * @author Andreas Kohlbecker
21
 * @date Jan 6, 2012
22
 *
23
 */
24
public class LuceneDocumentBeanProcessor extends AbstractBeanProcessor<Document> {
25

    
26
    @Override
27
    public List getIgnorePropNames() {
28
        return null;
29
    }
30

    
31
    @Override
32
    public JSONObject processBeanSecondStep(Document document, JSONObject json, JsonConfig jsonConfig) {
33

    
34
        List<IndexableField> fields = document.getFields();
35
        for (IndexableField field : fields) {
36
            // no need to handle multivalued fields, since we don't have these in case of the cdmlib
37
            json.element(field.name(), field.stringValue());
38
        }
39
        return json;
40
    }
41

    
42
}
(10-10/25)