-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2922 from ingef/release
Merge Release
- Loading branch information
Showing
101 changed files
with
2,894 additions
and
1,034 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendPreviewConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.bakdata.conquery.apiv1.frontend; | ||
|
||
import java.util.Collection; | ||
|
||
import com.bakdata.conquery.io.jackson.serializer.NsIdRef; | ||
import com.bakdata.conquery.models.datasets.concepts.Concept; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class FrontendPreviewConfig { | ||
@Data | ||
public static class Labelled { | ||
private final String name; | ||
private final String label; | ||
} | ||
|
||
private final Collection<Labelled> all; | ||
@JsonProperty("default") | ||
private final Collection<Labelled> defaultConnectors; | ||
|
||
@NsIdRef | ||
private final Concept<?> searchConcept; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
backend/src/main/java/com/bakdata/conquery/io/jackson/serializer/LocaleDeserializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.bakdata.conquery.io.jackson.serializer; | ||
|
||
import java.io.IOException; | ||
import java.util.Locale; | ||
|
||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.core.JsonToken; | ||
import com.fasterxml.jackson.databind.DeserializationContext; | ||
import com.fasterxml.jackson.databind.JsonDeserializer; | ||
import com.fasterxml.jackson.databind.exc.MismatchedInputException; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
/** | ||
* Parses a language tag as a locale using {@link Locale#forLanguageTag(String)}. | ||
* Fails if the provided token is not a string token or the tag cannot be matched to a locale. | ||
*/ | ||
public class LocaleDeserializer extends JsonDeserializer<Locale> { | ||
|
||
public static final String ROOT_LOCALE_TAG = Locale.ROOT.toLanguageTag(); | ||
|
||
@Override | ||
public Locale deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { | ||
final JsonToken jsonToken = p.currentToken(); | ||
if (jsonToken != JsonToken.VALUE_STRING) { | ||
throw MismatchedInputException.from(p, Locale.class, "Expected a string token but found: " + jsonToken); | ||
} | ||
|
||
final String languageTag = p.getText(); | ||
final Locale locale = Locale.forLanguageTag(languageTag); | ||
|
||
if (StringUtils.isNotBlank(languageTag) && !languageTag.equals(ROOT_LOCALE_TAG) && locale == Locale.ROOT) { | ||
// When Locale#forLanguageTag does not recognize the tag it defaults to Locale.ROOT | ||
// This should only be intended if the tag was blank or "und" (undefined ~= Locale.ROOT.toLanguageTag()) | ||
throw MismatchedInputException.from(p, Locale.class, "Unable to map language tag '" + languageTag + "' to locale"); | ||
} | ||
|
||
return locale; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
backend/src/main/java/com/bakdata/conquery/io/jackson/serializer/LocaleSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.bakdata.conquery.io.jackson.serializer; | ||
|
||
import java.io.IOException; | ||
import java.util.Locale; | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.databind.JsonSerializer; | ||
import com.fasterxml.jackson.databind.SerializerProvider; | ||
|
||
/** | ||
* Uses the language tag provided by {@link Locale#toLanguageTag()} to serialize a locale as a string token. | ||
* Without this serializer Jackson would write out {@link Locale#GERMANY} as {@code \"de_DE\"}. | ||
* This serializer writes the locale as {@code de-DE}. | ||
*/ | ||
public class LocaleSerializer extends JsonSerializer<Locale> { | ||
@Override | ||
public void serialize(Locale value, JsonGenerator gen, SerializerProvider serializers) throws IOException { | ||
gen.writeString(value.toLanguageTag()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.