Skip to content
Snippets Groups Projects
Commit f6faee89 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Revert "Use format instead of type property for Content deserialization"

Using format caused problems because Jackson does not support multiple
type names being mapped to a single class.

This reverts commit 96b0cf42.
parent 10f6f2ce
No related merge requests found
package de.thm.arsnova.entities;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonView;
import de.thm.arsnova.entities.serialization.View;
......@@ -12,12 +11,8 @@ import java.util.Objects;
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
property = "format",
visible = true
property = "type"
)
@JsonSubTypes({
@JsonSubTypes.Type(value = ChoiceQuestionContent.class, name = "ChoiceQuestionContent")
})
public class Content extends Entity {
public enum Format {
CHOICE,
......
......@@ -36,12 +36,8 @@ public class CouchDbDocumentModule extends SimpleModule {
context.setMixInAnnotations(Entity.class, CouchDbDocumentMixIn.class);
context.setMixInAnnotations(de.thm.arsnova.entities.migration.v2.Entity.class, CouchDbDocumentV2MixIn.class);
context.registerSubtypes(
new NamedType(Content.class, Content.Format.TEXT.toString()),
new NamedType(Content.class, Content.Format.NUMBER.toString()),
new NamedType(ChoiceQuestionContent.class, Content.Format.CHOICE.toString()),
new NamedType(ChoiceQuestionContent.class, Content.Format.BINARY.toString()),
new NamedType(ChoiceQuestionContent.class, Content.Format.SCALE.toString()),
new NamedType(ChoiceQuestionContent.class, Content.Format.GRID.toString()),
new NamedType(Content.class, Content.class.getSimpleName()),
new NamedType(ChoiceQuestionContent.class, ChoiceQuestionContent.class.getSimpleName()),
new NamedType(Answer.class, Answer.class.getSimpleName()),
new NamedType(ChoiceAnswer.class, ChoiceAnswer.class.getSimpleName()),
new NamedType(TextAnswer.class, TextAnswer.class.getSimpleName()));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment