Project

General

Profile

« Previous | Next » 

Revision 52042

use the same (hopefully) format for field timestamp, and the same value for each record involved in a transaction

View differences:

MDStoreDaoImpl.java
13 13
import com.mongodb.client.model.CreateCollectionOptions;
14 14
import eu.dnetlib.data.mdstore.MDStoreServiceException;
15 15
import eu.dnetlib.data.mdstore.modular.MDStoreDescription;
16
import eu.dnetlib.data.mdstore.modular.RecordParser;
16 17
import eu.dnetlib.data.mdstore.modular.RecordParserFactory;
17 18
import eu.dnetlib.data.mdstore.modular.connector.MDStore;
18 19
import eu.dnetlib.data.mdstore.modular.connector.MDStoreDBStatus;
......
91 92
	@Override
92 93
	public MDStore getMDStore(final String mdId) throws MDStoreServiceException {
93 94
		final String internalId = transactionManager.getMDStoreCollection(mdId);
94
		return new MongoMDStore(mdId, getDb().getCollection(internalId, DBObject.class), getRecordParserFactory().newInstance(), isDiscardRecords(), getDb());
95
		return new MongoMDStore(mdId, getDb().getCollection(internalId, DBObject.class), getRecordParser(), isDiscardRecords(), getDb());
95 96
	}
96 97

  
97 98
	/**
......
100 101
	@Override
101 102
	public MDStore readMDStore(final String mdId) throws MDStoreServiceException {
102 103
		final String internalId = transactionManager.readMdStore(mdId);
103
		return new MongoMDStore(mdId, getDb().getCollection(internalId, DBObject.class), getRecordParserFactory().newInstance(), isDiscardRecords(), getDb());
104
		return new MongoMDStore(mdId, getDb().getCollection(internalId, DBObject.class), getRecordParser(), isDiscardRecords(), getDb());
104 105
	}
105 106

  
106 107
	/**
......
109 110
	@Override
110 111
	public MDStore startTransaction(final String mdId, final boolean refresh) throws MDStoreServiceException {
111 112
		final String transactionId = transactionManager.startTransaction(mdId, refresh);
112
		return new MongoMDStore(transactionId, getDb().getCollection(transactionId, DBObject.class), getRecordParserFactory().newInstance(), isDiscardRecords(),
113
		return new MongoMDStore(transactionId, getDb().getCollection(transactionId, DBObject.class), getRecordParser(), isDiscardRecords(),
113 114
				getDb());
114 115
	}
115 116

  
117
	private RecordParser getRecordParser() {
118
		final RecordParser parser = getRecordParserFactory().newInstance();
119
		parser.setTimestamp(DateUtils.now());
120
		return parser;
121
	}
122

  
116 123
	/**
117 124
	 * {@inheritDoc}
118 125
	 */

Also available in: Unified diff