Commit 0ad90ec7 authored by Matija Obreza's avatar Matija Obreza
Browse files

Limit JSON serialization on Descriptor#vocabulary and DescriptorList#descriptor

parent 21a47f9c
......@@ -51,6 +51,7 @@ import org.springframework.dao.DataIntegrityViolationException;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
/**
......@@ -172,9 +173,10 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable,
private String bibliographicCitation;
/** The shared controlled vocabulary used by the descriptor */
@JsonIdentityReference(alwaysAsId = false)
@ManyToOne(cascade = {}, optional = true)
@JoinColumn(name = "vocabularyId")
@JsonIdentityReference(alwaysAsId = false)
@JsonIgnoreProperties(value = { "terms" })
private ControlledVocabulary vocabulary;
/**
......
......@@ -39,6 +39,7 @@ import org.genesys.common.model.Partner;
import org.genesys.common.model.SelfCleaning;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
/**
......@@ -85,6 +86,7 @@ public class DescriptorList extends UuidModel implements Publishable, SelfCleani
@ManyToMany(cascade = { CascadeType.REMOVE, CascadeType.REFRESH }, fetch = FetchType.LAZY)
@JoinTable(name = "descriptorListDescriptor", joinColumns = @JoinColumn(name = "descriptorListId", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "descriptorId", referencedColumnName = "id"))
@OrderColumn(name = "position")
@JsonIgnoreProperties(value = { "descriptorLists", "datasets", "owner", "vocabulary", "terms" })
List<Descriptor> descriptors;
/** The owner. */
......
......@@ -38,6 +38,7 @@ import org.genesys.common.model.Partner;
import org.genesys.common.model.SelfCleaning;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
/**
......@@ -102,6 +103,7 @@ public class ControlledVocabulary extends UuidModel implements Publishable, Self
/** The owner. */
@ManyToOne(cascade = {}, optional = false)
@JoinColumn(name = "partnerId", updatable = false)
@JsonIdentityReference(alwaysAsId = false)
private Partner owner;
/**
......
Supports Markdown
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