Skip to content

Commit

Permalink
logging the translation request
Browse files Browse the repository at this point in the history
  • Loading branch information
SrdjanStevanetic committed Apr 2, 2024
1 parent 2c99613 commit 75953e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.europeana.api.translation.definitions.model;

import java.util.List;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonSetter;
Expand All @@ -27,6 +28,7 @@ public TranslationRequest() {
super();
}

@JsonGetter(TranslationAppConstants.SOURCE_LANG)
public String getSource() {
return source;
}
Expand All @@ -36,6 +38,7 @@ public void setSource(String source) {
this.source = source;
}

@JsonGetter(TranslationAppConstants.TARGET_LANG)
public String getTarget() {
return target;
}
Expand All @@ -45,6 +48,7 @@ public void setTarget(String target) {
this.target = target;
}

@JsonGetter(TranslationAppConstants.SERVICE)
public String getService() {
return service;
}
Expand All @@ -54,6 +58,7 @@ public void setService(String service) {
this.service = service;
}

@JsonGetter(TranslationAppConstants.FALLBACK)
public String getFallback() {
return fallback;
}
Expand All @@ -63,6 +68,7 @@ public void setFallback(String fallback) {
this.fallback = fallback;
}

@JsonGetter(TranslationAppConstants.TEXT)
public List<String> getText() {
return text;
}
Expand All @@ -80,6 +86,7 @@ public boolean useCaching() {
return caching;
}

@JsonGetter(TranslationAppConstants.CACHING)
public Boolean getCaching() {
return caching;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import eu.europeana.api.commons.web.http.HttpHeaders;
import eu.europeana.api.commons.web.model.vocabulary.Operations;
import eu.europeana.api.translation.definitions.language.LanguagePair;
import eu.europeana.api.translation.definitions.vocabulary.TranslationAppConstants;
import eu.europeana.api.translation.definitions.model.TranslationRequest;
import eu.europeana.api.translation.definitions.model.TranslationResponse;
import eu.europeana.api.translation.definitions.vocabulary.TranslationAppConstants;
import eu.europeana.api.translation.web.exception.ParamValidationException;
import eu.europeana.api.translation.web.service.TranslationWebService;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand All @@ -39,6 +39,10 @@ public ResponseEntity<String> translate(@RequestBody TranslationRequest translRe
verifyWriteAccess(Operations.CREATE, request);

validateRequest(translRequest);

if(logger.isTraceEnabled()) {
logger.trace("Translation request: " + jsonLdSerializer.serializeObject(translRequest));
}

TranslationResponse result = translationService.translate(translRequest);

Expand Down

0 comments on commit 75953e8

Please sign in to comment.