Loading src/main/java/es/redmic/exception/common/ExceptionType.java +2 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ public enum ExceptionType implements ExceptionTypeItfc { ES_INSERT_DOCUMENT(Constants.ES_INSERT_DOCUMENT), ES_CREATE_MAPPING_ERROR(Constants.ES_CREATE_MAPPING_ERROR), ES_DELETE_ITEM_WITH_CHILDREN_ERROR(Constants.ES_DELETE_ITEM_WITH_CHILDREN_ERROR), ES_PARENT_NOT_EXIST_ERROR(Constants.ES_PARENT_NOT_EXIST_ERROR), // DTOs DTO_NOT_VALID(Constants.DTO_NOT_VALID), Loading Loading @@ -215,6 +216,7 @@ public enum ExceptionType implements ExceptionTypeItfc { ES_INSERT_DOCUMENT = "ESInsertError", ES_CREATE_MAPPING_ERROR = "ESCreateMappingError", ES_DELETE_ITEM_WITH_CHILDREN_ERROR = "ESDeleteItemWithChildrenError", ES_PARENT_NOT_EXIST_ERROR = "ESParentNotExistError", // DTOs DTO_NOT_VALID = "DTONotValidException", Loading src/main/java/es/redmic/exception/elasticsearch/ESParentNotExistException.java 0 → 100644 +37 −0 Original line number Diff line number Diff line package es.redmic.exception.elasticsearch; /*- * #%L * Exceptions * %% * Copyright (C) 2019 REDMIC Project / Server * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import java.util.Arrays; import es.redmic.exception.common.BadRequestException; import es.redmic.exception.common.ExceptionType; public class ESParentNotExistException extends BadRequestException { private static final long serialVersionUID = 1L; public ESParentNotExistException(String value) { super(ExceptionType.ES_PARENT_NOT_EXIST_ERROR); setFieldErrors(Arrays.asList(value)); } } src/main/java/es/redmic/exception/factory/ExceptionFactory.java +5 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import es.redmic.exception.data.ItemAlreadyExistException; import es.redmic.exception.data.ItemNotFoundException; import es.redmic.exception.elasticsearch.ESDeleteItemWithChildrenException; import es.redmic.exception.elasticsearch.ESInsertException; import es.redmic.exception.elasticsearch.ESParentNotExistException; import es.redmic.exception.elasticsearch.ESUpdateException; public class ExceptionFactory { Loading Loading @@ -63,6 +64,10 @@ public class ExceptionFactory { && (arguments != null && arguments.size() > 0)) return new ESDeleteItemWithChildrenException(getKeysFromMap(arguments), getValuesFromMap(arguments)); if (exceptionType.equals(ExceptionType.ES_PARENT_NOT_EXIST_ERROR.name()) && (arguments != null && arguments.size() > 0)) return new ESParentNotExistException(getValuesFromMap(arguments)); if (exceptionType.equals(ExceptionType.INTERNAL_EXCEPTION.name()) && (arguments == null)) return new InternalException(ExceptionType.INTERNAL_EXCEPTION); Loading src/main/resources/i18n/messages_en_EN.properties +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ ESQueryError=Error. Query is erroneous. ESInsertError=Error. Register with field {0} and value {1} already exists. ESCreateMappingError=Error. Mapping for index {0} could not be created. ESDeleteItemWithChildrenError=Error. Unable to delete the item with field {0} with value {1}. Has children and it is not possible to remove it. ESParentNotExistError=Error. Trying to associate an item with a father with id {0} who does not exist. #Layer LayerNotFound=Layer {0} does not exist in service {1} Loading src/main/resources/i18n/messages_es_ES.properties +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ ESQueryError=Error. La consulta realizada es erronea. ESInsertError=Error. El registro con campo {0} y valor {1} ya existe. ESCreateMappingError=Error. El mapping para el índice {0} no se ha podido crear. ESDeleteItemWithChildrenError=Error. No se ha podido eliminar el item con campo {0} y valor {1}. Tiene hijo/s asociado/s y no es posible borrarlo. ESParentNotExistError=Error. Tratando de asociar un item a un padre con id {0} que no existe. #Layer LayerNotFound=La capa {0} no existe en el servicio {1} Loading Loading
src/main/java/es/redmic/exception/common/ExceptionType.java +2 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ public enum ExceptionType implements ExceptionTypeItfc { ES_INSERT_DOCUMENT(Constants.ES_INSERT_DOCUMENT), ES_CREATE_MAPPING_ERROR(Constants.ES_CREATE_MAPPING_ERROR), ES_DELETE_ITEM_WITH_CHILDREN_ERROR(Constants.ES_DELETE_ITEM_WITH_CHILDREN_ERROR), ES_PARENT_NOT_EXIST_ERROR(Constants.ES_PARENT_NOT_EXIST_ERROR), // DTOs DTO_NOT_VALID(Constants.DTO_NOT_VALID), Loading Loading @@ -215,6 +216,7 @@ public enum ExceptionType implements ExceptionTypeItfc { ES_INSERT_DOCUMENT = "ESInsertError", ES_CREATE_MAPPING_ERROR = "ESCreateMappingError", ES_DELETE_ITEM_WITH_CHILDREN_ERROR = "ESDeleteItemWithChildrenError", ES_PARENT_NOT_EXIST_ERROR = "ESParentNotExistError", // DTOs DTO_NOT_VALID = "DTONotValidException", Loading
src/main/java/es/redmic/exception/elasticsearch/ESParentNotExistException.java 0 → 100644 +37 −0 Original line number Diff line number Diff line package es.redmic.exception.elasticsearch; /*- * #%L * Exceptions * %% * Copyright (C) 2019 REDMIC Project / Server * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import java.util.Arrays; import es.redmic.exception.common.BadRequestException; import es.redmic.exception.common.ExceptionType; public class ESParentNotExistException extends BadRequestException { private static final long serialVersionUID = 1L; public ESParentNotExistException(String value) { super(ExceptionType.ES_PARENT_NOT_EXIST_ERROR); setFieldErrors(Arrays.asList(value)); } }
src/main/java/es/redmic/exception/factory/ExceptionFactory.java +5 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import es.redmic.exception.data.ItemAlreadyExistException; import es.redmic.exception.data.ItemNotFoundException; import es.redmic.exception.elasticsearch.ESDeleteItemWithChildrenException; import es.redmic.exception.elasticsearch.ESInsertException; import es.redmic.exception.elasticsearch.ESParentNotExistException; import es.redmic.exception.elasticsearch.ESUpdateException; public class ExceptionFactory { Loading Loading @@ -63,6 +64,10 @@ public class ExceptionFactory { && (arguments != null && arguments.size() > 0)) return new ESDeleteItemWithChildrenException(getKeysFromMap(arguments), getValuesFromMap(arguments)); if (exceptionType.equals(ExceptionType.ES_PARENT_NOT_EXIST_ERROR.name()) && (arguments != null && arguments.size() > 0)) return new ESParentNotExistException(getValuesFromMap(arguments)); if (exceptionType.equals(ExceptionType.INTERNAL_EXCEPTION.name()) && (arguments == null)) return new InternalException(ExceptionType.INTERNAL_EXCEPTION); Loading
src/main/resources/i18n/messages_en_EN.properties +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ ESQueryError=Error. Query is erroneous. ESInsertError=Error. Register with field {0} and value {1} already exists. ESCreateMappingError=Error. Mapping for index {0} could not be created. ESDeleteItemWithChildrenError=Error. Unable to delete the item with field {0} with value {1}. Has children and it is not possible to remove it. ESParentNotExistError=Error. Trying to associate an item with a father with id {0} who does not exist. #Layer LayerNotFound=Layer {0} does not exist in service {1} Loading
src/main/resources/i18n/messages_es_ES.properties +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ ESQueryError=Error. La consulta realizada es erronea. ESInsertError=Error. El registro con campo {0} y valor {1} ya existe. ESCreateMappingError=Error. El mapping para el índice {0} no se ha podido crear. ESDeleteItemWithChildrenError=Error. No se ha podido eliminar el item con campo {0} y valor {1}. Tiene hijo/s asociado/s y no es posible borrarlo. ESParentNotExistError=Error. Tratando de asociar un item a un padre con id {0} que no existe. #Layer LayerNotFound=La capa {0} no existe en el servicio {1} Loading