Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix elide-model-config build warnings #1971

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.LinkedHashSet;
import java.util.Set;
Expand All @@ -33,7 +32,6 @@
@Data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@Data
@JsonDeserialize(builder = Argument.ArgumentBuilder.class)
@Data

@EqualsAndHashCode()
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Argument implements Named {

Expand All @@ -48,14 +46,18 @@ public class Argument implements Named {

@JsonProperty("values")
@JsonDeserialize(as = LinkedHashSet.class)
private Set<String> values = new LinkedHashSet<>();
private Set<String> values;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private Set<String> values;
private final Set<String> values;


@JsonProperty("tableSource")
private String tableSource;

@JsonProperty("default")
private Object defaultValue;

public Argument() {
this.values = new LinkedHashSet<>();
}

Comment on lines +57 to +60
Copy link
Contributor

@wcekan wcekan Mar 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove and replace with JsonDeserialize builder.

Suggested change
public Argument() {
this.values = new LinkedHashSet<>();
}

/**
* Returns description of the argument.
* If null, returns the name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.Singular;

import java.util.ArrayList;
Expand Down Expand Up @@ -45,7 +44,6 @@
@Data
@EqualsAndHashCode()
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Dimension implements Named {

Expand All @@ -62,10 +60,10 @@ public class Dimension implements Named {
private String category;

@JsonProperty("hidden")
private Boolean hidden = false;
private Boolean hidden;

@JsonProperty("readAccess")
private String readAccess = "Prefab.Role.All";
private String readAccess;

@JsonProperty("definition")
private String definition;
Expand All @@ -78,23 +76,32 @@ public class Dimension implements Named {

@JsonProperty("grains")
@Singular
private List<Grain> grains = new ArrayList<>();
private List<Grain> grains;

@JsonProperty("tags")
@JsonDeserialize(as = LinkedHashSet.class)
private Set<String> tags = new LinkedHashSet<>();
private Set<String> tags;

@JsonProperty("arguments")
@Singular
private List<Argument> arguments = new ArrayList<>();
private List<Argument> arguments;

@JsonProperty("values")
@JsonDeserialize(as = LinkedHashSet.class)
private Set<String> values = new LinkedHashSet<>();
private Set<String> values;

@JsonProperty("tableSource")
private String tableSource;

public Dimension() {
this.hidden = false;
this.readAccess = "Prefab.Role.All";
this.grains = new ArrayList<>();
this.tags = new LinkedHashSet<>();
this.values = new LinkedHashSet<>();
this.arguments = new ArrayList<>();
}

Comment on lines +96 to +104
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public Dimension() {
this.hidden = false;
this.readAccess = "Prefab.Role.All";
this.grains = new ArrayList<>();
this.tags = new LinkedHashSet<>();
this.values = new LinkedHashSet<>();
this.arguments = new ArrayList<>();
}

/**
* Returns description of the dimension.
* If null, returns the name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
* Joins describe the SQL expression necessary to join two physical tables.
Expand All @@ -29,7 +29,6 @@
@Data
@EqualsAndHashCode()
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Join implements Named {

Expand All @@ -43,11 +42,15 @@ public class Join implements Named {
private Join.Type type;

@JsonProperty("kind")
private Join.Kind kind = Join.Kind.TOONE;
private Join.Kind kind;

@JsonProperty("definition")
private String definition;

public Join() {
this.kind = Join.Kind.TOONE;
}

public enum Kind {

TOONE("toOne"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.Singular;

import java.util.ArrayList;
Expand Down Expand Up @@ -41,7 +40,6 @@
@Data
@EqualsAndHashCode()
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Measure implements Named {

Expand All @@ -58,10 +56,10 @@ public class Measure implements Named {
private String category;

@JsonProperty("hidden")
private Boolean hidden = false;
private Boolean hidden;

@JsonProperty("readAccess")
private String readAccess = "Prefab.Role.All";
private String readAccess;

@JsonProperty("definition")
private String definition;
Expand All @@ -74,11 +72,18 @@ public class Measure implements Named {

@JsonProperty("tags")
@JsonDeserialize(as = LinkedHashSet.class)
private Set<String> tags = new LinkedHashSet<>();
private Set<String> tags;

@JsonProperty("arguments")
@Singular
private List<Argument> arguments = new ArrayList<>();
private List<Argument> arguments;

public Measure() {
this.hidden = false;
this.readAccess = "Prefab.Role.All";
this.tags = new LinkedHashSet<>();
this.arguments = new ArrayList<>();
}

/**
* Returns description of the measure.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.Singular;

import java.util.ArrayList;
Expand Down Expand Up @@ -51,7 +50,6 @@
@Data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use builder for Jackson deserializer

Suggested change
@Data
@JsonDeserialize(builder = Table.TableBuilder.class)
@Data

@EqualsAndHashCode()
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Table implements Named {

Expand All @@ -68,10 +66,10 @@ public class Table implements Named {
private String dbConnectionName;

@JsonProperty("isFact")
private Boolean isFact = true;
private Boolean isFact;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aklish are this fields purposely modifiable after building? Or should they all be final?

Suggested change
private Boolean isFact;
private final Boolean isFact;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we cannot declare all fields final, because we have inheritance logic


@JsonProperty("hidden")
private Boolean hidden = false;
private Boolean hidden;

@JsonProperty("description")
private String description;
Expand All @@ -86,27 +84,27 @@ public class Table implements Named {
private String cardinality;

@JsonProperty("readAccess")
private String readAccess = "Prefab.Role.All";
private String readAccess;

@JsonProperty("joins")
@Singular
private List<Join> joins = new ArrayList<>();
private List<Join> joins;

@JsonProperty("measures")
@Singular
private List<Measure> measures = new ArrayList<>();
private List<Measure> measures;

@JsonProperty("dimensions")
@Singular
private List<Dimension> dimensions = new ArrayList<>();
private List<Dimension> dimensions;

@JsonProperty("tags")
@JsonDeserialize(as = LinkedHashSet.class)
private Set<String> tags = new LinkedHashSet<>();
private Set<String> tags;

@JsonProperty("arguments")
@Singular
private List<Argument> arguments = new ArrayList<>();
private List<Argument> arguments;

@JsonProperty("extend")
private String extend;
Expand All @@ -117,6 +115,17 @@ public class Table implements Named {
@JsonProperty("table")
private String table;

public Table() {
this.isFact = true;
this.hidden = false;
this.readAccess = "Prefab.Role.All";
this.joins = new ArrayList<>();
this.measures = new ArrayList<>();
this.dimensions = new ArrayList<>();
this.tags = new LinkedHashSet<>();
this.arguments = new ArrayList<>();
}

/**
* Returns description of the table object.
* If null, returns the name.
Expand Down