Skip to content

Commit

Permalink
Merge pull request #2985 from ingef/fix/form_serdes_error
Browse files Browse the repository at this point in the history
Fix/form serdes error
  • Loading branch information
thoniTUB authored Mar 17, 2023
2 parents 6a8414c + 105463f commit 3ca6c78
Show file tree
Hide file tree
Showing 30 changed files with 305 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.ClassToInstanceMap;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;

/**
* API representation of a form query.
*/
@EqualsAndHashCode
public abstract class Form implements QueryDescription {

/**
Expand All @@ -30,6 +32,7 @@ public abstract class Form implements QueryDescription {
@Nullable
@Getter
@Setter
@EqualsAndHashCode.Exclude
private JsonNode values;

@JsonIgnore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
import com.bakdata.conquery.models.query.QueryResolveContext;
import com.bakdata.conquery.models.query.Visitable;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@CPSType(id = "ABSOLUTE", base = Mode.class)
@EqualsAndHashCode(callSuper = true, doNotUseGetters = true)
public class AbsoluteMode extends Mode {
@NotNull
@Valid
Expand All @@ -35,6 +37,7 @@ public class AbsoluteMode extends Mode {


@JsonView(View.InternalCommunication.class)
@EqualsAndHashCode.Exclude
private ArrayConceptQuery resolvedFeatures;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.bakdata.conquery.models.query.QueryResolveContext;
import com.bakdata.conquery.models.query.Visitable;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

Expand All @@ -43,6 +44,7 @@ public void visit(Consumer<Visitable> visitor) {


@JsonView(View.InternalCommunication.class)
@EqualsAndHashCode.Exclude
private ArrayConceptQuery resolvedFeatures;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,23 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@CPSType(id = "EXPORT_FORM", base = QueryDescription.class)
@EqualsAndHashCode(callSuper = true)
public class ExportForm extends Form implements InternalForm {

@NotNull
@JsonProperty("queryGroup")
private ManagedExecutionId queryGroupId;

@JsonIgnore
@EqualsAndHashCode.Exclude
private ManagedQuery queryGroup;

@NotNull
Expand All @@ -61,6 +64,7 @@ public class ExportForm extends Form implements InternalForm {
private Mode timeMode;

@NotEmpty
@Valid
private List<CQElement> features = ImmutableList.of();

@NotNull
Expand All @@ -70,8 +74,10 @@ public class ExportForm extends Form implements InternalForm {
private boolean alsoCreateCoarserSubdivisions = false;

@JsonIgnore
@EqualsAndHashCode.Exclude
private Query prerequisite;
@JsonIgnore
@EqualsAndHashCode.Exclude
private List<Resolution> resolvedResolutions;
@Override
public void visit(Consumer<Visitable> visitor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
import com.bakdata.conquery.models.query.Visitable;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, include = JsonTypeInfo.As.PROPERTY, property = "value")
@CPSBase
@EqualsAndHashCode
public abstract class Mode implements Visitable {

@Getter
@Setter
@JsonBackReference
@EqualsAndHashCode.Exclude
private ExportForm form;

public abstract void resolve(QueryResolveContext context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
import com.bakdata.conquery.models.query.QueryResolveContext;
import com.bakdata.conquery.models.query.Visitable;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@Getter @Setter
@CPSType(id="RELATIVE", base=Mode.class)
@CPSType(id = "RELATIVE", base = Mode.class)
@EqualsAndHashCode(callSuper = true)
public class RelativeMode extends Mode {
@NotNull
private CalendarUnit timeUnit;
Expand All @@ -36,6 +38,7 @@ public class RelativeMode extends Mode {


@JsonView(View.InternalCommunication.class)
@EqualsAndHashCode.Exclude
private ArrayConceptQuery resolvedFeatures;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
import com.bakdata.conquery.models.query.resultinfo.ResultInfo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "type")
@CPSBase
@EqualsAndHashCode
public abstract class CQElement implements Visitable {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.validation.ValidationMethod;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString(exclude = "concept")
@EqualsAndHashCode
public class CQTable {
@Valid
@NotNull
Expand All @@ -35,6 +37,7 @@ public class CQTable {
private List<Select> selects = Collections.emptyList();

@JsonBackReference
@EqualsAndHashCode.Exclude
private CQConcept concept;

@NsIdRef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.exc.InvalidTypeIdException;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
Expand All @@ -40,6 +41,7 @@
@NoArgsConstructor
@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "type")
@CPSBase
@EqualsAndHashCode
@ToString(of = "value")
public abstract class FilterValue<VALUE> {
@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
import io.dropwizard.validation.ValidationMethod;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
Expand All @@ -59,6 +60,7 @@
@CPSType(id = "CONCEPT", base = CQElement.class)
@Slf4j
@ToString
@EqualsAndHashCode(callSuper = true, doNotUseGetters = true)
public class CQConcept extends CQElement implements NamespacedIdentifiableHolding, ExportForm.DefaultSelectSettable {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class User extends PermissionOwner<UserId> implements Principal, RoleOwne
private final transient ShiroUserAdapter shiroUserAdapter;

@JsonCreator
public User(String name, String label) {
protected User(String name, String label) {
this(name, label, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.base.Preconditions;
import io.dropwizard.validation.ValidationMethod;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
Expand All @@ -42,6 +43,7 @@ public class Column extends Labeled<ColumnId> implements NamespacedIdentifiable<

@JsonBackReference
@NotNull
@EqualsAndHashCode.Exclude
private Table table;
@NotNull
private MajorTypeId type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;

@Data
@RequiredArgsConstructor(onConstructor_ = {@JsonCreator})
public class ImportColumn extends NamedImpl<ImportColumnId> implements NamespacedIdentifiable<ImportColumnId> {
// TODO reduce usage of this class, it does nothing except hold a description
@JsonBackReference @NotNull
@JsonBackReference
@NotNull
@EqualsAndHashCode.Exclude
private final Import parent;

// Only used on ManagerNode for com.bakdata.conquery.models.datasets.concepts.filters.specific.AbstractSelectFilter.addImport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
Expand All @@ -42,6 +43,7 @@
@ToString(of = {"connectors"})
@Getter
@Setter
@EqualsAndHashCode(callSuper = true)
public abstract class Concept<CONNECTOR extends Connector> extends ConceptElement<ConceptId> implements Authorized {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
import com.bakdata.conquery.models.identifiable.ids.specific.ConceptElementId;
import com.bakdata.conquery.models.identifiable.ids.specific.ConceptTreeChildId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@EqualsAndHashCode(callSuper = true)
public abstract class ConceptElement<ID extends ConceptElementId<? extends ConceptElement<? extends ID>>> extends Labeled<ID> implements NamespacedIdentifiable<ID> {

@Getter
Expand All @@ -38,12 +40,12 @@ public abstract class ConceptElement<ID extends ConceptElementId<? extends Conce
public ConceptTreeChild getChildById(ConceptTreeChildId conceptTreeChildId) {
throw new UnsupportedOperationException("The concept "+this+" has no children. Was looking for "+conceptTreeChildId);
}

@Override
public String toString() {
return String.format("%s[%s]", this.getClass().getSimpleName(), getLabel());
}

@JsonIgnore
public abstract Concept<?> getConcept();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.google.common.collect.Multiset.Entry;
import io.dropwizard.validation.ValidationMethod;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -52,6 +53,7 @@ public abstract class Connector extends Labeled<ConnectorId> implements SelectHo
private List<ValidityDate> validityDates = new ArrayList<>();

@JsonBackReference
@EqualsAndHashCode.Exclude
private Concept<?> concept;

@JsonIgnore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import com.bakdata.conquery.io.jackson.serializer.NsIdRef;
import com.bakdata.conquery.apiv1.KeyValue;
import com.bakdata.conquery.io.jackson.serializer.NsIdRef;
import com.bakdata.conquery.models.datasets.Dataset;
import com.bakdata.conquery.models.identifiable.Labeled;
import com.bakdata.conquery.models.identifiable.ids.specific.ConceptId;
import com.bakdata.conquery.models.identifiable.ids.specific.StructureNodeId;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
Expand All @@ -32,6 +32,7 @@ public class StructureNode extends Labeled<StructureNodeId> {
@Valid @JsonManagedReference(MANAGED_STRUCTURE_STRUCTURE)
private List<StructureNode> children = Collections.emptyList();
@JsonBackReference(MANAGED_STRUCTURE_STRUCTURE)
@EqualsAndHashCode.Exclude
private StructureNode parent;
@Getter
private LinkedHashSet<ConceptId> containedRoots = new LinkedHashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.dropwizard.validation.ValidationMethod;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
Expand All @@ -26,6 +27,7 @@ public class ValidityDate extends Labeled<ValidityDateId> implements NamespacedI
@NotNull
private Column column;
@JsonBackReference
@EqualsAndHashCode.Exclude
private Connector connector;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.dropwizard.validation.ValidationMethod;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
Expand All @@ -31,12 +32,14 @@
@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "type")
@CPSBase
@Slf4j
@EqualsAndHashCode(callSuper = true)
public abstract class Filter<FILTER_VALUE> extends Labeled<FilterId> implements NamespacedIdentifiable<FilterId> {

private String unit;
@JsonAlias("description")
private String tooltip;
@JsonBackReference
@EqualsAndHashCode.Exclude
private Connector connector;
private String pattern;
private Boolean allowDropFile;
Expand Down
Loading

0 comments on commit 3ca6c78

Please sign in to comment.