Skip to content

Commit

Permalink
drop de.metas.util.web
Browse files Browse the repository at this point in the history
- refs: #10818
  • Loading branch information
cp-ps committed Mar 15, 2021
1 parent 07dee16 commit 74ffe98
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import de.metas.logging.LogManager;
import de.metas.process.PInstanceId;
import de.metas.rest_api.externlasystem.dto.ExternalSystemService;
import de.metas.rest_api.utils.JsonErrors;
import de.metas.rest_api.v2.product.command.GetProductsCommand;
import de.metas.util.web.MetasfreshRestAPIConstants;
import de.metas.vertical.healthcare.alberta.service.AlbertaProductService;
Expand All @@ -38,7 +39,6 @@
import org.compiere.util.Env;
import org.slf4j.Logger;
import org.springframework.context.annotation.Profile;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
Expand Down Expand Up @@ -78,7 +78,7 @@ public ProductsRestController(
}

@GetMapping
public ResponseEntity<JsonGetProductsResponse> getProducts(
public ResponseEntity<?> getProducts(
@RequestParam(value = SINCE, required = false) @Nullable final Instant since,
@RequestParam(value = AD_PINSTANCE_ID, required = false) @Nullable final Integer pInstanceId,
@RequestParam(value = EXTERNAL_SYSTEM_CONFIG_TYPE, required = false) @Nullable final String externalSystemConfigType,
Expand Down Expand Up @@ -113,11 +113,10 @@ public ResponseEntity<JsonGetProductsResponse> getProducts(
}
catch (final Exception ex)
{
logger.debug("Got exception", ex);
logger.error(ex.getMessage(), ex);

return ResponseEntity
.status(HttpStatus.NOT_FOUND)
.body(JsonGetProductsResponse.error(ex, adLanguage));
return ResponseEntity.badRequest()
.body(JsonErrors.ofThrowable(ex, adLanguage));
}
}

Expand Down
6 changes: 0 additions & 6 deletions misc/de-metas-common/de-metas-common-product/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,5 @@
<artifactId>de-metas-common-rest_api</artifactId>
<version>${metasfresh-common.version}</version>
</dependency>
<dependency>
<groupId>de.metas.util</groupId>
<artifactId>de.metas.util.web</artifactId>
<version>${metasfresh.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import de.metas.common.rest_api.JsonErrorItem;
import de.metas.rest_api.utils.JsonErrors;
import lombok.Builder;
import lombok.NonNull;
import lombok.Singular;
import lombok.Value;

Expand Down Expand Up @@ -46,15 +43,4 @@ public class JsonGetProductsResponse
@JsonProperty("products")
@Singular
List<JsonProduct> products;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("error")
JsonErrorItem error;

public static JsonGetProductsResponse error(@NonNull final Throwable throwable, @NonNull final String adLanguage)
{
return builder()
.error(JsonErrors.ofThrowable(throwable, adLanguage))
.build();
}
}

0 comments on commit 74ffe98

Please sign in to comment.