Project

General

Profile

« Previous | Next » 

Revision 48135

Re-added Mongo DB bean to logger, as it is currently needed to a class for updating the LOD in dnet-openaireplus-workflows.

View differences:

modules/dnet-mongo-logging/trunk/src/main/java/eu/dnetlib/common/logging/dao/DnetLoggerMongoDao.java
21 21
import org.apache.commons.logging.LogFactory;
22 22
import org.bson.Document;
23 23
import org.bson.conversions.Bson;
24
import org.springframework.beans.factory.annotation.Required;
24 25

  
25 26
public class DnetLoggerMongoDao implements DnetLoggerDao {
26 27

  
......
107 108
	}
108 109

  
109 110
	@Override
110
	public Iterator<Map<String, String>> findByDateRange(final String collection, final Date startDate, final Date endDate, final String key, final String value) {
111
	public Iterator<Map<String, String>> findByDateRange(final String collection,
112
			final Date startDate,
113
			final Date endDate,
114
			final String key,
115
			final String value) {
111 116
		final MongoCollection coll = db.getCollection(collection);
112 117
		final Bson query = Filters.and(getBasicQuery(key, value), getDateQuery(startDate, endDate));
113 118
		return iter(coll.find(query).iterator());
114 119
	}
115 120

  
116 121
	@Override
117
	public Iterator<Map<String, String>> findByDateRange(final String collection, final Date startDate, final Date endDate, final Map<String, Object> criteria) {
122
	public Iterator<Map<String, String>> findByDateRange(final String collection,
123
			final Date startDate,
124
			final Date endDate,
125
			final Map<String, Object> criteria) {
118 126
		final MongoCollection coll = db.getCollection(collection);
119 127
		final Bson query = Filters.and(getCustomQuery(criteria), getDateQuery(startDate, endDate));
120 128
		return iter(coll.find(query).iterator());
......
180 188
		return res;
181 189
	}
182 190

  
191
	public MongoDatabase getDb() {
192
		return db;
193
	}
194

  
195
	@Required
196
	public void setDb(final MongoDatabase db) {
197
		this.db = db;
198
	}
183 199
}
modules/dnet-mongo-logging/trunk/src/main/resources/eu/dnetlib/common/logging/dao/applicationContext-dnet-mongo-logging.xml
5 5
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
6 6
                        http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd">
7 7

  
8
	<bean id="dnetLoggerMongoDao" class="eu.dnetlib.common.logging.dao.DnetLoggerMongoDao" />
8
	<bean id="dnetLoggerMongoDao" class="eu.dnetlib.common.logging.dao.DnetLoggerMongoDao"
9
	      p:db-ref="loggingMongoDB"/>
9 10

  
10 11
	<bean id="loggingMongoClient" class="com.mongodb.MongoClient">
11 12
		<constructor-arg index="0" type="com.mongodb.ServerAddress">

Also available in: Unified diff