Skip to content

Commit

Permalink
Fulltext fixes for EA 3891
Browse files Browse the repository at this point in the history
  • Loading branch information
nshweta90 committed Aug 1, 2024
1 parent 241741e commit 4bc5e40
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.europeana.fulltext.api.model.v2;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.io.Serializable;

Expand Down Expand Up @@ -41,6 +42,7 @@ public void setLanguage(String language) {
this.language = language;
}

@JsonProperty("@type")
public String getType() { return this.type; }

public void setType(String type) { this.type = type; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class CacheUtils {
private static final String ANY = "*";
private static final String ALLOWED = "GET, HEAD";
private static final String ALLOWHEADERS = "If-Match, If-None-Match, If-Modified-Since";
private static final String EXPOSEHEADERS = "Allow, ETag, Last-Modified, Link";
private static final String EXPOSEHEADERS = "Allow, ETag, Last-Modified, Vary";
private static final String CACHE_CONTROL = "public, max-age=";
private static final String DEFAULT_MAX_AGE = "86400"; // 1 day
private static final String ACCEPT = "Accept";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@

/**
* This class contains the methods for mapping Annotation / AnnoPage Mongo bean objects to IIIF v2 / v3 fulltext
* resource objects.
*
* resource objects. *
* NOTE while a given value for the 'motivation' field in the Annotation class will be stored as such in Mongo, it is
* for now not displayed in the output. Instead, the values as specified in the EDM 2 IIIF mapping document are used;
* they are for now hard-coded in this class for both the V2 and V3 version of the output JSON.
*
* Created by luthien on 18/06/2018.
*/
@Component
Expand Down Expand Up @@ -87,7 +85,7 @@ public static AnnotationV2 getAnnotationV2(AnnoPage annoPage, Annotation annotat
String resourceIdUrl = getResourceIdUrl(annoPage, annotation);
AnnotationV2 ann = new AnnotationV2(getAnnotationIdUrl(annoPage, annotation));
if (includeContext){
ann.setContext(new String[]{MEDIA_TYPE_IIIF_V2, MEDIA_TYPE_EDM_JSONLD});
ann.setContext(new String[]{MEDIA_TYPE_IIIF_V2, TEXT_GRANULARITY_CONTEXT,MEDIA_TYPE_EDM_JSONLD});
}
ann.setMotivation(StringUtils.isNotBlank(annotation.getMotiv()) ? annotation.getMotiv() : V2_MOTIVATION);
ann.setTextGranularity(dcTypeToTextGranularity(annotation.getDcType()));
Expand Down Expand Up @@ -206,7 +204,7 @@ public static AnnotationV3 getAnnotationV3(AnnoPage annoPage, Annotation annotat
AnnotationV3 ann = new AnnotationV3(getAnnotationIdUrl(annoPage, annotation));
AnnotationBodyV3 anb;
if (includeContext) {
ann.setContext(new String[]{MEDIA_TYPE_IIIF_V3, MEDIA_TYPE_EDM_JSONLD});
ann.setContext(new String[]{MEDIA_TYPE_IIIF_V3, TEXT_GRANULARITY_CONTEXT,MEDIA_TYPE_EDM_JSONLD});
}

ann.setMotivation(StringUtils.isNotBlank(annotation.getMotiv()) ? annotation.getMotiv() : V3_MOTIVATION);
Expand Down Expand Up @@ -378,8 +376,8 @@ private static String getResourceIdUrl(AnnoPage annoPage, Annotation annotation)
/**
* Returns the Resource Id url
*
* @param annoPage
* @return
* @param annoPage -
* @return url -
*/
private static String getResourceIdBaseUrl(AnnoPage annoPage) {
String url =
Expand All @@ -388,7 +386,7 @@ private static String getResourceIdBaseUrl(AnnoPage annoPage) {
+ "/"
+ annoPage.getLcId()
+ "/";
/**
/*
* there are cases when we don't fetch the full annoPage OR Resource due to performance issues. Example - annopageInfo
* the pgId and lang is same for the annopage and resource. If resource is not available get the pgID and language from anooPage
*/
Expand Down
3 changes: 2 additions & 1 deletion api/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ server.port: 8084
spring:
application:
name: Fulltext API

mvc:
throw-exception-if-no-handler-found : true
server:
error:
include-message: always
Expand Down

0 comments on commit 4bc5e40

Please sign in to comment.