Project

General

Profile

« Previous | Next » 

Revision 54115

remoed deprecated methods to retrieve the first harvest date from the workflow logger db

View differences:

MongoLoggerClientImpl.java
126 126
		return Instant.parse(startDate.replaceAll("\\+.*", "Z"));
127 127
	}
128 128

  
129
	@Override
130
	@Deprecated
131
	@Cacheable("dsm-firstharvestdate-cache")
132
	public String firstHarvestDate(final String dsId) throws DsmException {
133
		log.warn(String.format("firstHarvestDate(dsId = %s): not using cache", dsId));
134
		final Bson query = queryForAggregationHistory(dsId, "collect");
135
		try {
136
			final Optional<AggregationInfo> first = Utils.stream(getCollection().find(query)
137
					.projection(fields)
138
					.sort(dbo("system:startHumanDate", 1))
139
					.limit(1)
140
					.iterator())
141
					.map(getMapper())
142
					.findFirst();
143

  
144
			return first.isPresent() ? first.get().getDate() : null;
145
		} catch (Throwable e) {
146
			throw new DsmException(HttpStatus.SC_INTERNAL_SERVER_ERROR, String.format("error reading first harvesting date", dsId), e);
147
		}
148
	}
149

  
150 129
	private Instant asInstant(final AggregationInfo a) {
151 130
		return Instant.parse(a.getDate() + "T00:00:00Z");
152 131
	}

Also available in: Unified diff