Commit c536514d authored by Noel Alonso's avatar Noel Alonso
Browse files

Elimina métodos con herencia de tres niveles

Ya que en esta versión de elasticsearch y posteriores no se mantiene
compatibilidad
parent f0e9e62b
Loading
Loading
Loading
Loading
+6 −20
Original line number Diff line number Diff line
@@ -308,14 +308,10 @@ public abstract class RBaseESRepository<TModel extends BaseES<?>, TQueryDTO exte
	protected abstract JavaType getSourceType(Class<?> wrapperClass);

	protected GetResponse getRequest(String id) {
		return getRequest(id, null, null);
		return getRequest(id, null);
	}

	protected GetResponse getRequest(String id, String parentId) {
		return getRequest(id, parentId, null);
	}

	protected GetResponse getRequest(String id, String parentId, String grandparentId) {

		LOGGER.debug("FindById en " + getIndex() + " " + getType() + " con id " + id);

@@ -324,10 +320,7 @@ public abstract class RBaseESRepository<TModel extends BaseES<?>, TQueryDTO exte
			GetRequest getRequest = new GetRequest(getIndex()[i], getType(), id.toString());

			if (parentId != null) {
				getRequest.parent(parentId);
			}
			if (grandparentId != null) {
				getRequest.routing(grandparentId);
				getRequest.routing(parentId);
			}

			GetResponse response;
@@ -335,7 +328,7 @@ public abstract class RBaseESRepository<TModel extends BaseES<?>, TQueryDTO exte
				response = ESProvider.getClient().get(getRequest, RequestOptions.DEFAULT);
			} catch (IOException e) {
				e.printStackTrace();
				throw new ItemNotFoundException("id", id + " en el servicio " + getType());
				throw new ItemNotFoundException("id", id + " en el servicio " + getIndex()[i] + " - " + getType());
			}

			if (response != null && response.isExists()) {
@@ -343,7 +336,7 @@ public abstract class RBaseESRepository<TModel extends BaseES<?>, TQueryDTO exte
			}
		}

		throw new ItemNotFoundException("id", id + " en el servicio " + getType());
		throw new ItemNotFoundException("id", id + " en el servicio " + getIndex()[0] + " - " + getType());
	}

	public List<String> suggest(TQueryDTO queryDTO) {
@@ -412,11 +405,6 @@ public abstract class RBaseESRepository<TModel extends BaseES<?>, TQueryDTO exte

	protected MultiGetResponse multigetRequest(MgetDTO dto, String parentId) {

		return multigetRequest(dto, parentId, null);
	}

	protected MultiGetResponse multigetRequest(MgetDTO dto, String parentId, String grandParentId) {

		LOGGER.debug("Mget en " + getIndex() + " " + getType() + " con fields " + dto.getFields() + " e ids "
				+ dto.getIds());

@@ -438,11 +426,9 @@ public abstract class RBaseESRepository<TModel extends BaseES<?>, TQueryDTO exte
				Item item = new Item(getIndex()[i], getType(), dto.getIds().get(k));

				if (parentId != null) {
					item.parent(parentId);
				}
				if (grandParentId != null) {
					item.routing(grandParentId);
					item.routing(parentId);
				}

				item.fetchSourceContext(fetchSourceContext);
				request.add(item);
			}
+6 −15
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class ElasticPersistenceUtils<TModel extends BaseES<?>> {
				.setRefreshPolicy(RefreshPolicy.IMMEDIATE);
		
		if (parentId != null) {
			request.parent(parentId);
			request.routing(parentId);
		}
		
		// @formatter:on
@@ -105,7 +105,7 @@ public class ElasticPersistenceUtils<TModel extends BaseES<?>> {
				.setRefreshPolicy(RefreshPolicy.IMMEDIATE);

		if (parentId != null) {
			updateRequest.parent(parentId);
			updateRequest.routing(parentId);
		}
		
		// @formatter:on
@@ -139,7 +139,7 @@ public class ElasticPersistenceUtils<TModel extends BaseES<?>> {
		// @formatter:on

		if (parentId != null) {
			updateRequest.parent(parentId);
			updateRequest.routing(parentId);
		}

		try {
@@ -162,7 +162,7 @@ public class ElasticPersistenceUtils<TModel extends BaseES<?>> {
		DeleteRequest deleteRequest = new DeleteRequest(index, type, id).setRefreshPolicy(RefreshPolicy.IMMEDIATE);

		if (parentId != null) {
			deleteRequest.parent(parentId);
			deleteRequest.routing(parentId);
		}

		try {
@@ -181,18 +181,12 @@ public class ElasticPersistenceUtils<TModel extends BaseES<?>> {

	public List<UpdateRequest> getUpdateRequest(String[] index, String[] type, String id, Map<String, Object> fields) {

		return getUpdateRequest(index, type, id, fields, null, null);
		return getUpdateRequest(index, type, id, fields, null);
	}

	public List<UpdateRequest> getUpdateRequest(String[] index, String[] type, String id, Map<String, Object> fields,
			String parentId) {

		return getUpdateRequest(index, type, id, fields, parentId, null);
	}

	public List<UpdateRequest> getUpdateRequest(String[] index, String[] type, String id, Map<String, Object> fields,
			String parentId, String grandParentId) {

		List<UpdateRequest> result = new ArrayList<UpdateRequest>();

		for (int i = 0; i < index.length; i++) {
@@ -203,10 +197,7 @@ public class ElasticPersistenceUtils<TModel extends BaseES<?>> {
				updateRequest.id(id);
				updateRequest.fetchSource(true);
				if (parentId != null)
					updateRequest.parent(grandParentId);

				if (grandParentId != null)
					updateRequest.routing(grandParentId);
					updateRequest.routing(parentId);

				updateRequest.doc(fields);
				result.add(updateRequest);