Project

General

Profile

« Previous | Next » 

Revision 54228

rolled back

View differences:

modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/deploy.info
1
{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-index-client/trunk/", "deploy_repository": "dnet45-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots", "name": "dnet-index-client"}
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/solr/utils/HighlightUtils.java
1
package eu.dnetlib.functionality.index.solr.utils;
2

  
3
import eu.dnetlib.miscutils.functional.UnaryFunction;
4
import org.apache.oro.text.perl.Perl5Util;
5

  
6
public class HighlightUtils implements UnaryFunction<String, String> {
7

  
8
	public final static String DEFAULT_HL_PRE = "[hl]";
9

  
10
	public final static String DEFAULT_HL_POST = "[/hl]";
11

  
12
	private static String CLEAN_HEADER = "s#\\[/?hl\\]##gm";
13
	private static String CLEAN_REGEX_OPEN = "<([^>]*)\\[hl\\]([^>]*)>";
14
	private static String CLEAN_REGEX_CLOSE = "<([^>]*)\\[\\/hl\\]([^>]*)>";
15

  
16
	// private static String CLEAN_REGEX_OPEN = "s#<([^>]*)\\[hl\\]([^>]*)>#<$1$2>#gm";
17
	// private static String CLEAN_REGEX_CLOSE = "s#<([^>]*)\\[\\/hl\\]([^>]*)>#<$1$2>#gm";
18

  
19
	private Perl5Util p5util = new Perl5Util();
20

  
21
	@Override
22
	public String evaluate(final String doc) {
23
		String[] chunk = doc.split("</header>");
24
		String string = cleanHeader(chunk[0]) + "</header>" + cleanBody(chunk[1]);
25
		return string;
26
	}
27

  
28
	private String cleanHeader(final String header) {
29
		return p5util.substitute(CLEAN_HEADER, header);
30
	}
31

  
32
	// TODO: implement a faster way to do this
33
	private String cleanBody(final String body) {
34
		String res = body.replaceAll(CLEAN_REGEX_OPEN, "<$1$2>").replaceAll(CLEAN_REGEX_CLOSE, "<$1$2>");
35

  
36
		if (res.equals(body)) return res;
37

  
38
		return cleanBody(res);
39
	}
40

  
41
}
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/solr/feed/InputDocumentFactory.java
1
package eu.dnetlib.functionality.index.solr.feed;
2

  
3
import java.text.ParseException;
4
import java.text.SimpleDateFormat;
5
import java.util.Arrays;
6
import java.util.List;
7
import javax.xml.stream.XMLStreamException;
8

  
9
import org.apache.solr.common.SolrInputDocument;
10
import org.dom4j.DocumentException;
11

  
12
/**
13
 *
14
 * @author claudio
15
 *
16
 */
17
public abstract class InputDocumentFactory {
18

  
19
	public static final String INDEX_FIELD_PREFIX = "__";
20

  
21
	public static final String DS_VERSION = INDEX_FIELD_PREFIX + "dsversion";
22

  
23
	public static final String DS_ID = INDEX_FIELD_PREFIX + "dsid";
24

  
25
	public static final String RESULT = "result";
26

  
27
	public static final String INDEX_RESULT = INDEX_FIELD_PREFIX + RESULT;
28

  
29
	public static final String INDEX_RECORD_ID = INDEX_FIELD_PREFIX + "indexrecordidentifier";
30

  
31
	private static final String outFormat = new String("yyyy-MM-dd'T'hh:mm:ss'Z'");
32

  
33
	private final static List<String> dateFormats = Arrays.asList("yyyy-MM-dd'T'hh:mm:ss", "yyyy-MM-dd", "dd-MM-yyyy", "dd/MM/yyyy", "yyyy");
34

  
35
	public abstract SolrInputDocument parseDocument(final String version,
36
			final String inputDocument,
37
			final String dsId,
38
			final String resultName) throws XMLStreamException;
39

  
40
	public abstract SolrInputDocument parseDocument(final String version,
41
			final String inputDocument,
42
			final String dsId,
43
			final String resultName,
44
			final ResultTransformer resultTransformer) throws XMLStreamException;
45

  
46
	/**
47
	 * method return a solr-compatible string representation of a date
48
	 *
49
	 * @param date
50
	 * @return the parsed date
51
	 * @throws DocumentException
52
	 * @throws ParseException
53
	 */
54
	public static String getParsedDateField(final String date) {
55
		for (String formatString : dateFormats) {
56
			try {
57
				return new SimpleDateFormat(outFormat).format(new SimpleDateFormat(formatString).parse(date));
58
			} catch (ParseException e) {}
59
		}
60
		throw new IllegalStateException("unable to parse date: " + date);
61
	}
62

  
63
	public String parseDate(final String date) {
64
		return getParsedDateField(date);
65
	}
66

  
67
}
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/solr/feed/StreamingInputDocumentFactory.java
1
package eu.dnetlib.functionality.index.solr.feed;
2

  
3
import java.io.StringReader;
4
import java.io.StringWriter;
5
import java.util.HashMap;
6
import java.util.Iterator;
7
import java.util.List;
8
import javax.xml.stream.*;
9
import javax.xml.stream.events.Namespace;
10
import javax.xml.stream.events.StartElement;
11
import javax.xml.stream.events.XMLEvent;
12

  
13
import com.google.common.collect.Lists;
14
import eu.dnetlib.functionality.index.solr.feed.ResultTransformer.Mode;
15
import org.apache.solr.common.SolrInputDocument;
16

  
17
/**
18
 * Optimized version of the document parser, drop in replacement of InputDocumentFactory.
19
 *
20
 * <p>
21
 * Faster because:
22
 * </p>
23
 * <ul>
24
 * <li>Doesn't create a DOM for the full document</li>
25
 * <li>Doesn't execute xpaths agains the DOM</li>
26
 * <li>Quickly serialize the 'result' element directly in a string.</li>
27
 * <li>Uses less memory: less pressure on GC and allows more threads to process this in parallel</li>
28
 * </ul>
29
 *
30
 * <p>
31
 * This class is fully reentrant and can be invoked in parallel.
32
 * </p>
33
 *
34
 * @author marko
35
 *
36
 */
37
public class StreamingInputDocumentFactory extends InputDocumentFactory {
38

  
39
	protected static final String DEFAULTDNETRESULT = "dnetResult";
40

  
41
	protected static final String TARGETFIELDS = "targetFields";
42

  
43
	protected static final String INDEX_RECORD_ID_ELEMENT = "indexRecordIdentifier";
44

  
45
	protected static final String ROOT_ELEMENT = "indexRecord";
46

  
47
	protected ThreadLocal<XMLInputFactory> inputFactory = new ThreadLocal<XMLInputFactory>() {
48

  
49
		@Override
50
		protected XMLInputFactory initialValue() {
51
			return XMLInputFactory.newInstance();
52
		}
53
	};
54

  
55
	protected ThreadLocal<XMLOutputFactory> outputFactory = new ThreadLocal<XMLOutputFactory>() {
56

  
57
		@Override
58
		protected XMLOutputFactory initialValue() {
59
			return XMLOutputFactory.newInstance();
60
		}
61
	};
62

  
63
	protected ThreadLocal<XMLEventFactory> eventFactory = new ThreadLocal<XMLEventFactory>() {
64

  
65
		@Override
66
		protected XMLEventFactory initialValue() {
67
			return XMLEventFactory.newInstance();
68
		}
69
	};
70

  
71
	@Override
72
	public SolrInputDocument parseDocument(final String version, final String inputDocument, final String dsId, final String resultName)
73
			throws XMLStreamException {
74
		return parseDocument(version, inputDocument, dsId, resultName, null);
75
	}
76

  
77
	@Override
78
	public SolrInputDocument parseDocument(final String version,
79
			final String inputDocument,
80
			final String dsId,
81
			final String resultName,
82
			final ResultTransformer resultTransformer) {
83

  
84
		final StringWriter results = new StringWriter();
85
		final List<Namespace> nsList = Lists.newLinkedList();
86
		try {
87

  
88
			XMLEventReader parser = inputFactory.get().createXMLEventReader(new StringReader(inputDocument));
89

  
90
			final SolrInputDocument indexDocument = new SolrInputDocument(new HashMap<>());
91

  
92
			while (parser.hasNext()) {
93
				final XMLEvent event = parser.nextEvent();
94
				if ((event != null) && event.isStartElement()) {
95
					final String localName = event.asStartElement().getName().getLocalPart();
96

  
97
					if (ROOT_ELEMENT.equals(localName)) {
98
						nsList.addAll(getNamespaces(event));
99
					} else if (INDEX_RECORD_ID_ELEMENT.equals(localName)) {
100
						final XMLEvent text = parser.nextEvent();
101
						String recordId = getText(text);
102
						indexDocument.addField(INDEX_RECORD_ID, recordId);
103
					} else if (TARGETFIELDS.equals(localName)) {
104
						parseTargetFields(indexDocument, parser);
105
					} else if (resultName.equals(localName)) {
106
						if (resultTransformer == null || !(Mode.empty.equals(resultTransformer.getMode()))) {
107
							copyResult(indexDocument, results, parser, nsList, resultName, resultTransformer);
108
						}
109
					}
110
				}
111
			}
112

  
113
			if (version != null) {
114
				indexDocument.addField(DS_VERSION, version);
115
			}
116

  
117
			if (dsId != null) {
118
				indexDocument.addField(DS_ID, dsId);
119
			}
120

  
121
			if (!indexDocument.containsKey(INDEX_RECORD_ID)) {
122
				indexDocument.clear();
123
				System.err.println("missing indexrecord id:\n" + inputDocument);
124
			}
125

  
126
			return indexDocument;
127
		} catch (XMLStreamException e) {
128
			return new SolrInputDocument();
129
		}
130
	}
131

  
132
	private List<Namespace> getNamespaces(final XMLEvent event) {
133
		final List<Namespace> res = Lists.newLinkedList();
134
		@SuppressWarnings("unchecked")
135
		Iterator<Namespace> nsIter = event.asStartElement().getNamespaces();
136
		while (nsIter.hasNext()) {
137
			Namespace ns = nsIter.next();
138
			res.add(ns);
139
		}
140
		return res;
141
	}
142

  
143
	/**
144
	 * Parse the targetFields block and add fields to the solr document.
145
	 *
146
	 * @param indexDocument
147
	 * @param parser
148
	 * @throws XMLStreamException
149
	 */
150
	protected void parseTargetFields(final SolrInputDocument indexDocument, final XMLEventReader parser) throws XMLStreamException {
151

  
152
		boolean hasFields = false;
153

  
154
		while (parser.hasNext()) {
155
			final XMLEvent targetEvent = parser.nextEvent();
156
			if (targetEvent.isEndElement() && targetEvent.asEndElement().getName().getLocalPart().equals(TARGETFIELDS)) {
157
				break;
158
			}
159

  
160
			if (targetEvent.isStartElement()) {
161
				final String fieldName = targetEvent.asStartElement().getName().getLocalPart();
162
				final XMLEvent text = parser.nextEvent();
163

  
164
				String data = getText(text);
165

  
166
				addField(indexDocument, fieldName, data);
167
				hasFields = true;
168
			}
169
		}
170

  
171
		if (!hasFields) {
172
			indexDocument.clear();
173
		}
174
	}
175

  
176
	/**
177
	 * Copy the /indexRecord/result element and children, preserving namespace declarations etc.
178
	 *
179
	 * @param indexDocument
180
	 * @param results
181
	 * @param parser
182
	 * @param nsList
183
	 * @throws XMLStreamException
184
	 */
185
	protected void copyResult(final SolrInputDocument indexDocument,
186
			final StringWriter results,
187
			final XMLEventReader parser,
188
			final List<Namespace> nsList,
189
			final String dnetResult,
190
			final ResultTransformer resultTransformer) throws XMLStreamException {
191
		final XMLEventWriter writer = outputFactory.get().createXMLEventWriter(results);
192

  
193
		for (Namespace ns : nsList) {
194
			eventFactory.get().createNamespace(ns.getPrefix(), ns.getNamespaceURI());
195
		}
196

  
197
		StartElement newRecord = eventFactory.get().createStartElement("", null, RESULT, null, nsList.iterator());
198

  
199
		// new root record
200
		writer.add(newRecord);
201

  
202
		// copy the rest as it is
203
		while (parser.hasNext()) {
204
			final XMLEvent resultEvent = parser.nextEvent();
205

  
206
			// TODO: replace with depth tracking instead of close tag tracking.
207
			if (resultEvent.isEndElement() && resultEvent.asEndElement().getName().getLocalPart().equals(dnetResult)) {
208
				writer.add(eventFactory.get().createEndElement("", null, RESULT));
209
				break;
210
			}
211

  
212
			writer.add(resultEvent);
213
		}
214
		writer.close();
215

  
216
		if (resultTransformer != null) {
217
			indexDocument.addField(INDEX_RESULT, resultTransformer.apply(results.toString()));
218
		} else {
219
			indexDocument.addField(INDEX_RESULT, results.toString());
220
		}
221
	}
222

  
223
	/**
224
	 * Helper used to add a field to a solr doc. It avoids to add empy fields
225
	 *
226
	 * @param indexDocument
227
	 * @param field
228
	 * @param value
229
	 */
230
	private final void addField(final SolrInputDocument indexDocument, final String field, final String value) {
231
		String cleaned = value.trim();
232
		if (!cleaned.isEmpty()) {
233
			// log.info("\n\n adding field " + field.toLowerCase() + " value: " + cleaned + "\n");
234
			indexDocument.addField(field.toLowerCase(), cleaned);
235
		}
236
	}
237

  
238
	/**
239
	 * Helper used to get the string from a text element.
240
	 *
241
	 * @param text
242
	 * @return the
243
	 */
244
	protected final String getText(final XMLEvent text) {
245
		if (text.isEndElement()) // log.warn("skipping because isEndOfElement " + text.asEndElement().getName().getLocalPart());
246
			return "";
247

  
248
		return text.asCharacters().getData();
249
	}
250

  
251
}
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/solr/feed/ResultTransformer.java
1
package eu.dnetlib.functionality.index.solr.feed;
2

  
3
import com.google.common.base.Function;
4

  
5
/**
6
 * Created by claudio on 17/11/15.
7
 */
8
public abstract class ResultTransformer implements Function<String, String> {
9

  
10
	public enum Mode {compress, empty, xslt, base64}
11

  
12
	protected Mode mode;
13

  
14
	public ResultTransformer(final Mode mode) {
15
		this.mode = mode;
16
	}
17

  
18
	public Mode getMode() {
19
		return mode;
20
	}
21

  
22
	public void setMode(final Mode mode) {
23
		this.mode = mode;
24
	}
25

  
26
}
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/solr/cql/SolrTypeBasedCqlValueTransformerMapFactory.java
1
package eu.dnetlib.functionality.index.solr.cql;
2

  
3
import java.util.Map;
4

  
5
import eu.dnetlib.functionality.index.model.Any.ValueType;
6
import eu.dnetlib.miscutils.functional.UnaryFunction;
7
import org.springframework.beans.factory.annotation.Required;
8

  
9
/**
10
 * Factory for the SolrTypeBasedCqlValueTransformerMap class objects
11
 * 
12
 * @author claudio
13
 * 
14
 */
15
public class SolrTypeBasedCqlValueTransformerMapFactory {
16

  
17
	/**
18
	 * Map of functions, injected via spring.
19
	 */
20
	private Map<String, UnaryFunction<String, String>> transformerMap;
21

  
22
	/**
23
	 * Method returns a new instance of SolrTypeBasedCqlValueTransformerMap.
24
	 * 
25
	 * @param schema
26
	 * @return the SolrTypeBasedCqlValueTransformerMap
27
	 */
28
	public SolrTypeBasedCqlValueTransformerMap getIt(final Map<String, ValueType> schema) {
29
		return new SolrTypeBasedCqlValueTransformerMap(schema, getTransformerMap());
30
	}
31

  
32
	@Required
33
	public void setTransformerMap(Map<String, UnaryFunction<String, String>> transformerMap) {
34
		this.transformerMap = transformerMap;
35
	}
36

  
37
	public Map<String, UnaryFunction<String, String>> getTransformerMap() {
38
		return transformerMap;
39
	}
40

  
41
}
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/solr/cql/SimpleDateValueTransformer.java
1
package eu.dnetlib.functionality.index.solr.cql;
2

  
3
import eu.dnetlib.miscutils.functional.UnaryFunction;
4

  
5
/**
6
 * Simply and not very roboust normalizer for solr dates. Basically it handles well yyyy-mm-dd and
7
 * yyyy-mm-ddThh:mm:ssZ
8
 * 
9
 * @author marko
10
 * 
11
 */
12
public class SimpleDateValueTransformer implements UnaryFunction<String, String> {
13
	@Override
14
	public String evaluate(final String value) {
15
		if (!value.endsWith("Z"))
16
			return value + "T00:00:00Z";
17
		return value;
18
	}
19
}
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/solr/cql/SolrTypeBasedCqlValueTransformerMap.java
1
package eu.dnetlib.functionality.index.solr.cql;
2

  
3
import java.util.Map;
4

  
5
import eu.dnetlib.functionality.cql.CqlValueTransformerMap;
6
import eu.dnetlib.functionality.index.model.Any.ValueType;
7
import eu.dnetlib.miscutils.functional.IdentityFunction;
8
import eu.dnetlib.miscutils.functional.UnaryFunction;
9
import org.apache.commons.logging.Log;
10
import org.apache.commons.logging.LogFactory;
11
import org.apache.solr.common.SolrException;
12

  
13
/**
14
 * This class maps the fields in the given index schema with a transformation rule.
15
 * 
16
 * @author marko
17
 * 
18
 */
19
public class SolrTypeBasedCqlValueTransformerMap implements CqlValueTransformerMap {
20

  
21
	/**
22
	 * logger.
23
	 */
24
	private static final Log log = LogFactory.getLog(SolrTypeBasedCqlValueTransformerMap.class); // NOPMD by marko on 11/24/08 5:02 PM
25

  
26
	/**
27
	 * Index schema.
28
	 */
29
	private final Map<String, ValueType> schema;
30

  
31
	/**
32
	 * Map of functions.
33
	 */
34
	private final Map<String, UnaryFunction<String, String>> transformerMap;
35

  
36
	/**
37
	 * Create value transformer map bound to a specific schema
38
	 * @param schema
39
	 * @param transformerMap
40
	 */
41
	public SolrTypeBasedCqlValueTransformerMap(final Map<String, ValueType> schema, final Map<String, UnaryFunction<String, String>> transformerMap) {
42
		this.schema = schema;
43
		this.transformerMap = transformerMap;
44
	}
45

  
46
	/**
47
	 * {@inheritDoc}
48
	 * 
49
	 * @see CqlValueTransformerMap#transformerFor(String)
50
	 */
51
	@Override
52
	public UnaryFunction<String, String> transformerFor(final String fieldName) {
53
		try {
54
			final ValueType field = schema.get(fieldName);
55

  
56
			if (field != null) {
57
				UnaryFunction<String, String> res = transformerMap.get(field.name());
58
				if (res != null) {
59
					return res;
60
				}
61
			}
62
		} catch (SolrException e) {
63
			log.debug("cannot find field", e);
64
		}
65
		return new IdentityFunction<String>();
66
	}
67

  
68
}
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/model/Value.java
1
package eu.dnetlib.functionality.index.model;
2

  
3
import java.util.Date;
4

  
5
/**
6
 * Interface for a value object, used if the any object is of type string, double, boolean, long, date or date time.
7
 */
8
public interface Value extends Any {
9

  
10
	/**
11
	 * @return The string representation
12
	 */
13
	String asString();
14

  
15
	/**
16
	 * @return The double representation, an InvalidValueTypeException is thrown if the value is not a number. If value
17
	 *         is a string then this is tried to be converted to a Double.
18
	 */
19
	Double asDouble();
20

  
21
	/**
22
	 * @return The long representation, an InvalidValueTypeException is thrown if the value is not a number. If value is
23
	 *         a string then this is tried to be converted to a Long.
24
	 */
25
	Long asLong();
26

  
27
	/**
28
	 * @return The boolean representation, an InvalidValueTypeException is thrown if the value is not of type boolean.
29
	 *         If value is a string then this is tried to be converted to a boolean.
30
	 */
31
	Boolean asBoolean();
32

  
33
	/**
34
	 * @return The date representation, an InvalidValueTypeException is thrown if the value is not of type date or
35
	 *         datetime. If value is a string then this is tried to be converted to a date.
36
	 */
37
	Date asDate();
38

  
39
	/**
40
	 * @return The date time representation, an InvalidValueTypeException is thrown if the value is not of type
41
	 *         datetime. If value is a string then this is tried to be converted to a datetime.
42
	 */
43
	Date asDateTime();
44

  
45
	/**
46
	 * @return the value object
47
	 */
48
	Object getObject();
49
}
50 0

  
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/model/util/AnySolrUtil.java
1
package eu.dnetlib.functionality.index.model.util;
2

  
3
import java.util.Iterator;
4
import java.util.Map.Entry;
5

  
6
import eu.dnetlib.functionality.index.model.AnyMap;
7
import eu.dnetlib.functionality.index.model.DataFactory;
8
import eu.dnetlib.functionality.index.model.InvalidValueTypeException;
9
import eu.dnetlib.functionality.index.model.Value;
10
import eu.dnetlib.functionality.index.model.impl.DefaultDataFactoryImpl;
11
import org.apache.solr.common.SolrDocumentList;
12
import org.apache.solr.common.util.NamedList;
13

  
14
/**
15
 * The Class AnySolrUtil.
16
 */
17
public class AnySolrUtil extends AnyUtil {
18

  
19
	/**
20
	 * Convert named list to any map.
21
	 * 
22
	 * @param list
23
	 *            the list
24
	 * @param map
25
	 *            the map
26
	 * @return the any map
27
	 */
28
	@SuppressWarnings("unchecked")
29
	public static AnyMap convertNamedListToAnyMap(final NamedList<Object> list, final AnyMap map) {
30
		final Iterator<Entry<String, Object>> it = list.iterator();
31
		while (it.hasNext()) {
32
			Entry<String, Object> entry = it.next();
33
			final String key = entry.getKey();
34
			final Object obj = entry.getValue();
35
			if (obj instanceof NamedList<?>) {
36
				final AnyMap subMap = map.getMap(key, true);
37
				convertNamedListToAnyMap((NamedList<Object>) obj, subMap);
38
			} else if (obj instanceof SolrDocumentList) {
39
				SolrDocumentList docList = (SolrDocumentList) obj;
40
				AnyMap response = DataFactory.DEFAULT.createAnyMap();
41
				response.put("numFound", docList.getNumFound());
42
				response.put("start", docList.getStart());
43
				response.put("maxScore", docList.getMaxScore());
44
				response.put("docs", objectToAny(obj));
45
				map.put("response", response);
46
			} else {
47
				try {
48
					final Value value = DataFactory.DEFAULT.autoConvertValue(obj);
49
					map.put(key, value);
50
				} catch (InvalidValueTypeException exception) {
51
					; // skip
52
				}
53
			}
54
		}
55
		return map;
56
	}
57

  
58
	/**
59
	 * Convert named list to any map.
60
	 * 
61
	 * @param list
62
	 *            the list
63
	 * @return the any map
64
	 */
65
	public static AnyMap convertNamedListToAnyMap(final NamedList<Object> list) {
66
		return convertNamedListToAnyMap(list, DefaultDataFactoryImpl.INSTANCE.createAnyMap());
67
	}
68

  
69
}
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/model/util/AnyUtil.java
1
package eu.dnetlib.functionality.index.model.util;
2

  
3
import java.util.ArrayList;
4
import java.util.Arrays;
5
import java.util.Collection;
6
import java.util.Date;
7
import java.util.HashSet;
8
import java.util.Iterator;
9
import java.util.LinkedHashMap;
10
import java.util.Map;
11
import java.util.Map.Entry;
12
import java.util.Properties;
13
import java.util.Set;
14

  
15
import eu.dnetlib.functionality.index.model.Any;
16
import eu.dnetlib.functionality.index.model.AnyMap;
17
import eu.dnetlib.functionality.index.model.AnySeq;
18
import eu.dnetlib.functionality.index.model.DataFactory;
19
import eu.dnetlib.functionality.index.model.Value;
20
import eu.dnetlib.functionality.index.model.impl.DefaultDataFactoryImpl;
21

  
22
/**
23
 * utility class for handling / conversion of Any objects.
24
 *
25
 * Hint: The Any-to-JSON conversion for Date(Time)s is not symmetric. If the Any object contains Date(Time) values, they will be serialized
26
 * to String values in simple timestamp format. But when parsing JSON to an Any object, Date(Time) strings will not be recognized anymore,
27
 * but just read as String values.
28
 */
29
public class AnyUtil {
30

  
31
	/** Immutable empty AnyMap instance. */
32
	public static final AnyMap EMPTY_MAP = DefaultDataFactoryImpl.IMMUTABLE_EMPTY_MAP;
33

  
34
	/**
35
	 * prevent instance creation.
36
	 */
37
	protected AnyUtil() {
38
		// prevent instance creation
39
	}
40

  
41
	/**
42
	 * Converts an Any object into a native java object.
43
	 *
44
	 * @param any
45
	 *            the Any object
46
	 * @return a Pojo
47
	 */
48
	public static Object anyToNative(final Any any) {
49
		if (any.isMap()) {
50
			final LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>();
51
			for (final Iterator<String> kIt = ((AnyMap) any).keySet().iterator(); kIt.hasNext();) {
52
				final String key = kIt.next();
53
				map.put(key, anyToNative(((AnyMap) any).get(key)));
54
			}
55
			return map;
56
		} else if (any.isSeq()) {
57
			final ArrayList<Object> list = new ArrayList<Object>();
58
			for (final Iterator<Any> aIt = any.iterator(); aIt.hasNext();) {
59
				final Any a = aIt.next();
60
				list.add(anyToNative(a));
61
			}
62
			return list;
63
		} else if (any.isString()) return ((Value) any).asString();
64
		else if (any.isLong()) return ((Value) any).asLong();
65
		else if (any.isDouble()) return ((Value) any).asDouble();
66
		else if (any.isBoolean()) return ((Value) any).asBoolean();
67
		else if (any.isDate()) return ((Value) any).asDate();
68
		else if (any.isDateTime()) return ((Value) any).asDateTime();
69
		else return ((Value) any).getObject();
70
	}
71

  
72
	/**
73
	 * Converts an object to an Any (recursively). The leaf object(s) must be convertable by {@link DataFactory#autoConvertValue(Object)}.
74
	 *
75
	 * @param object
76
	 *            The object to be converted. Supported (and tested in this order) are
77
	 *            <ul>
78
	 *            <li>{@code Map<String, Object>}
79
	 *            <li>{@code Collections<Object>}
80
	 *            <li>{@code Object[]}
81
	 *            <li>Any other object that can be {@link DataFactory#autoConvertValue(Object)}</li>
82
	 *            </ul>
83
	 *
84
	 * @return The converted Any
85
	 */
86
	@SuppressWarnings("unchecked")
87
	public static Any objectToAny(final Object object) {
88
		Any value = null;
89
		if (object instanceof Any) return (Any) object;
90
		else if (object instanceof Map<?, ?>) {
91
			value = mapToAny((Map<String, Object>) object);
92
		} else if (object instanceof Collection<?>) {
93
			value = collectionToAny((Collection<Object>) object);
94
		} else if (object.getClass().isArray()) {
95
			Object[] array = (Object[]) object;
96
			value = collectionToAny(Arrays.asList(array));
97
		} else {
98
			value = scalarObjectToAny(object);
99
		}
100
		return value;
101
	}
102

  
103
	/**
104
	 * Converts a collection to an AnySeq object.
105
	 *
106
	 * @param objects
107
	 *            The list of objects to convert.
108
	 * @return An AnySeq containing the objects as Any objects.
109
	 */
110
	private static AnySeq collectionToAny(final Collection<Object> objects) {
111
		AnySeq anySeq = null;
112
		if (objects != null) {
113
			anySeq = DataFactory.DEFAULT.createAnySeq();
114
			for (final Object obj : objects) {
115
				anySeq.add(objectToAny(obj));
116
			}
117
		}
118
		return anySeq;
119
	}
120

  
121
	/**
122
	 * Converts a scalar object to a Value object.
123
	 *
124
	 * @param obj
125
	 *            The object to convert.
126
	 * @return A Value representing the object.
127
	 */
128
	private static Any scalarObjectToAny(final Object obj) {
129
		return DataFactory.DEFAULT.autoConvertValue(obj);
130
	}
131

  
132
	/**
133
	 * Converts a map to an AnyMap object.
134
	 *
135
	 * @param map
136
	 *            The map (String to Object) to convert.
137
	 * @return An AnyMap representing the map with all Objects converted to Any.
138
	 */
139
	private static AnyMap mapToAny(final Map<String, Object> map) {
140
		AnyMap anyMap = null;
141
		if (map != null) {
142
			anyMap = DataFactory.DEFAULT.createAnyMap();
143
			for (final Entry<String, Object> entry : map.entrySet()) {
144
				anyMap.put(entry.getKey(), objectToAny(entry.getValue()));
145
			}
146
		}
147
		return anyMap;
148
	}
149

  
150
	/**
151
	 * get value for given path(list of keys) from AnyMap object. This methods throws no exception, if the path not exists an empty Any is
152
	 * the result.
153
	 *
154
	 * @param any
155
	 *            the Any object.
156
	 * @param path
157
	 *            path to the entry.
158
	 * @return value associated to the path.
159
	 */
160
	public static Any saveGet(final Any any, final String[] path) {
161
		if (path.length == 0) return DataFactory.DEFAULT.createAnyMap();
162
		try {
163
			Any current = any;
164
			for (final String key : path) {
165
				if (current.isMap()) {
166
					current = ((AnyMap) current).get(key);
167
				} else {
168
					current = null;
169
				}
170
			}
171
			if (current == null) return DataFactory.DEFAULT.createStringValue("undef");
172
			else return current;
173
		} catch (final Exception e) {
174
			return DataFactory.DEFAULT.createStringValue("undef");
175
		}
176
	}
177

  
178
	/**
179
	 * convert an exception to an any object.
180
	 *
181
	 * @param e
182
	 *            exception to convert
183
	 * @return any representation of exception
184
	 */
185
	public static AnyMap exceptionToAny(final Throwable e) {
186
		return exceptionToAny(e, new HashSet<String>());
187
	}
188

  
189
	/**
190
	 * convert an exception to an any object. stop in stacktrace printing when hitting known lines again.
191
	 *
192
	 * @param e
193
	 *            exception to convert
194
	 * @param visitedLines
195
	 *            lines that have been added to stacktraces before.
196
	 * @return any representation of exception
197
	 */
198
	private static AnyMap exceptionToAny(final Throwable e, final Collection<String> visitedLines) {
199
		final AnyMap any = DataFactory.DEFAULT.createAnyMap();
200
		any.put("type", e.getClass().getName());
201
		if (e.getMessage() != null) {
202
			any.put("message", e.getMessage());
203
		}
204
		final AnySeq st = DataFactory.DEFAULT.createAnySeq();
205
		for (final StackTraceElement stElement : e.getStackTrace()) {
206
			final String line = stElement.toString();
207
			st.add(line);
208
			if (!visitedLines.add(line)) {
209
				st.add("...");
210
				break;
211
			}
212
		}
213
		any.put("at", st);
214
		if ((e.getCause() != null) && (e.getCause() != e)) {
215
			any.put("causedBy", exceptionToAny(e.getCause(), visitedLines));
216
		}
217
		return any;
218
	}
219

  
220
	/**
221
	 * null save version.
222
	 */
223
	public static Double asDouble(final Any any) {
224
		return any == null ? null : any.asValue().asDouble();
225
	};
226

  
227
	/**
228
	 * null save version.
229
	 */
230
	public static Boolean asBoolean(final Any any) {
231
		return any == null ? null : any.asValue().asBoolean();
232
	};
233

  
234
	/**
235
	 * null save version.
236
	 */
237
	public static Date asDateTime(final Any any) {
238
		return any == null ? null : any.asValue().asDateTime();
239
	};
240

  
241
	/**
242
	 * null save version.
243
	 */
244
	public static Date asDate(final Any any) {
245
		return any == null ? null : any.asValue().asDate();
246
	};
247

  
248
	/**
249
	 * null save version.
250
	 */
251
	public static Long asLong(final Any any) {
252
		return any == null ? null : any.asValue().asLong();
253
	};
254

  
255
	/**
256
	 * null save version.
257
	 */
258
	public static String asString(final Any any) {
259
		return any == null ? null : any.asValue().asString();
260
	};
261

  
262
	/**
263
	 * null save version.
264
	 */
265
	public static AnyMap asMap(final Any any) {
266
		return any == null ? null : any.asMap();
267
	};
268

  
269
	/**
270
	 * null save version.
271
	 */
272
	public static AnySeq asSeq(final Any any) {
273
		return any == null ? null : any.asSeq();
274
	};
275

  
276
	/** convert AnyMap to java.util.Properties. */
277
	public static Properties anyToProperties(final AnyMap anyMap) {
278
		Properties props = new Properties();
279
		final Set<String> keySet = anyMap.keySet();
280
		for (final String key : keySet) {
281
			props.put(key, anyMap.get(key).toString());
282
		}
283
		return props;
284
	}
285

  
286
	/** convert java.util.Properties to AnyMap. */
287
	public static AnyMap propertiesToAny(final Properties props) {
288
		final AnyMap any = DataFactory.DEFAULT.createAnyMap();
289
		final Set<String> propNames = props.stringPropertyNames();
290
		for (final String prop : propNames) {
291
			any.put(prop, props.getProperty(prop));
292
		}
293
		return any;
294
	}
295

  
296
	/**
297
	 * returns the 1st map in the give SEQ that contains a value with the given name value, or null if not found.
298
	 *
299
	 * This is often useful for configs that are contained in a seq such as search filters.
300
	 *
301
	 * @since 1.1
302
	 */
303
	public static AnyMap findMapInSeq(final AnySeq seq, final String keyName, final String keyValue) {
304
		for (Any any : seq) {
305
			final String stringValue = any.asMap().getStringValue(keyName);
306
			if (keyValue.equals(stringValue)) return any.asMap();
307
		}
308
		return null;
309
	}
310
}
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/model/document/Status.java
1
package eu.dnetlib.functionality.index.model.document;
2

  
3
/**
4
 * Possible IndexDocument Status.
5
 */
6
public enum Status {
7

  
8
	/** The marked. */
9
	MARKED,
10
	/** The error. */
11
	ERROR,
12
	/** The ok. */
13
	OK
14
}
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/model/document/IndexDocument.java
1
package eu.dnetlib.functionality.index.model.document;
2

  
3
import java.util.Collection;
4

  
5
/**
6
 * The Interface IndexDocument.
7
 */
8
public interface IndexDocument {
9

  
10
	/**
11
	 * Adds a field with the given name, value and boost. If a field with the name already exists, then the given value is appended to the
12
	 * value of that field, with the new boost. If the value is a collection, then each of its values will be added to the field.
13
	 * 
14
	 * The class type of value and the name parameter should match schema.xml. schema.xml can be found in conf directory under the solr home
15
	 * by default.
16
	 * 
17
	 * @param name
18
	 *            Name of the field, should match one of the field names defined under "fields" tag in schema.xml.
19
	 * @param value
20
	 *            Value of the field, should be of same class type as defined by "type" attribute of the corresponding field in schema.xml.
21
	 */
22
	public void addField(String name, Object value);
23

  
24
	/**
25
	 * Set a field with implied null value for boost.
26
	 * 
27
	 * @param name
28
	 *            name of the field to set
29
	 * @param value
30
	 *            value of the field
31
	 */
32
	public void setField(String name, Object value);
33

  
34
	/**
35
	 * Get the first value for a field.
36
	 * 
37
	 * @param name
38
	 *            name of the field to fetch
39
	 * @return first value of the field or null if not present
40
	 */
41
	public Object getFieldValue(String name);
42

  
43
	/**
44
	 * Gets the field.
45
	 * 
46
	 * @param field
47
	 *            the field
48
	 * @return the field
49
	 */
50
	public IndexField getField(String field);
51

  
52
	/**
53
	 * Remove a field from the document.
54
	 * 
55
	 * @param name
56
	 *            The field name whose field is to be removed from the document
57
	 * @return the previous field with <tt>name</tt>, or <tt>null</tt> if there was no field for <tt>key</tt>.
58
	 */
59
	public IndexField removeField(String name);
60

  
61
	/**
62
	 * Get all the values for a field.
63
	 * 
64
	 * @param name
65
	 *            name of the field to fetch
66
	 * @return value of the field or null if not set
67
	 */
68
	public Collection<Object> getFieldValues(String name);
69

  
70
	/**
71
	 * Get all field names.
72
	 * 
73
	 * @return Set of all field names.
74
	 */
75
	public Collection<String> getFieldNames();
76

  
77
	/**
78
	 * return a copy of index Document.
79
	 * 
80
	 * @return the index document
81
	 */
82
	public IndexDocument deepCopy();
83

  
84
	/**
85
	 * Gets the status.
86
	 * 
87
	 * @return the status
88
	 */
89
	public Status getStatus();
90

  
91
	/**
92
	 * The set status.
93
	 * 
94
	 * @param status
95
	 *            the status
96
	 * @return the index document
97
	 */
98
	public IndexDocument setStatus(Status status);
99

  
100
	/**
101
	 * If there was an error building the document, it is described here.
102
	 * 
103
	 * @return the error
104
	 */
105
	public Throwable getError();
106

  
107
	/**
108
	 * Sets the error.
109
	 * 
110
	 * @param error
111
	 *            the error
112
	 * @return the index document
113
	 */
114
	public IndexDocument setError(final Throwable error);
115

  
116
	/**
117
	 * Sets the ok status to the index document.
118
	 * 
119
	 * @return the index document
120
	 */
121
	public IndexDocument setOK();
122

  
123
	/**
124
	 * Sets the status marked to the index document.
125
	 * 
126
	 * @return the index document
127
	 */
128
	public IndexDocument setMarked();
129

  
130
}
modules/dnet-index-client/tags/dnet-index-client-2.3.2-solr75/src/main/java/eu/dnetlib/functionality/index/model/document/AbstractIndexDocument.java
1
package eu.dnetlib.functionality.index.model.document;
2

  
3
import java.util.Collection;
4
import java.util.Iterator;
5
import java.util.LinkedHashMap;
6
import java.util.Map;
7
import java.util.Set;
8

  
9
import eu.dnetlib.functionality.index.model.Any.ValueType;
10
import eu.dnetlib.functionality.index.utils.IndexFieldUtility;
11

  
12
/**
13
 * The Class AbstractDocument Represent the field information needed to construct and index Document.
14
 */
15
public abstract class AbstractIndexDocument implements Map<String, IndexField>, Iterable<IndexField>, IndexDocument {
16

  
17
	/** The _fields. */
18
	protected final Map<String, IndexField> fields;
19

  
20
	private static final String DATE_SUFFIX = "\\+\\d{2}:\\d{2}";
21

  
22
	/**
23
	 * Actual document status.
24
	 */
25
	private Status status;
26

  
27
	/**
28
	 * index schema.
29
	 */
30
	protected final Map<String, ValueType> schema;
31

  
32
	/**
33
	 * If there was an error building the document, it is described here.
34
	 */
35
	private Throwable error;
36

  
37
	/**
38
	 * Instantiates a new abstract document.
39
	 */
40
	public AbstractIndexDocument(final Map<String, ValueType> schema, final String dsId) {
41
		this.schema = schema;
42
		fields = new LinkedHashMap<String, IndexField>();
43
		// addField(IndexFieldUtility.DS_ID, dsId);
44
	}
45

  
46
	/**
47
	 * Instantiates a new abstract document.
48
	 *
49
	 * @param fields
50
	 *            the fields
51
	 */
52
	public AbstractIndexDocument(final Map<String, ValueType> schema, final String dsId, final Map<String, IndexField> fields) {
53
		this.schema = schema;
54
		this.fields = fields;
55
		addField(IndexFieldUtility.DS_ID, dsId);
56
	}
57

  
58
	/**
59
	 * Remove all fields and boosts from the document.
60
	 */
61
	@Override
62
	public void clear() {
63
		if (fields != null) {
64
			fields.clear();
65
		}
66
	}
67

  
68
	/**
69
	 * {@inheritDoc}
70
	 *
71
	 * @see eu.dnetlib.functionality.index.model.document.IndexDocument#addField(java.lang.String, java.lang.Object)
72
	 */
73
	@Override
74
	public void addField(final String name, final Object value) {
75
		Object hack_value = hackField(name, value);
76
		IndexField field = fields.get(name);
77
		if ((field == null) || (field.getValue() == null)) {
78
			setField(name, hack_value);
79
		} else {
80
			field.addValue(hack_value);
81
		}
82
	}
83

  
84
	/**
85
	 * {@inheritDoc}
86
	 *
87
	 * @see eu.dnetlib.functionality.index.model.document.IndexDocument#getFieldValue(java.lang.String)
88
	 */
89
	@Override
90
	public Object getFieldValue(final String name) {
91
		IndexField field = getField(name);
92
		Object o = null;
93
		if (field != null) {
94
			o = field.getFirstValue();
95
		}
96
		return o;
97
	}
98

  
99
	/**
100
	 * {@inheritDoc}
101
	 *
102
	 * @see eu.dnetlib.functionality.index.model.document.IndexDocument#getField(java.lang.String)
103
	 */
104
	@Override
105
	public IndexField getField(final String field) {
106
		return fields.get(field);
107
	}
108

  
109
	/**
110
	 * {@inheritDoc}
111
	 *
112
	 * @see eu.dnetlib.functionality.index.model.document.IndexDocument#getFieldValues(java.lang.String)
113
	 */
114
	@Override
115
	public Collection<Object> getFieldValues(final String name) {
116
		IndexField field = getField(name);
117
		if (field != null) return field.getValues();
118
		return null;
119
	}
120

  
121
	/**
122
	 * {@inheritDoc}
123
	 *
124
	 * @see eu.dnetlib.functionality.index.model.document.IndexDocument#getFieldNames()
125
	 */
126
	@Override
127
	public Collection<String> getFieldNames() {
128
		return fields.keySet();
129
	}
130

  
131
	/**
132
	 * {@inheritDoc}
133
	 *
134
	 * @see eu.dnetlib.functionality.index.model.document.IndexDocument#setField(java.lang.String, java.lang.Object)
135
	 */
136
	@Override
137
	public void setField(final String name, final Object value) {
138
		Object hack_value = hackField(name, value);
139
		IndexField field = new IndexField(name);
140
		fields.put(name, field);
141
		field.setValue(hack_value);
142
	}
143

  
144
	/**
145
	 * {@inheritDoc}
146
	 *
147
	 * @see eu.dnetlib.functionality.index.model.document.IndexDocument#removeField(java.lang.String)
148
	 */
149
	@Override
150
	public IndexField removeField(final String name) {
151
		return fields.remove(name);
152
	}
153

  
154
	/**
155
	 * {@inheritDoc}
156
	 *
157
	 * @see java.lang.Iterable#iterator()
158
	 */
159
	@Override
160
	public Iterator<IndexField> iterator() {
161
		return fields.values().iterator();
162
	}
163

  
164
	/**
165
	 * {@inheritDoc}
166
	 *
167
	 * @see java.lang.Object#toString()
168
	 */
169
	@Override
170
	public String toString() {
171
		return "IndexDocument: " + fields.values();
172
	}
173

  
174
	// ---------------------------------------------------
175
	// MAP interface
176
	// ---------------------------------------------------
177

  
178
	/**
179
	 * {@inheritDoc}
180
	 *
181
	 * @see java.util.Map#containsKey(java.lang.Object)
182
	 */
183
	@Override
184
	public boolean containsKey(final Object key) {
185
		return fields.containsKey(key);
186
	}
187

  
188
	/**
189
	 * {@inheritDoc}
190
	 *
191
	 * @see java.util.Map#containsValue(java.lang.Object)
192
	 */
193
	@Override
194
	public boolean containsValue(final Object value) {
195
		return fields.containsValue(value);
196
	}
197

  
198
	/**
199
	 * {@inheritDoc}
200
	 *
201
	 * @see java.util.Map#entrySet()
202
	 */
203
	@Override
204
	public Set<Entry<String, IndexField>> entrySet() {
205
		return fields.entrySet();
206
	}
207

  
208
	/**
209
	 * {@inheritDoc}
210
	 *
211
	 * @see java.util.Map#get(java.lang.Object)
212
	 */
213
	@Override
214
	public IndexField get(final Object key) {
215
		return fields.get(key);
216
	}
217

  
218
	/**
219
	 * {@inheritDoc}
220
	 *
221
	 * @see java.util.Map#isEmpty()
222
	 */
223
	@Override
224
	public boolean isEmpty() {
225
		return fields.isEmpty();
226
	}
227

  
228
	/**
229
	 * {@inheritDoc}
230
	 *
231
	 * @see java.util.Map#keySet()
232
	 */
233
	@Override
234
	public Set<String> keySet() {
235
		return fields.keySet();
236
	}
237

  
238
	/**
239
	 * {@inheritDoc}
240
	 *
241
	 * @see java.util.Map#put(java.lang.Object, java.lang.Object)
242
	 */
243
	@Override
244
	public IndexField put(final String key, final IndexField value) {
245
		return fields.put(key, value);
246
	}
247

  
248
	/**
249
	 * {@inheritDoc}
250
	 *
251
	 * @see java.util.Map#putAll(java.util.Map)
252
	 */
253
	@Override
254
	public void putAll(final Map<? extends String, ? extends IndexField> t) {
255
		fields.putAll(t);
256
	}
257

  
258
	/**
259
	 * {@inheritDoc}
260
	 *
261
	 * @see java.util.Map#remove(java.lang.Object)
262
	 */
263
	@Override
264
	public IndexField remove(final Object key) {
265
		return fields.remove(key);
266
	}
267

  
268
	/**
269
	 * {@inheritDoc}
270
	 *
271
	 * @see java.util.Map#size()
272
	 */
273
	@Override
274
	public int size() {
275
		return fields.size();
276
	}
277

  
278
	/**
279
	 * {@inheritDoc}
280
	 *
281
	 * @see java.util.Map#values()
282
	 */
283
	@Override
284
	public Collection<IndexField> values() {
285
		return fields.values();
286
	}
287

  
288
	/**
289
	 * {@inheritDoc}
290
	 *
291
	 * @see eu.dnetlib.functionality.index.model.document.IndexDocument#getStatus()
292
	 */
293
	@Override
294
	public Status getStatus() {
295
		return status;
296
	}
297

  
298
	/**
299
	 * Sets the status.
300
	 *
301
	 * @param status
302
	 *            the status to set
303
	 * @return the index document
304
	 */
305
	@Override
306
	public IndexDocument setStatus(final Status status) {
307
		this.status = status;
308
		return this;
309
	}
310

  
311
	/**
312
	 * {@inheritDoc}
313
	 *
314
	 * @see eu.dnetlib.functionality.index.model.document.IndexDocument#deepCopy()
315
	 */
316
	@Override
317
	public IndexDocument deepCopy() {
318
		// TODO Auto-generated method stub
319
		return null;
320
	}
321

  
322
	/**
323
	 * {@inheritDoc}
324
	 *
325
	 * @see eu.dnetlib.functionality.index.model.document.IndexDocument#getError()
326
	 */
327
	@Override
328
	public Throwable getError() {
329

  
330
		return error;
331
	}
332

  
333
	/**
334
	 * {@inheritDoc}
335
	 *
336
	 * @see eu.dnetlib.functionality.index.model.document.IndexDocument#setOK()
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff