Commit 45aa1f3c authored by Noel Alonso's avatar Noel Alonso
Browse files

Añade fecha modificación en modificación parcial

parent 484175de
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -164,8 +164,9 @@ public class LayerController extends DataController<Layer, LayerDTO, GeoDataQuer

		try {
			result = service.updateThemeInspireInLayer(event.getAggregateId(),
					Mappers.getMapper(ThemeInspireESMapper.class).map(event.getThemeInspire()));
					Mappers.getMapper(ThemeInspireESMapper.class).map(event.getThemeInspire()), event.getDate());
		} catch (Exception e) {
			e.printStackTrace();
			publishFailedEvent(LayerEventFactory.getEvent(event, LayerEventTypes.UPDATE_FAILED,
					ExceptionType.INTERNAL_EXCEPTION.name(), null), layer_topic);
			return;
+8 −2
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@@ -62,6 +64,8 @@ public class LayerESRepository extends RWDataESRepository<Layer, GeoDataQueryDTO
	private static String[] INDEX = { "layer" };
	private static String TYPE = "_doc";

	private static final String DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZZ";

	// @formatter:off
	
	private final String ID_PROPERTY = "id",
@@ -78,7 +82,8 @@ public class LayerESRepository extends RWDataESRepository<Layer, GeoDataQueryDTO
	}

	@SuppressWarnings("unchecked")
	public EventApplicationResult updateThemeInspireInLayer(String layerId, ThemeInspire themeInspire) {
	public EventApplicationResult updateThemeInspireInLayer(String layerId, ThemeInspire themeInspire,
			DateTime updated) {

		Layer source = (Layer) queryById(layerId).get_source();

@@ -88,7 +93,8 @@ public class LayerESRepository extends RWDataESRepository<Layer, GeoDataQueryDTO

		try {
			doc = jsonBuilder().startObject().field("jobIndex", objectMapper.convertValue(joinIndex, Map.class))
					.field("themeInspire", objectMapper.convertValue(themeInspire, Map.class)).endObject();
					.field("themeInspire", objectMapper.convertValue(themeInspire, Map.class))
					.field("updated", updated.withZone(DateTimeZone.UTC).toString(DATETIME_FORMAT)).endObject();
		} catch (IllegalArgumentException | IOException e1) {
			LOGGER.debug("Error modificando el item con id " + layerId + " en " + getIndex()[0] + " " + getType());
			return new EventApplicationResult(ExceptionType.ES_UPDATE_DOCUMENT.toString());
+3 −2
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ package es.redmic.atlasview.service.layer;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.joda.time.DateTime;
import org.mapstruct.factory.Mappers;

/*-
@@ -95,8 +96,8 @@ public class LayerESService extends RDataService<Layer, LayerDTO, GeoDataQueryDT
		return repository.delete(id);
	}

	public EventApplicationResult updateThemeInspireInLayer(String id, ThemeInspire themeInspire) {
		return repository.updateThemeInspireInLayer(id, themeInspire);
	public EventApplicationResult updateThemeInspireInLayer(String id, ThemeInspire themeInspire, DateTime updated) {
		return repository.updateThemeInspireInLayer(id, themeInspire, updated);
	}

	/**